Commit Graph

8726 Commits

Author SHA1 Message Date
Leandro Ribeiro f95c2986dd drm: allow to skip composition if pending capture is writeback
We have an optimization to skip composition if there's no damage on the
primary plane and we already have a renderer buffer active. But we don't
allow this optimization if there's a pending capture task for the
output. For the renderer-based sources, that is really necessary, but
for the writeback source we should allow this optimization.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2023-03-31 10:36:31 +00:00
Robert Mader 9337d42741 clients/simple-egl: Implement fractional-scale protocol support
Fractional scale is increasingly common in the Wayland ecosystem. Thus,
given simple-egl's role as egl example client, implement support for
the new protocol - even though Weston itself does not support it yet.

Together with buffer_scale and buffer_transform this ensures
simple-egl provides optimally sized and oriented buffers.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2023-03-31 10:08:36 +00:00
Robert Mader 1d2feda5aa gitlab-ci.yml: Bump wayland-protocols to 1.31
It contains the new fractional-scale protocol.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2023-03-31 10:08:36 +00:00
Marius Vlad 06b57e1dda tests/xwayland-test: Also print out Weston log messages
We don't accumulate log scopes with was previous set internally so
enable the "log" scope (explicitly) for the xwayland-test to see what
Weston prints out.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-03-31 09:06:24 +03:00
Jonas Ådahl 8f4b141299 desktop: Make popup grab follow keyboard focus semantics
A popup grab is specified to have the top most popup surface gain
keyboard focus. This means the keyboard focus should always follow the
most recent xdg_popup.grab() surface. Make sure this happens by keeping
track of the parent surface in the libweston-desktop popup grab,
updating the keyboard focus when surfaces are added and removed from the
popup chain, and restoring the keyboard focus to the toplevel when there
are no popups anymore.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2023-03-30 17:14:29 +00:00
Jonas Ådahl cc3d30c28b shell: Keep window 'activated' state if child has focus
Popups should have keyboard focus when active, but the toplevel window
should still appear "active". Make sure this is the case by changing the
"active" tracking to see whether any child surface has keyboard focus.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2023-03-30 17:14:29 +00:00
Daniel Stone 28b3529ca8 Revert "input: Consistently use enums for modifier/axis/state"
This reverts commit 9248340db0.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-03-30 18:00:05 +01:00
Andrew F. Davis 94afcbcdc3 backend-drm: Select plane based on current attached CRTC
When doing plane selection for an output CRTC check if the plane
already has a CRTC attached and if so prefer that plane only for
the corresponding CRTC.

This prevents changing a CRTC's primary plane when it is active
which is not allowed by the DRM framework.

Based-on-patch-by: Eric Ruei <e-ruei1@ti.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
2023-03-30 17:51:33 +01:00
Daniel Stone 9248340db0 input: Consistently use enums for modifier/axis/state
For some reason we'd managed to have a mismatching header prototype and
implementation. Fix this up to consistently use enums everywhere.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-03-30 17:49:17 +01:00
Veeresh Kadasani c0f3cb87be backend-drm: Pass view alpha to plane state and commit
We map view alpha(0.0-1.0) to plane state's alpha
by using the max plane alpha value got from drm.

Signed-off-by: Hsuan-Yu Lin <hlin@jp.adit-jv.com>
Signed-off-by: Veeresh Kadasani <external.vkadasani@jp.adit-jv.com>
Signed-off-by: Vinh Nguyen Trong <Vinh.NguyenTrong@vn.bosch.com>
2023-03-30 17:29:57 +01:00
Veeresh Kadasani f35eccc6fa backend-drm: Add plane alpha DRM-property
This checks whether plane alpha is supported.
We get range of alpha value supported for plane
which is required for mapping view's alpha(0.0-1.0)
with drm plane alpha. No functional change.

Signed-off-by: Hsuan-Yu Lin <hlin@jp.adit-jv.com>
Signed-off-by: Veeresh Kadasani <external.vkadasani@jp.adit-jv.com>
Signed-off-by: Vinh Nguyen Trong <Vinh.NguyenTrong@vn.bosch.com>
2023-03-30 17:29:07 +01:00
Marius Vlad 1e867c189f libweston: Skip views without a parent
This prevents to trigger an assert within
weston_view_set_rel_position(), introduced with commit 'libweston: Split
weston_view_set_position() into rel and abs variants', which is hit when
a subsurface attempts to commit without having a parent surface set.

