Commit Graph

66 Commits

Author SHA1 Message Date
Pekka Paalanen bcbce33000 libweston: notify_touch API to use weston_touch_device
Relay touch input events into libweston core through the
weston_touch_device, so that the core can tell which individual physical
device they come from.

This is necessary for supporting touchscreen calibration, where one
needs to process a single physical device at a time instead of the
aggregate of all touch devices on the weston_seat.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
v1 Tested-by: Matt Hoosier <matt.hoosier@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-05-30 14:45:58 +03:00
Louis-Francis Ratté-Boulianne 6ef59c9843 input: introduce weston_touch_device
Introduce weston_touch_device for libweston core to track individual
touchscreen input devices. A weston_seat/weston_touch may be an
aggregation of several physical touchscreen input devices. Separating
the physical devices will be required for implementing touchscreen
calibration. One can only calibrate one device at a time, and we want to
make sure to handle the right one.

Both backends that support touch devices are updated to create
weston_touch_devices. Wayland-backend provides touch devices that cannot
be calibrated, because we have no access to raw touch coordinates from
the device - calibration is the responsibility of the parent display
server. Libinput backend provides touch devices that can be calibrated,
hence implementing the set and get calibration hooks.

Backends need to maintain an output pointer in any case, so we have a
get_output() hook instead of having to maintain an identical field in
weston_touch_device. The same justification applies to
get_calibration_head_name.

Also update the test plugin to manage weston_touch_device objects.

Co-developed by Louis-Francis and Pekka.

v2:
- Consistently use 'cal' instead of 'calb' or 'matrix'.
- change devpath into syspath
- update copyrights

Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
v1 Tested-by: Matt Hoosier <matt.hoosier@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-05-30 14:42:13 +03:00
Pekka Paalanen 26ded94aa0 pixman: make shadow buffer optional
Add a flag to pixman-renderer for initializing the output with a shadow
framebuffer. All backends were getting the shadow implcitly, so all
backends are modified to ask for the shadow explicitly.

Using a shadow buffer is usually beneficial, because read-modify-write
cycles (blending) into a scanout-capable buffer may be very slow. The
scanout framebuffer may also have reduced color depth, making blending
and read-back produce inferior results.

In some use cases though the shadow buffer might be just an extra copy
hurting more than it helps. Whether it helps or hurts depends on the
platform and the workload. Therefore let the backends control whether
pixman-renderer uses a shadow buffer for an output or not.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.com>
Reviewed-by: Ian Ray <ian.ray@ge.com>
2018-05-24 17:20:04 +03:00
Pekka Paalanen c80e954123 compositor-wayland: migrate to head-based output API
Follow the standard pattern used in the headless and x11 backend
migration, but also cater for the two other backend modes: --sprawl or
fullscreen-shell, and --fullscreen.

Stops relying on the implicit weston_output::head.

Unlike other backends, this uses the attach_head hook to do the
required head setup that is not possible to do without an output, but
must be done before weston_output_enable(). This also requires the
detach_head hook for the one case where the user attaches a --fullscreen
head and then detaches it without enabling the output.

It is a little awkward to fully initialize heads as late as attach, but
aside from the --sprawl/fullscreen-shell case, there is not really a way
to know the head properties without creating the parent wl_surface and
configuring it.

Heads/outputs created for parent outputs now have distinct names instead
of all being called "wlparent".

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
2018-04-17 15:19:57 +03:00
Pekka Paalanen 39069fa27c compositor-wayland: strict surface create/destroy
Add safeguards to make it painfully obvious if we ever get the pairing
of wayland_backend_create_output_surface() and
wayland_backend_destroy_output_surface() wrong. Helps catching bugs.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
2018-04-17 15:19:57 +03:00
Pekka Paalanen 01f60211b2 libweston: introduce weston_head
In order to support clone modes, libweston needs the concept of a head
that is separate from weston_output. While weston_output manages buffers
and the repaint state machine, weston_head will represent a single
monitor. In the future it will be possible to have a single
weston_output drive one or more weston_heads for a clone mode that
shares the framebuffers between all cloned heads.

