Commit graph

8792 commits

Author SHA1 Message Date
Michael Olbrich 141943eb76 ivi-shell: handle subsurfaces for mouse/touch activation
The surface of the focus_view may be a subsurface. So get the corresponding main
surface first.

Without this get_ivi_shell_surface(), will cast committed_private (which is a
weston_subsurface object) to ivi_shell_surface. Weston crashes shortly
afterwards.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-03-14 13:29:30 +02:00
Michael Olbrich 638dee44ec libweston: mitigate race when destroying outputs
With some displays connect, disconnect, connect events can happen is a very
short amount of time. When this happens, the output global may already be
destroyed when a client tries to bind it. As a result, the client is
disconnected with a protocol error. See [1] for more details on the general
problem.

To mitigate this problem call wl_global_remove() first and call
wl_global_destroy() several seconds later. This is inspired by the
implementation for the same problem in wlroots.

[1] https://gitlab.freedesktop.org/wayland/wayland/-/issues/10

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-03-14 13:24:32 +02:00
Michael Olbrich 3c6866088d hmi-controller: add input panel support
Implement listeners for the new input panel API of the IVI shell.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-03-14 10:40:04 +01:00
Michael Olbrich 5d68a6c4b5 ivi-shell: add input panel support
Input panels are used for complex text composition for CJK alphabets and for
onscreen keyboards. Support for this is already implemented in libweston and
the desktop shell.

This adds extends the IVI shell to add support for input panels as well. The
low-level parts are implemented in the IVI shell. The positioning of the input
panels is delegated to the controller.
Support for input panels and the relevant protocols is only enabled if the
controller attaches a listener to the new signals.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-03-14 10:40:04 +01:00
Michael Olbrich ad2c014ef3 ivi-layout: add surface type to the surface properties
This makes it possible for the controller to distinguish different surface
types. For IVI and desktop surfaces, this is not all that useful, but it will be
needed for a new surface type: input panels.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-03-14 10:40:04 +01:00
Michael Olbrich 1c02bdfb8e ivi-shell: abort if shell_surface_send_configure is called for non-ivi surfaces
shell_surface_send_configure() should only be called for ivi surfaces. Other (or
no) *configure() calls are needed for other types of surfaces.

Make sure that get_ivi_shell_surface() returns NULL if the surface is not an ivi
surface. And don't ignore wrong surfaces but assert instead to make it obvious
that new surface types need special handling in ivi_layout_surface_set_size().

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-03-14 10:40:04 +01:00
Sergio Gómez b6423e59d9 libweston: Add assert for valid confine region in maybe_warp_confined_pointer()
Signed-off-by: Sergio Gómez <sergio.g.delreal@gmail.com>
2023-03-13 16:09:33 -05:00
Sergio Gómez e3079393c4 libweston: Add view unmap listener to pointer constraints
Since the logic of pointer constraints assumes a valid view throughout, add a
signal to disable constraints when its current view is unmapped by Weston.

The assumption that a previously unmapped view is valid already leads to the
constraints code crashing. This can happen when attaching a NULL buffer to the
surface and commiting, which effectively unmaps the view with the side effect of
clearing the surface's input region, which is then assumed valid inside
maybe_warp_confined_pointer().

Fixes: #721

Signed-off-by: Sergio Gómez <sergio.g.delreal@gmail.com>
2023-03-13 15:16:17 -05:00
Sergio Gómez 64da736d37 libweston/input: Remove redundant surface destroy listener in constraints
Currently, the surface destroy listener in pointer constraints is redundant,
since surface destruction already handles pointer constraints destruction (see
libweston/compositor.c:weston_surface_unref()).

Signed-off-by: Sergio Gómez <sergio.g.delreal@gmail.com>
2023-03-13 15:16:17 -05:00
Loïc Molinari ad141defcd weston-log-flight-rec: Map ring buffer using memset()
This makes flight recorder creation faster by using wider store
instructions (depending on the memset() implementation).

Signed-off-by: Loïc Molinari <loic.molinari@gmail.com>
2023-03-10 11:35:04 +01:00
Derek Foreman ff00ae4218 compositor: Rename position.set to position.changed
This is a flag used to track whether the position has changed, not
whether the position is set.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-03-07 14:45:48 -06:00
Marius Vlad 640a3c7165 xcb-client-helper: Add a XCB client helper for tests
This patch introduces a small library wrapper around XCB to be used in
Xwayland tests.

It's being designed such that we do not advance without accounting for
all X11 events when changing the window state.  It adds a fence that
waits for all events to be processed, and only after all the events have
been accounted for, to proceed further, resuming execution of the
tests.