Fixes: #730

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Reported-by: Colin Kinloch <collin.kinloch@collabora.com>
2023-03-30 14:59:52 +00:00
Sergio Gómez 1ed88f60c0 libweston/input: Fix assert for valid confine region
We need only check that the region is not empty. If either the input region or
the constraint region have degenerate extents, the intersection from the
previous instruction will set confine_region->data to pixman_region_empty_data.

Fixes: b6423e59

Signed-off-by: Sergio Gómez <sergio.g.delreal@gmail.com>
2023-03-29 08:31:00 -05:00
Leandro Ribeiro 190770e31c clients/simple-dmabuf-feedback: drop outdated comment
There's a comment explaining how to hack the DRM-backend in order to
fake that a certain format is not supported by the KMS device. This is
useful in order to test dma-buf feedback implementations using the
simple-dmabuf-feedback client. But with recent changes on the
DRM-backend, this got outdated.

Drop this comment, as everyone interested in this client is probably
familiar enough with the DRM-backend in order to do that.

Also made some adjustments to other comments explaining how this client
works.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2023-03-28 16:23:44 -03:00
Leandro Ribeiro 6517accf7e backend-drm: cosmetic changes to dmabuf_feedback_maybe_update()
Cosmetic changes that makes dmabuf_feedback_maybe_update() easier to
read.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2023-03-28 16:23:44 -03:00
Leandro Ribeiro c9b7c7085a backend-drm: add scanout tranche even for views eligible for direct scanout
We log the reasons why the fb of a certain view was not placed in an
overlay plane and use that for debug purposes. With these reasons we
also decide if the scanout tranche should be included on the dma-buf
feedback or not. For instance:

  1. If the reason is the incompatibility between the format/modifier
     pair of the fb and those supported by the KMS device, the scanout
     tranche is added and feedback is re-sent (so that the client can
     re-allocate with parameters that makes it eligible for direct
     scanout).

  2. If the reason is because we have no overlay planes available, the
     scanout tranche is useless. So the scanout tranche is removed and
     the feedback re-sent (so that clients can re-allocate with
     parameters optimal for the render device).

Also, when we detect that a view is eligible for direct scanout, we
don't even consider sending new feedback, as our interpretation of the
dma-buf feedback spec was that we should avoid bothering clients with
new feedback when they are already hitting direct scanout.

After some discussions and clarifications regarding the spec, we've
realized that Weston should start to also include the scanout tranche
even when the compositor is able to place client's content on overlay
planes. Basically, because this gives a chance for clients to
re-allocate with the proper parameters (not only format/modifier pair,
but also the target_device and the flags) from the scanout tranche. In
this patch we start doing this.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2023-03-28 16:23:44 -03:00
Leandro Ribeiro 0251c05212 backend-drm: remove scanout tranche when there are no planes available
It makes no sense to keep the scanout tranche on the dma-buf feedback if
there are no overlay planes available. So start to remove it.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2023-03-28 16:23:44 -03:00
Leandro Ribeiro 8fc9d68ffa backend-drm: change dmabuf_feedback_maybe_update() return type to void
As we are not using the returned value, so let's change to void.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2023-03-28 16:23:44 -03:00
Marius Vlad 14ca04609a tests/xwayland: Enable xwayland XWM debug log scope and more debug
We're still timing out with our basic xwayland test in CI, so this
enables the XWM logging scope, and enables some further print debugs we
have available in our helper library, in an attempt to further
investigate and determine why we're still timing out.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-03-28 12:45:13 +03:00
Faith Ekstrand 6b3c3824ea Add a .mailmap file
This will let command-line Git tools re-map my name and e-mail address properly.
I'm using my personal e-mail address and not my Collabora address because I'm
not actively contributing to Wayland anymore and this is mostly for letting
people find me should they dig me up in the project history.

Signed-off-by: Faith Ekstrand <faith@gfxstrand.net>
2023-03-25 11:18:10 -05:00
Michael Olbrich d29c280867 backend-wayland: allow resizing with xdg-shell
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-03-22 14:43:20 +00:00
Michael Olbrich 6b23ffabcf backend-wayland: immediately unref the renderbuffer for use shm buffers
wayland_output_destroy_shm_buffers() is called immediately before
output_destroy() of the renderer is called. And for the pixman renderer all
renderbuffers must be destroyed before the output can be destroyed.
Also, weston_renderbuffer_unref() is not called when the buffer is released
because buffer->output is now NULL, so the renderbuffer would be leaked.