All the fields that are obviously properties of the monitor are moved
from weston_output into weston_head.

As moving the fields requires one to touch all the backends for all the
assingments, introduce setter functions for them while we are here. The
setters are identical to the old assignments, for now.

As a temporary measure, weston_output embeds a single head. Also the
ugly casts in weston_head_set_monitor_strings() will be removed by a
follow-up patch.

Libweston major version is bumped, because weston_output struct layout
is changed.

v7:
- Bump libweston major version.

v6:
- adapt to upstream changes in weston_output_set_transform()

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
v5 Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
v6 Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
2018-04-10 14:31:05 +03:00
Dima Ryazanov 6b2fb180d9 Fix an uninitialized variable
"has_discrete" gets set to true in if/else if, but gets left unset otherwise.
So let's initialize it to false.

(This was caught by valgrind.)

Signed-off-by: Dima Ryazanov <dima@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-03-19 12:14:08 +02:00
Daniel Stone 3f83937414 compositor-wayland: Ignore pointer enter on destroyed surface
Due to race conditions, it is (vanishingly unlikely but) possible to
receive a wl_pointer.enter event referring to a wl_surface we have just
destroyed. If this happens, wl_surface will be NULL. Detect this, clear
out our focus, and return.

Other pointer and keyboard events are robust against destroyed surfaces.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Cc: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
[Pekka: remove call to input_set_cursor()]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-03-09 16:17:47 +02:00
Pekka Paalanen 8d6e14c991 compositor-wayland: handle wl_keyboard.enter(NULL)
Destroying an output (wl_surface) can race against the parent compositor
sending wl_keyboard.enter. When this race is lost, wayland-backend
receives wl_keyboard.enter with a NULL wl_surface for the surface it
just destroyed.

Handle this case by ignoring such enter events. Since it is
theoretically possible to follow enter with key events, drop those too.

The modifiers event is sent before enter, so we cannot drop that on the
same condition.

wl_keyboard.leave handler seems to already handle the NULL focus case,
but there is a question if the notify_keyboard_focus_out() call should
be avoided.

This patch fixes a hard to reproduce crash. I was running weston/x11
with two outputs, and weston/wayland --sprawl inside that, then closing
the parent compositor windows one by one. Sometimes it would trigger
this crash.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-03-09 10:01:40 +00:00
Pekka Paalanen f461414501 libweston: remove restore functionality
This was used from the crash handlers, which do not exist anymore.
Nothing calls restore, so delete the dead code.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-02-09 15:16:07 +00:00
Emmanuel Gil Peyrot 6b58ea8c43 xwm: Add icon support to the frame
This fetches the _NET_WM_ICON property of the X11 window, and use the
first image found as the frame icon.

This has been tested with various X11 programs, and improves usability
and user-friendliness a bit.

Changes since v1:
- Changed frame_button_create() to use
  frame_button_create_from_surface() internally.
- Removed a check that should never have been commited.

Changes since v2:
- Request UINT32_MAX items instead of 2048, to avoid cutting valid
  icons.
- Strengthen checks against malformed input.
- Handle XCB_PROPERTY_DELETE to remove the icon.
- Schedule a repaint if the icon changed.

Changes since v3:
- Keep the previous Cairo surface until the new one has been
  successfully loaded.
- Use uint32_t for cardinals.  Unsigned is the same type except on
  16-bit machines, but uint32_t is clearer.
- Declare length as uint32_t too, like in xcb_get_property_reply_t.

Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2018-01-18 12:24:19 +00:00
Alexandros Frantzis 9448deb073 libweston: Use struct timespec for touch down events
Change code related to touch down events to use struct timespec to
represent time.

This commit is part of a larger effort to transition the Weston codebase
to struct timespec.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-11-27 11:42:07 +02:00
Alexandros Frantzis 47e79c860b libweston: Use struct timespec for key events
Change code related to key events to use struct timespec to represent
time.

