The problem with the old table of names is that it contains duplicates.
It is possible to end up with multiple outputs with the same name. In
that case you cannot write individual configurations for these outputs
in weston.ini, because they are matched by the name.
Change all names to follow the kernel naming scheme set in
drivers/gpu/drm/drm_crtc.c. The snprintf format now follows the kernel
style, too. Use the DRM_MODE_CONNECTOR_* macros rather than implicit
table ordering.
Completely new entries in the table are "Virtual" and "DSI".
There should not be any gaps in the macro values, but if there are, deal
with a NULL entry.
Also change "UNKNOWN" to "UNNAMED" so it's easier to distinguish from
"Unknown" by the kernel.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89361
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Tested-by: Drew DeVault <sir@cmpwn.com>
This bug was introduced in 954f183e2f.
The session_notify() data was accidentally cast to fbdev_backend while
it is weston_compositor. This was possibly due to the code before the
mentioned commit casting data directly to fbdev_compositor without going
through the intended type first, which worked only because
weston_compositor was the first member in struct fbdev_compositor.
Fix the casts to be the right way around.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91654
Cc: nerdopolis1@verizon.net
Cc: Giulio Camuffo <giuliocamuffo@gmail.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
gl_renderer_output_create expects `window_for_legacy' variable to be of
type EGLNativeWindowType, not EGLNativeDisplayType. This variable is
used later in eglCreateWindowSurface().
Signed-off-by: Dawid Gajownik <gajownik@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
The buildbots discovered this issue on Ubuntu 14.04, which carries
libgbm 10.1.3-0ubuntu0.4. The dmabuf changes need gbm 10.2, so it fails
during build like this:
src/compositor-drm.c: In function ‘drm_output_prepare_overlay_view’:
src/compositor-drm.c:984:10: error: variable ‘gbm_dmabuf’ has
initializer but incomplete type
struct gbm_import_fd_data gbm_dmabuf = {
^
etc.
Proposed fix is to conditionalize the gbm fd import feature in
compositor-drm.
This fix was suggested by daniels. I set up a synthetic test
environment to reproduce the issue as found by the buildbots and tweaked
the patch to get it to build both with and without gbm 10.2.
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
v2:
- add TODO note about multi-planar import and how we should do it
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
v2 changes:
- only initialize linux_dmabuf if renderer supports it
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
v2 changes:
- only initialize linux_dmabuf if renderer supports it
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Import dmabuf as an EGLImage, and hold on to the EGLImage until we are
signalled a content change. On content change, destroy the EGLImage and
re-import to trigger GPU cache flushes.
We hold on to the EGLImage as long as possible just in case the client
does other imports that might later make re-importing fail.
As dmabuf protocol uses drm_fourcc codes, we need libdrm for
drm_fourcc.h. However, we are not doing any libdrm function calls, so
there is no new need to link to libdrm.
RFCv1 changes:
- fix error if dmabuf exposed unsupported
- always use GL_TEXTURE_EXTERNAL_OES with dmabuf
v2 changes:
- improve support check and error handling
- hold on to the imported EGLImage to avoid the dmabuf becoming
unimportable in the future
- send internal errors with linux_dmabuf_buffer_send_server_error()
- import EGL_EXT_image_dma_buf_import extension headers
- use heuristics to decide between GL_TEXTURE_2D and
GL_TEXTURE_EXTERNAL_OES
- add comment about Mesa requirements
- change y-invert from per-plane boolean to per-buffer flag
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
This is a reference-counted holder of an EGLImage. For now, direct
EGLImage usage is simply converted to use egl_image. Use of reference
counting will come in a later patch.
v2:
- this is a new patch, split from gl-renderer dmabuf import support
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
v2 changes:
- implement the revised protocol
- add basic sanity checks when creating buffer and check for support
- add way to attach user data to the dmabuf for renderer use
- bump max number of planes to 4 to follow DRM AddFb2 ioctl
- improve errors handling
- use separate linux_dmabuf_buffer fields for the different wl_resource
types
- as SERVER_ERROR code is no more, use a wl_display "generic" error for
emergency-disconneting a client we fail to process
- more documentation
- change y-invert from per-plane boolean to per-buffer flag
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
According to POSIX standard "upon successful completion, putenv() shall
return 0; otherwise, it shall return a non-zero value." Unlike in
setenv() we should not be checking only for negative values.
Signed-off-by: Dawid Gajownik <gajownik@gmail.com>
When the output can't be completely created in the backend (for example
lack of memory), weston_compositor_add_output() is never run. In such
a case output->link is not initialized. Letter, when
weston_output_destroy() is called, application crashes on
wl_list_remove(&output->link).
This problem happens when drm, fbdev, rdp, rpi or wayland backend is
used.
v2: Initialize output->link in weston_output_init() as suggested by
Derek Foreman.
Signed-off-by: Dawid Gajownik <gajownik@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
If we destroy all the devices before trying to remove keyboard focus
we'll segfault because we destroyed the keyboard.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Ryo Munakata <ryomnktml@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
- opening braces are on the same line as the if statement
- opening braces are not on the same line as the function name
- space between for/while/if and opening parenthesis
Signed-off-by: Dawid Gajownik <gajownik@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
We already do this math in compositor.c so let's not duplicate it here.
Additionally, the copy here has broken zoom, so this also fixes zooming.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Valgrind has shown that in at least one place (default_grab_pointer_focus)
we're testing uninitialized values coming out of weston_compositor_pick_view.
This is happening when default_grab_pointer_focus is called when there is
nothing on the view list, and during the first repaint when only the black
surface with no input region exists.
This patch adds a function to clear pointer focus and also set the sx,sy
co-ordinates to a sentinel value we shouldn't compute with.
Assertions are added to make sure any time pointer focus is set to NULL
these values are used.
weston_compositor_pick_view() now returns these values too.
Now the values are always initialized, even when no view exists, and
they're initialized in such a way that actually doing computation
with them should fail in an obvious way, but we can compare them
safely for equality.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
This makes it consistent with the pointer grab, which also gets
global coordinates and not surface relative ones, and allows to
easily filter out gestures based on compositor global hotspots.
Reviewed-by: Daniel Stone <daniels@collabora.com>
In weston_compositor_create, we initialize output_list.
After that we call weston_compositor_schedule_repaint which just calls
weston_output_schedule_repaint on all elements of output_list.
This call does nothing obviously. So we remove it.
Signed-off-by: Ryo Munakata <ryomnktml@gmail.com>
Reviewed-by: Guilio Camuffo <guiliocamuffo@gmail.com>
An earlier patch made surface_resize() and surface_move() take pointers
instead of seats, this updates the weston_shell_interface resize and move to
match.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
When something goes wrong during weston initialization,
weston_compositor_destroy() is executed. It destroys the backend and
then frees compositor memory. Unfortunately RDP backend is not correctly
destroyed. It frees compositor instead of a backend memory. This causes
later a double free error. The easiest way to reproduce a problem is to
run weston with an invalid option.
Additionally some other objects of rdp_backend structure are not
destroyed/freed. The patch fixes both issues.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=91457
v3: comply with Weston coding style, this time for real
v2: comply with Weston coding style
Signed-off-by: Dawid Gajownik <gajownik@gmail.com>
Reviewed-by: David FORT <contact@hardening-consulting.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Keyboards and pointers aren't freed when devices are removed, so we
should really be testing keyboard_device_count and pointer_device_count
in most cases, not the actual pointers. Otherwise we end up with
different behaviour after removing a device than we had before it was
inserted.
This commit makes screen-share.c compile once again after changes in
commit 1281a36e3b.
Signed-off-by: Dawid Gajownik <gajownik@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
There's no need to check if a pointer exists before passing it to free().
free() can handle NULL pointers.
Signed-off-by: Dawid Gajownik <gajownik@gmail.com>
Reviewed-By: David FORT <contact@hardening-consulting.com>
For better readability of `weston --help' output, backends are now sorted
in alphabetical order.
Signed-off-by: Dawid Gajownik <gajownik@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Keyboards and pointers aren't freed when devices are removed, so we should
really be testing keyboard_device_count and pointer_device_count in most
cases, not the actual pointers. Otherwise we end up with different
behaviour after removing a device than we had before it was inserted.
This commit renames the touch/keyboard/pointer pointers and adds helper
functions to get them that hide this complexity and return NULL when
*_device_count is 0.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
We shouldn't be using seat->pointer|keyboard|touch here, we should be
testing *_device_count to see if a device is currently present.
Testing the pointers directly will result in incorrectly advertising
capabilities after all devices of a type have been removed.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
`--env-socket' option is of type WESTON_OPTION_BOOLEAN, not
WESTON_OPTION_STRING. Socket should be defined in RDP_FD environment variable.
Signed-off-by: Dawid Gajownik <gajownik@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Track the seat that initiated a seat instead of picking the first one.
Previously, if there are multiple seats then any seat can adjust the zoom
level but the zoom tracks the first seat's pointer.
Now the zoom will follow the pointer of the seat that initiated the zoom.
Additionally, if there's no pointer in the first seat, starting a zoom
with the second seat will no longer crash weston.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
No longer call weston_output_update_zoom() when trying to zoom out
on an unzoomed output.
Add an assert() to make sure update_zoom is never called without an
active zoom.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
It doesn't do anything with a pointer, and zoom can be initiated by the
keyboard, so the name was a little confusing.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
The initialization of the freerdp_peer was done too early.
This fixes https://bugs.freedesktop.org/show_bug.cgi?id=91390.
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
backend_init now returns an int not a pointer.
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Allows to force loading an identity gamma table if
option icc_profile= is given in weston.ini for
an output, ie., icc_profile= is specified to an
empty assignment.
Some special display output devices, e.g., for
neuro-science applications, and special display
testing hardware need a guaranteed perfect pixel
passthrough from framebuffer to output. This is
an easy way to set this up for cms-static.
v2: Remove confusing/redundant weston_log debug output.
v3: Don't use the "identity" keyword to trigger this, but
instead assignment of an empty string will trigger
loading of an identity LUT. Suggested by Derek Foreman.
Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Cc: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
cms-colord used the weston_compositor destroy signal to
trigger its final colord_module_destroy cleanup, and the
wl_output destroy signal to trigger per output cleanup.
The problem is that the compositor destroy signal gets
emitted before the output destroy signals at compositor
shutdown, colord_module_destroy would free all its
shared data structures and then later on the output
destroy callback would try to access those shared
data structures when handling output destruction
-> Use after free -> Crash, usually with VT switching
dead and thereby an unuseable system requiring a reboot.
Solve this by moving the output destruction handling into
the colord_cms_output_destroy() cleanup function for
colord-cms own hash dictionary of all active outputs.
The output destroy callback just removes the corresponding
output from the dictionary and triggers proper cleanup if
an output is unplugged during runtime. During compositor
shutdown, the dictionary as a whole is released before
releasing all other shared data structures, thereby
triggering cleanup of all remaining outputs.
Tested to fix crashes on x11 and drm backends.
v2: Formatting: Wrap lines to < 80 characters, as suggested
by Derek. Thanks.
Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
We were loading modules out of the system dirs unconditionally, so
tests that loaded modules would use the system ones, or fail if
they weren't installed.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-By: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Break device_removed() out into its own function like device_added().
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Addresses this warning found by Denis Denisov:
[src/logind-util.c:702]: (warning) %d in format string (no. 1)
requires 'int' but the argument type is 'unsigned int'.
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
Going from seat to input device requires that we test the device
before relying on the pointer. In all of these binding functions
we can trust exactly one input device type directly. If we pass
that in instead of a seat it's more obvious that we can trust
the one pointer we have.
When a seat is required, we can access through the device we have
and use that to get to other device types for the seat, provided
we validate them appropriately.
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
It doesn't need the seat pointer, and the caller should already have
tested that the keyboard pointer is valid.
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Normally we need to check if a seat's [device_type]_count is > 0 before
we can use the associated pointer. However, in a binding you're
guaranteed that the seat has a device of that type. If we pass in
that type instead of the seat, it's obvious we don't have to test it.
The bindings can still get the seat pointer via whatever->seat if they
need it.
This is preparation for a follow up patch that prevents direct access
to seat->device_type pointers, and this will save us a few tests at
that point.
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
These functions should never be called outside of the core.
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Cut a chunk of code out from drm_output_set_cursor() and form a new
function for writing a cursor bo data from a weston_view with a wl_shm
buffer.
Add more asserts to verify the assumptions in there.
v2: Use drm_compositor::cursor_{width,height} instead of hard-coded 64.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Instead of testing against a hardcoded 64x64 pixel size to see if a view
is suitable for promotion to a cursor plane, use our cursor_width and
cursor_height variables.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>