This works by keeping a tentative_state list for the client and a
window state that gets applied when the event we waited for has been
received.

This is useful in test clients, which could verify at the end after
receiving all events that the correct state has been applied. Acts as a
way to verify that the we never get or have a different state than the
one we expect.

With it, this converts test-xwayland to using libxcb (together with
xcb-cursor-dev) rather than using Xlib, and with it it removes any Xlib
dependency we might have in the tests.

This only adds support for map/unmap/create/destroy/property notify.
A follow-up would be to expand this library to track window movement
and resizing.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-03-03 08:30:46 +00:00
Derek Foreman 87881e2cf6 xwm: Add support for xwayland_shell_v1
Use the new protocol to prevent races in surface to window association.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-03-03 08:21:24 +00:00
Derek Foreman 8e1d7fe4da xwm: Init window link after removing it
In future code the window link will end up in a state where it may or may
not be on the unpaired_window_list and we'll want to go from that state
to one where it's definitely not on the list.

Initting the list after removal (in these two places) allows us to
unconditionally remove it later.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-03-03 08:20:34 +00:00
Michael Tretter 3c6cfe6bf4 backend-drm: add additional-devices to support multi GPU
Add the --additional-devices parameter to Weston to add secondary drm devices
that will only be used as outputs, but not for rendering.

We can only fail the repaint for the entire backend, but not for single
devices. Thus, if one of the devices fail, we have to fail the repaint for the
entire backend.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2023-03-03 08:08:46 +00:00
Michael Tretter 3f9f4277c3 backend-drm: import cursors on non gbm outputs
Additional devices don't have a gbm device. Therefore, we cannot create gbm bos
for the cursor.

If the output device differs from the gbm device, fall back to the allocation of
a dumb buffer for the cursor on the output device. Update the cursor sprite with
a memcpy to the already mapped dumb buffer that belongs to the current cursor.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2023-03-03 08:08:46 +00:00
Michael Tretter 7887d3fb48 backend-drm: import GBM bo to scanout device if necessary
If the GBM bo was allocated on a different device than the device that is used
for the fb, we have to import the fd first and update the handle.

Use drmPrimeFDToHandle directly instead of using a gbm device for the scanout
device, since a gbm device would require a gbm implementation, which is often
not available for devices that only support scanout.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2023-03-03 08:08:46 +00:00
Michael Tretter 575804c7e1 backend-drm: use linear buffers if gbm and kms device differ
If we are using multiple GPUs and are not able to use modifiers to ensure that
the formats are compatible, we have to use linear buffers for the transfer.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2023-03-03 08:08:46 +00:00
Michael Tretter 48b39d31ef shared: extract hash table implementation from xwayland
The hash table implementation is useful for other modules as well. Move it from
xwayland to the shared code.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2023-03-03 08:08:46 +00:00
Michael Tretter f05029127c backend-drm: allow to create multiple drm_fb for a weston_view
Weston uses a cached drm_fb when a view is shown multiple times. If the view is
shown on multiple outputs backed by different DRM devices, Weston returns the
cached drm_fb for the first device that was used for the import. This causes a
failure when adding the fb to the other device.

Use a list of all drm_fbs to cache the buf_fb per device, and check for the
device before reusing a drm_fb.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2023-03-03 08:08:46 +00:00
Michael Tretter a8fb329335 backend-drm: create faked zpos for device instead of backend
The faked z position must be created for each device. Therefore, the device
itself must be passed to the function. If only the backend is passed, the faked
z position would be only created for the primary device.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2023-03-03 08:08:46 +00:00
Philipp Zabel 07734a2564 pixman-renderer: hold a reference for renderbuffers on the output state list
Now that struct weston_renderbuffer is refcounted, hold a reference for
renderbuffers on the pixman_output_state::renderbuffer_list. This allows
backends to destroy the renderer output state and release renderbuffer
references in any order without running into an assert().

To avoid breaking resizing, We also have to drop the renderbuffer list
during pixman_renderer_resize_output(). The backends have to create new
renderbuffers afterwards.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-03-03 07:36:32 +00:00
Alexandros Frantzis 2acd2c7489 xwayland: Handle shell hint for client to choose dimensions
A config event with width == 0 or height == 0 from the shell is a hint
to the client to choose its own dimensions. Since X11 clients don't
support such hints we make a best guess by trying to use the last saved
dimensions or, as a fallback, the current dimensions.

This hint is mainly used by libweston/desktop shells when transitioning
to a normal state from maximized, fullscreen or after a resize [1].
Without support for this hint the aforementioned transition causes
xwayland surfaces to be configured to a 1x1 size.