This commit is part of a larger effort to transition the Weston codebase
to struct timespec.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-11-27 11:42:07 +02:00
Alexandros Frantzis 80321942e7 libweston: Use struct timespec for axis events
Change code related to axis events to use struct timespec to represent
time.

This commit is part of a larger effort to transition the Weston codebase
to struct timespec.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-11-27 11:42:07 +02:00
Alexandros Frantzis 215bedc88b libweston: Use struct timespec for button events
Change code related to button events to use struct timespec to represent
time.

This commit is part of a larger effort to transition the Weston codebase
to struct timespec.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-11-27 11:42:07 +02:00
Alexandros Frantzis 84b31f8956 libweston: Use struct timespec for motion events
Change code related to motion events to use struct timespec to represent
time.

This commit is part of a larger effort to transition the Weston codebase
to struct timespec.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-11-27 11:42:07 +02:00
Pekka Paalanen 323d4b37a0 compositor-wayland: fix shm_buffer damage init
It appears that wayland_shm_buffer::damage is in the global coordinate
space. Therefore initializing it to width x height at 0,0 is not correct
for any output not positioned at 0,0. That is, all outputs after the
first one get it wrong.

Initialize it from the output region, which is in the global coordinate
space.

While at it, add a comment to note that damage is in global coordinate
space. As I can see, this was the last confusion about it.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Acked-by: Daniel Stone <daniels@collabora.com>
2017-10-24 12:51:35 +03:00
Armin Krezović 2b3c97d560 compositor-wayland: fix damage coordinates with pixman renderer
Damage coordinates are in global coordinate space, and they need to
be translated to local coordinate space so multiple outputs can work.

This path now matches the similar path in the X11 backend.

This patch fixes the appearance of multiple windows in the parent
compositor. Previously, all windows except the one with nested output
position 0,0 would have their damage for the parent wl_surface always
fall outside of the wl_surface, save the decorations which were handled
separately. If the parent compositor was Weston/GL, this would lead to
the output area remaining black as partial GL texture uploads would
practically never update the texture. If the parent compositor was
Weston/pixman, the parent windows would not update on screen unless
something else caused the area to be repainted.

[Pekka: adjusted commit message]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Acked-by: Daniel Stone <daniels@collabora.com>
2017-10-24 12:51:35 +03:00
Pekka Paalanen 99c92e7e52 compositor-wayland: clarify wl_display_connect() error
Clarify the error message to explicitly say one was trying to connect to
a parent Wayland compositor. This hopefully is a good enough hint on
what using the wayland-backend is trying to do.

Add the command line display option value and WAYLAND_DISPLAY values for
good measure. WAYLAND_SOCKET is not shown as libwayland-client removes
it.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Acked-by: Daniel Stone <daniels@collabora.com>
2017-10-24 12:51:35 +03:00
Pekka Paalanen 441954325e compositor-wayland: windowed/fullscreen not on fullscreen-shell
The set_windowed and set_fullscreen functions are only useful on a
desktop shell, and never called on fullscreen-shell.

Remove the confusing dead code, and ensure we notice if these functions
get called in the wrong environment.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Acked-by: Daniel Stone <daniels@collabora.com>
2017-10-24 12:51:35 +03:00
Pekka Paalanen 7d2fc9291b compositor-wayland: allow to unset fullscreen
To be more symmetric with wayland_output_set_fullscreen(), implement the
xdg-shell path in wayland_output_set_windowed(). This should make it
possible to use the fullscreen key binding to toggle between a floating
window and fullscreen also under xdg-shell.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Acked-by: Daniel Stone <daniels@collabora.com>
2017-10-24 12:51:35 +03:00
Pekka Paalanen f132279455 compositor-wayland: actually free parent_output
I could not find anywhere where struct parent_output was freed, so
apparently we were leaking it.

Check against wayland_backend_register_output() and add the missing
clean-up: removal from the parent output list, and free().