So just unref the renderbuffer immediately. Set it to NULL to avoid unreffing it
again should wayland_output_destroy_shm_buffers() be called again before the
buffer is released. This can happen during an xdg-shell resize.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-03-22 14:43:20 +00:00
Michael Olbrich 455f24be9c wayland-backend: split switch_mode to prepare for xdg-shell resizing
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-03-22 14:43:20 +00:00
Michael Olbrich 2a48ab8c1e shared/frame: add helper to get decoration sizes without shadow
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-03-22 14:43:20 +00:00
Leandro Ribeiro 89d05db0b7 tests: add writeback sreenshooter test
This adds a test to ensure that the DRM-backend writeback screenshooter
is working properly.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2023-03-22 09:37:37 -03:00
Leandro Ribeiro 025ed4573c drm-backend: move aux function up to remove unnecessary declaration
Simple cosmetic change.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2023-03-22 09:37:37 -03:00
Leandro Ribeiro dc27a52216 drm-backend: address case in which writeback takes longer than atomic commit
In commit "drm-backend: add writeback connector screenshooter to
DRM-backend" we were failing the writeback screenshot when the DRM/KMS
driver would take longer than the atomic commit to finish. In this patch
we address such case.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2023-03-22 09:37:37 -03:00
Leandro Ribeiro 5b04895835 drm-backend: add writeback connector screenshooter to DRM-backend
In this patch, we add the writeback connector screenshooter to the
DRM-backend.

This will be useful to create plane composition tests that will run in
our CI, as VKMS already supports writeback connectors.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2023-03-22 09:37:37 -03:00
Leandro Ribeiro 2d70bdfdcd drm-backend: add support to output capture writeback source
With this change, we expose the DRM-backend writeback source through the
output capture interface, making it available to clients.

For now we'll always fail writeback screenshots requests, because we
still don't have the writeback screenshooter implementation on the
DRM-backend. We add that in the following commits.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2023-03-22 09:37:37 -03:00
Leandro Ribeiro 247d492d64 drm-backend: add supported formats for writeback connectors
In the following commits we add a writeback screenshooter. For that,
we'll need the formats supported by the writeback connectors. So include
the supported formats in struct drm_writeback.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2023-03-22 09:37:37 -03:00
Philipp Zabel 53ce09ecf8 backend-vnc: client side cursor support
Allow VNC clients that support the cursor pseudo encoding to render
the cursor themselves. This reduces observable latency of cursor
movement.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-03-22 11:58:34 +00:00
Michael Olbrich d5e5428478 backend-drm: don't copy the fence fd when duplicating the plane state
The state does not own the fd. This is usually not a problem, because the
in_fence_fd of the state is assigned during drm_assign_planes() and then
immediately used in drm_repaint_flush(). It cannot be closed in-between.

However, in the fallback path in drm_output_start_repaint_loop(), the state is
duplicated. At this point in time, the in_fence_fd may be invalid because it was
replaced in a new commit of the corresponding surface.

The plane state was already committed to the kernel when it is copied, so the
fence is no longer needed. So just clear it.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-03-22 11:41:56 +00:00
Michael Olbrich 0edcc9e5ba backend-drm: don't try to commit an empty state
With multiple DRM devices, the state for one device may be empty during
repaint_flush(). This can happen for example if an output of one device triggers
the repaint and there are no screens attached to the other device and therefore
no active outputs.

The atomic commit will actually fail because the commit contains the
DRM_MODE_PAGE_FLIP_EVENT flag but no CRTCs.

Avoid this by skipping the commit entirly. There is nothing to to anyways.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-03-22 11:38:17 +00:00
Daniel van Vugt 183d92e291 clients/simple-dmabuf-feedback: Remove unsupported f suffixes
NVIDIA is more pedantic than Mesa and correctly complains that `1.0f`
is not valid syntax in the OpenGL ES Shading Language version 1.00.
And we are indeed using SL version 1.00 by virtue of using an ES 2.0
context.

So use the syntax compatible with the context we've created.

Signed-off-by: Daniel van Vugt <daniel.van.vugt@canonical.com>
2023-03-17 15:40:22 +08:00
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