To be able to use the last saved dimensions with xwayland surface, the
shell needs to first set the maximized/fullscreen state and only then
set the new size, which is currently the case for desktop-shell.
Otherwise, if the new size is set first, then the last saved dimensions
will be set to the fullscreen/maximized values and won't be useful when
restoring to a normal window size.

[1] Recently we've introduced ba82af938a
"desktop-shell: do not forget to reset pending config size after
resizes". As we were not handling the 0x0 size hint, resizing X
applications started to fail. This patch fixes that.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Co-authored-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2023-02-28 19:13:22 +02:00
Philipp Zabel 12a7e4e163 backend-vnc: rename vnc_convert_damage to vnc_region_global_to_output
Align the function name and arguments of vnc_convert_damage() with
weston_region_global_to_output(). It does not support rotation and
stores the result in a pixman_region16_t, but otherwise it serves the
same purpose.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-02-28 08:45:48 +02:00
Michael Olbrich 00f08ec79c compositor/text-backend: use xzalloc everywhere
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-02-27 16:01:18 +01:00
Derek Foreman aef2da675b libweston: Convert weston_output_move to weston_coord
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-24 18:44:19 +00:00
Derek Foreman 48c93e84e6 desktop-shell: Use weston_coord for saved position
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-24 18:44:19 +00:00
Derek Foreman 59a0bd99bd libweston: Use weston_coord in surface committed handler
I also snuck in a trivial change to drag_surface_configure at the same
time to avoid yet another micro patch.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-24 18:44:19 +00:00
Derek Foreman 5e353d523f libweston: Use weston_coord in struct weston_view
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-24 18:44:19 +00:00
Derek Foreman 989cdcb86e libweston: Convert struct weston_subsurface to weston_coord
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-24 18:44:19 +00:00
Derek Foreman 4a2e7c9f1f backend-x11: use weston_coord to store previous pointer position
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-24 18:44:19 +00:00
Derek Foreman 716a1714f3 data-device: Make struct weston_drag use weston_coord
Somewhat lazy approach, as this will all collapse shortly.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-24 18:44:19 +00:00
Philipp Zabel d245bbdd13 backend-vnc: fix initial repaint
weston_renderer::repaint_output must be called from the weston_output::repaint
callback. When called from the weston_output::enable callback, a black frame
is produced. Instead of painting an invalid buffer and then working around it
by setting output damage, just don't skip the first real repaint even though
no VNC client is connected yet.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-02-24 13:52:40 +00:00
Philipp Zabel b399d48dd4 backend-vnc: add debug scope to log damage regions
Add a debug scope "vnc-backend" and use it to log per-renderbuffer
accumulated damage and new repaint damage before repainting.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-02-24 13:52:40 +00:00
Philipp Zabel d18954ba10 backend-vnc: stop using pixman shadow buffer
Since neatvnc frame buffers are in system memory, using a shadow
buffer just causes an unnecessary copy in the pixman renderer.
Stop using the shadow buffer.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-02-24 13:52:40 +00:00
Philipp Zabel e5445d836b backend-vnc: track damage on renderbuffers
Replace the custom damage tracking with tracking damage on the
renderbuffers.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-02-24 13:52:40 +00:00
Philipp Zabel ca8e0c9d16 backend-vnc: stop over-damaging nvnc_display
It is enough to report new repaint damage instead of accumulated
per-renderbuffer damage to nvnc_display_feed_buffer().

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-02-24 13:52:40 +00:00
Philipp Zabel fc8ce13747 backend-vnc: track damage on output while not repainting
While not repainting, all buffers are damaged exactly the same.
Avoid unnecessary work by tracking this damage separately on struct
vnc_output.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-02-24 13:52:40 +00:00
Vinh Nguyen Trong a1b7f1a5a2 desktop-shell: Fade animation should base on output power state
When compositor is active, we cannot make sure that the output power
state is normal, if the output power was forced off, there is nothing can
display on the output. Therefore, only do fade animations when the output
power state is normal

Signed-off-by: Vinh Nguyen Trong <Vinh.NguyenTrong@vn.bosch.com>
2023-02-23 11:44:30 +00:00
Rajendraprasad K J 342243e8b9 libweston: Add support to force an output power state to off
In IVI, there are several displays connected to a SoC. These displays
are just driven by differential pairs (LVDS, FPD-Link, GMSL) and powered
centrally. To reduce power comsumption when user inactivity timeout
happended on the display, there is a need to cut down pixel clock from
SoC. Then, if any input events happend on the display, it should become
active again.