registry_handle_global_remove() also needs fixing to use a safer loop,
because now we are actually removing the list item.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Acked-by: Daniel Stone <daniels@collabora.com>
2017-10-24 12:50:17 +03:00
Pekka Paalanen 4dab58343b compositor-wayland: fix mode_list corruption on --sprawl
The wayland-backend with --sprawl is one way to trigger
wayland_output_create_for_parent_output(), which intends to find a mode
from the parent mode list and use it. Calling wayland_output_set_size()
initialized an embedded struct weston_mode and inserts that into the
mode list. Then the assignment output->mode = *mode; corrupts the
mode_list by overwriting the link entry. This leads to an endless loop
in bind_output() in compositor.c.

Fix this by manually doing the setup that wayland_output_set_size() did
and do not call it.

As a side effect, it now relays the parent compositor's physical output
size to our own clients. It no longer smashes the refresh rate either.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Acked-by: Daniel Stone <daniels@collabora.com>
2017-10-23 10:29:42 +03:00
Pekka Paalanen afee695adc compositor-wayland: remove unused 'scale'
This member is only ever set and never read, therefore it is dead.

Delete dead code.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Acked-by: Daniel Stone <daniels@collabora.com>
2017-10-23 10:29:42 +03:00
Pekka Paalanen b07de934cc compositor-wayland: avoid recursive dispatch with wl_outputs
Calling wl_display_roundtrip() from within a Wayland event handler means
we will re-enter event dispatch, that is, it will lead to recursive
dispatch. Even if libwayland-client was safe, this would lead to
unexpected code paths: the first event handler function has not returned
when other event handler functions may get called. In this particular
case it maybe didn't hurt, but it's still a fragile pattern to use.

Replace the wl_display_roundtrip() with a manual sync callback to do the
work.

This does not break the wayland-backend initialization sequence, because
sprawl_across_outputs was set only after the roundtrip to ensure
wl_registry globals have been received so the code would not have been
hit anyway, and weston_backend_init() also has a second roundtrip that
ensures the per wl_output events have been received before continuing.

For wayland-backend output hotplug the change is insignificant because
it will only delay the output creation a bit, and the parent outputs are
not processed anywhere in between.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Acked-by: Daniel Stone <daniels@collabora.com>
2017-10-23 10:29:42 +03:00
Armin Krezović 71ebc05250 compositor-wayland: Don't use two different presentation methods for fs shell
This patch fixes the wayland backend to not use two different
presentation methods when running on fullscreen-shell.

See also: https://patchwork.freedesktop.org/patch/114534/

v2:

 - Add missing wayland_output_resize_surface() call
 - Start repaint loop after initial frame has been drawn

v3:

 - Redraw the initial frame if present for mode fails

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93514
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Tested-by: nerdopolis <bluescreen_avenger@verizon.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-10-13 15:22:54 +03:00
Sergi Granell b4e239f29f compositor-wayland: destroy the appropriate output instead of exiting when receiving an xdg_toplevel::close event
v2: Fix use after free spotted by Daniel Stone

Signed-off-by: Sergi Granell <xerpi.g.12@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-10-13 14:12:38 +03:00
Sergi Granell cafc652cf6 compositor-wayland: use input region instead of opaque region to zxdg_shell_v6::set_window_geometry
The opaque region is a few pixels off due to the rounded corners
of the frame decorations, and, therefore, the input region
matches the window's geometry more closely.

Signed-off-by: Sergi Granell <xerpi.g.12@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-10-13 13:56:48 +03:00
Pekka Paalanen 7da9a3802f libweston: set backend pointer earlier
Change all backends to set the core backend pointer early.

This is necessary for libweston core to be able to access the backend
vfuncs before the backend init function returns. Particularly,
weston_output_init() will be needing to inspect the backend vfuncs to
see if the backend has been converted to a new API. Backends that create
outputs as part of their init would fail without setting the pointer
earlier.

For consistency, all backends are modified instead of just those that
could hit an issue.

Libweston core will take care of resetting the backend pointer to NULL
in case of error since "libweston: ensure backend is not loaded twice".

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Acked-by Daniel Stone <daniels@collabora.com>
2017-10-04 16:18:06 +03:00
Pekka Paalanen ae6d35db14 libweston: rename weston_output_destroy() to weston_output_release()
'release' is a more appropriate name because the function does not free
the underlying memory. The main reason for this is that we need the name
weston_output_destroy() for new API that actually will free also the
underlying memory.

Since the function is only used in backends and external backends are
not a thing, this does not cause libweston major version bump, even
though it does change the ABI. There is no way external users could have
successfully used this function.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Acked-by Daniel Stone <daniels@collabora.com>
2017-10-04 16:18:06 +03:00
Pekka Paalanen 1580be68fd compositor-wayland: move output init into common, fix error path
Move the weston_output_init() call into wayland_output_create_common().
This avoids passing the name twice to different functions, and follows
the precedent set in "libweston: weston_output_init(..., +name)" for
calling init before accessing fields.

Since the error paths in wayland_output_create_for_parent_output() and
wayland_output_create_fullscreen() are now guaranteed to have
weston_output init'd, call weston_output_destroy() appropriately. There
might be more to free than just the name.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Acked-by Daniel Stone <daniels@collabora.com>
2017-10-04 16:18:06 +03:00
Pekka Paalanen 26ac2e1218 libweston: weston_output_init(..., +name)
Add 'name' argument to weston_output_init(). This is much more obvious
than the assert inside weston_output_init() to ensure the caller has set
a field in weston_output first.

Now weston_output_init() will strdup() the name itself, which means we
can drop a whole bunch of strdup()s in the backends. This matches
weston_output_destroy() which was already calling free() on the name.

All backends are slightly reordered to call weston_output_init() before
accessing any fields of weston_output, except the Wayland backend which
would make it a little awkward to do it in this patch. Mind, that
weston_output_init() still does not reset the struct to zero - it is
presumed the caller has done it, since weston_output is embedded in the
backend output structs.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: David Fort <contact@hardening-consulting.com>
[Daniel: document name copying]
Acked-by Daniel Stone <daniels@collabora.com>
2017-10-04 16:17:41 +03:00
Pekka Paalanen 4270414549 libweston: move weston_output::mode_list init to core
Initialize the list in weston_output_init() instead of doing it
separately in each backend.

One would expect weston_output_init() to initialize all weston_output
members, at least those that are not NULL.

We rely on the set_size() functions to be called only once, as is
assert()'d. If set_size() becomes callable multiple times, this patch
will force them to be fixed to properly manage the mode list instead of
losing all members.

compositor-wayland.c is strange in
wayland_output_create_for_parent_output(): it first called
wayland_output_set_size() that initialized the mode list with a single
mode manufactured from width and height and set that mode as current.
Then it continued to reset the mode list and adding the list of modes
from the parent output, leaving the current mode left to point to a mode
struct that is no longer in the mode list and with a broken 'link'
element. This patch changes things such that the manufactured mode is
left in the list, and the parent mode list is added. This is probably
not quite right either.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Acked-by Daniel Stone <daniels@collabora.com>
2017-10-04 14:55:58 +03:00
Pekka Paalanen ffa42ffdaa compositor-wayland: use asprintf for output title
Simplifies the code, and makes moving weston_output_init() into
wayland_output_create_common() a little easier.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
2017-09-25 12:07:09 +03:00
Derek Foreman dbfd248da4 libweston: Allow compositor-wayland to use wl_surface_damage_buffer
wl_surface_damage_buffer landed ages ago, but in order for GL to
use it the client must bind a wl_compositor version >= 4 (the
version where damage_buffer was introduced).

This patch updates the bind version and allows
eglSwapBuffersWithDamage to actually use the provided damage
rectangles instead of performing full surface damage.