Currently, controlling the compositor outputs doesn't happen independently
but rather globally, and outputs repaints are based on the compositor state

This is necessary to have an API that can force the power state of an
output to off via DPMS mode while all other compositor outputs remain
unaffected.

Signed-off-by: Rajendraprasad K J <KarammelJayakumar.Rajendraprasad@in.bosch.com>
Signed-off-by: Vinh Nguyen Trong <Vinh.NguyenTrong@vn.bosch.com>
2023-02-23 11:44:30 +00:00
Marius Vlad 1ca62d0475 .gitlab-ci.yml: Increase kernel ring buffer
As dmesg.log file doesn't seem to hold the entire length of the
tests, increase it to 2MB.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-02-21 22:08:54 +02:00
Marius Vlad 4efb335462 gitlab-ci.yml: Bump meson to 1.0.0
It turns out we no longer have stdout/stderr in CI for the
tests. As 1.0.0 is the latest stable version for meson use that
to bring back our test messages.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-02-21 20:29:31 +02:00
Marius Vlad 7aac1acad8 cairo-util: Add missing HAVE_PANGO guard
For pango_cairo_font_map_set_default().

Fixes #720

Suggested-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-02-20 11:04:23 +00:00
Michael Olbrich 06365e602b desktop-shell: avoid crashes when a surface disappears during resize
The desktop_surface object is destroyed first so it can happen that the shsurf
still exists but desktop_surface is already NULL. So expand the check to make
sure the desktop_surface is still available in the resize callbacks.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-02-20 12:48:43 +02:00
Marius Vlad 6617deebec pipewire-plugin: Check virtual outputs/remoting instance
Similarly to remoting plug-in in commit "Check virtual outputs/remoting
instance" this avoids touching the pipewire instance, and with it, the
pipewire output.

Includes a note to point up what should be done about by
checking out https://gitlab.freedesktop.org/wayland/weston/-/issues/591.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-02-20 12:42:50 +02:00
Marius Vlad 278fe4d7d4 pipewire: Destroy the pipewire outputs at shutdown
Seems like we are missing destroying the pipewire outputs on the shutdown
path; this follow-ups with remoting plug-in as well.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-02-20 12:42:43 +02:00
Marius Vlad aa78da2465 pipewire: Fix memleak upon compositor shutdown
This happens when shutting the compositor, and follows-up with the
remoting plug-in.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-02-20 12:42:39 +02:00
Marius Vlad 5db6d19e6b pipewire: Follow-up with remoting pluging when releasing the head
Similarily to what the remoting plug-in does, explicitly call
weston_release_head() before removing the output list entry.

We do that to avoid lookup_pipewire_output() returning NULL and still
find out the pipewire_output.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-02-20 12:42:37 +02:00
Marius Vlad ca52c79c51 remoting-plugin: Check virtual outputs/remoting instance
With commit aab722bb, "backend-drm: prepare virtual output API for
heterogeneous outputs", we now call the virtual destroy function,
but when shutting the compositor we no longer have a remoting instance
available.

When searching out for a remoting output verify if the remoting instance is
still available before attempting to search for a remoting output.

Addresses the following crash at shutdown:

0x00007fd430a1d347 in lookup_remoted_output (output=0x557163d5dad0) at ../remoting/remoting-plugin.c:515
0x00007fd430a1d746 in remoting_output_destroy (output=0x557163d5dad0) at ../remoting/remoting-plugin.c:635
0x00007fd439e11ab9 in drm_virtual_output_destroy (base=0x557163d5dad0) at ../libweston/backend-drm/drm-virtual.c:265
0x00007fd43a8635d0 in weston_compositor_shutdown (ec=0x557163239530) at ../libweston/compositor.c:8271
0x00007fd439e029d4 in drm_destroy (backend=0x557163240ae0) at ../libweston/backend-drm/drm.c:2713
0x00007fd43a863e07 in weston_compositor_destroy (compositor=0x557163239530) at ../libweston/compositor.c:8626

Includes a note to point up what should be done about by
checking out https://gitlab.freedesktop.org/wayland/weston/-/issues/591.

Fixes aab722bb "backend-drm: prepare virtual output API for
heterogeneous outputs"

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-02-20 12:41:03 +02:00
Marius Vlad c3270e887b remoting-plugin: Release and detach the head
This re-orders the disable/destroy shutdown sequence such that
lookup_remoted_output(), in remoting_output_disable(), would find a
remoting output.

Otherwise, without this, lookup_remoted_output() wouldn't find a
remoting output available when shutting down the compositor, ultimately
leading to a crash.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-02-20 12:41:03 +02:00