Reviewed-by: Daniel Stone <daniels@collabora.com>
2017-05-19 16:44:03 -05:00
Raúl Peñacoba fec723ef56
compositor-wayland: Properly dealloc mmap data using munmap
Signed-off-by: Raúl Peñacoba <raul.mikaop.zelda@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-03-31 01:38:30 +02:00
Sergi Granell eaa7358403
compositor-wayland: Call weston_compositor_exit when receiving an xdg toplevel close event
Signed-off-by: Sergi Granell <xerpi.g.12@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-03-25 17:29:09 +01:00
Sergi Granell ed016bff23
compositor-wayland: Call set_window_geometry when using zxdg_shell_v6
This way Wayland compositors will be aware of Weston's
"visible bounds" (and ignore its shadows).

Signed-off-by: Sergi Granell <xerpi.g.12@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-03-25 00:26:06 +01:00
Sergi Granell 7fecb43735
compositor-wayland: Check the return value of wayland_output_create_common
If wayland_output_create_common returns NULL, it means that
the output creation failed.

Signed-off-by: Sergi Granell <xerpi.g.12@gmail.com>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-03-24 20:55:37 +01:00
Sergi Granell 2dcbb8d20d
compositor-wayland: Refactor struct wayland_output::name usage
struct wayland_output::name was used but never initialized.
Also zxdg_toplevel_v6_set_title was only called for windowed outputs,
and some compositors let you see the client's name even when it is
fullscreen (GNOME Shell's Activities menu for example).

So rename struct wayland_output::name to struct wayland_output::title and
precompute it on wayland_output_create_common(), so it can be later used
on xdg's set_title and frame_create.

v2: Move zxdg_toplevel_v6_set_title() before the wl_surface_commit()
as per Quentin Glidic's suggestion.

Signed-off-by: Sergi Granell <xerpi.g.12@gmail.com>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-03-24 20:54:00 +01:00
Daniel Stone b1f166d71e Allow backends to group repaint flushes
Implement new repaint_begin and repaint_flush hooks inside
weston_backend, allowing backends to gang together repaints which
trigger at the same time.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-03-14 12:01:50 +02:00
Quentin Glidic 23e1d6f176
libweston: Properly namespace backends entrypoint
This prevents loading a backend as a simple module. This will avoid
messing up with backends when we will introduce libweston common
modules.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2017-01-17 18:24:49 +01:00
Armin Krezović b08e1a5c12 compositor-wayland: Support building without EGL
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2017-01-17 12:54:03 +00:00
Daniel Stone 698f9bf854 compositor-wayland: Destroy cursor images earlier
Destroying a wl_cursor will attempt to access the wl_display, which
we have just freed. Avoid a segfault by destroying the cursor images
before we destroy the display.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Dima Ryazanov <dima@gmail.com>
2016-11-29 09:49:29 +00:00
Daniel Stone 21fac60838 compositor-wayland: Set frame callback for Pixman
Fixing 89c2f637b9, also set the output's frame_cb for the Pixman
renderer, not just GL. Fixes a segfault when using compositor-wayland
with --use-pixman.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Dima Ryazanov <dima@gmail.com>
2016-11-28 22:00:46 +00:00
Dima Ryazanov 89c2f637b9 compositor-wayland: Fix a use after free
When a window is being closed, the frame_done callback often runs after
the output is already destroyed, i.e:

  wayland_output_start_repaint_loop
  input_handle_button
    wayland_output_destroy
  frame_done

To fix this, destroy the callback before destroying the output.

(Also, fix the type of output in frame_done: it's passed in
a wayland_output, not a weston_output.)

Signed-off-by: Dima Ryazanov <dima@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-28 11:29:30 +00:00
Armin Krezović 3447619a3a compositor-wayland: Port to xdg-shell-v6
v2:

 - Keep wl_shell code around until xdg_shell is declared stable.

Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-21 18:00:19 +00:00
Armin Krezović 2e66252582 compositor-wayland: Destroy shm buffers on output disable
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
2016-11-21 16:44:49 +00:00
Armin Krezović 78895c5fd8 compositor-wayland: Properly clean up on backend destroy
Also remove a wrong XXX comment.

Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
2016-11-21 16:44:46 +00:00
Armin Krezović f054d35aad compositor-wayland: Simplify fullscreen output surface handling
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
2016-11-21 16:44:42 +00:00