Commit Graph

2041 Commits

Author SHA1 Message Date
Derek Foreman e49294b901 libweston: fix output clamp helper
Any coordinate that didn't change during clamping was left uninitialized,
resulting in failures later.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-10-09 08:19:44 +00:00
Derek Foreman 209b7eb56a backend-drm: Fix visibility calculation
Between assign_planes() and pnode_update_late(), the pnode's plane may
not yet be up to date. This leads to the visible region being incorrectly
calculated for paint nodes beneath a paint node that changes planes. Their
visible regions will still contain a cut out for the node that no longer
occludes them.

However, we place damage on nodes beneath a node that changes planes in
order to redraw the region beneath a node that moves from the primary to
non-primary plane.

The gl-renderer clips to a paint node's visible region when rendering it,
so this accidental cut-out masks away all the damage and leaves us with
a mess.

Fix this by using the correct plane in the visibility calculation.

Fixes #821

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-10-06 12:39:57 -05:00
Derek Foreman 176a413ef0 libweston: Prefer primary backend when assigning outputs to views
If coverage and power status are the same, we should prefer a primary
backend over a secondary one.

Fixes #818

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-10-06 11:50:50 +00:00
Derek Foreman 305e954f76 libweston: Reconsider view primary output on output power change
When an output power state changes, it may become or no longer be the
best primary output for a view.

Fixes #819

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-10-06 11:50:50 +00:00
Derek Foreman d3fa809c55 libweston: Consider output power state when selecting primary
If our primary output is turned off, we won't get frame events, so let's
try really hard to prioritize a turned on output with coverage.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-10-06 11:50:50 +00:00
Philipp Zabel d1df848d94 compositor, backend-vnc: Allow to disable output resizing
In some use cases the VNC client should not be allowed to resize the VNC
output. Add a boolean option "resizeable" in the VNC [output] section to
control this.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-10-05 11:43:12 +02:00
Philipp Zabel 690beab475 backend-vnc: Implement output resizing
Let VNC clients resize the VNC output.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-10-05 11:00:21 +02:00
Philipp Zabel 8895b15f3d ci, backend-vnc: update to Neat VNC 0.7.0
Neat VNC 0.7.0 supports desktop resizing.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-10-05 11:00:12 +02:00
Daniel Stone cae789774a surface: Check parents in weston_surface_is_mapped()
A subsurface is not considered to be fully 'mapped' unless its ancestors
are also mapped.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-10-04 11:44:10 +03:00
Daniel Stone 2faf491f61 surface: Add weston_surface_is_mapping()
The counterpart to weston_surface_is_unmapping(). This is valid for the
duration of processing the surface commit.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-10-04 11:44:10 +03:00
Daniel Stone 5c75ecccfe surface: Don't re-map already-mapped surfaces
If a surface has already been mapped, just return early out of
weston_surface_map(), rather than firing the map signal and rebuilding
the view list.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-10-04 11:44:10 +03:00
Derek Foreman 720421c193 libweston: Add and use weston_coord_surface_add/sub helpers
We already have these for global coordinates, now we have them for
surface coordinates too. In addition to removing some unsightly
unadorned coordinate usage, this also adds appropriate coordinate space
id checks at runtime.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-10-03 18:19:17 +00:00
Derek Foreman cec0ab7d23 libweston: Make better use of global coord helpers
Use wesotn_coord_sub/add() in many more places.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-10-03 18:19:17 +00:00
Derek Foreman 18cce195d3 libweston: Make a common helper for clamping a coord to an output
This is a tricky bit of code and we use it in two places. Let's make a
single implementation.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-10-03 18:19:17 +00:00
Derek Foreman 71e38cf2ef libweston: Use weston_coord_surface in weston_surface_state
Use this for the buffer attachment offset coordinates.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-10-03 18:19:17 +00:00
Derek Foreman 4f17af4691 libweston: Remove dbus helpers
Now that launcher-logind is gone, we don't use any of this anymore.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-09-29 09:58:01 -05:00
Derek Foreman e3b6ed50f1 launcher: Remove launcher-logind
Second try at removing direct logind support. This time more careful
with the documentation, as libseat can still use logind even if we don't
directly use it.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-09-29 09:55:32 -05:00
Derek Foreman 3959c90c7c launcher: Drop drm dependency
This was probably only for launcher-direct, and hasn't been required for
a while.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-09-29 09:47:43 -05:00
Derek Foreman 2296781cee launcher-libseat: Rename libseat_dep
Most other dependencies are named dep_* so let's conform.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-09-29 09:47:43 -05:00
Derek Foreman 501e3f193f launcher-libseat: Don't depend on dbus
The libseat launcher doesn't directly use dbus functions.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-09-29 09:47:43 -05:00
Derek Foreman 754562fb52 Revert "launcher: Remove launcher-logind"
This reverts commit 55bf6b5046.

This accidentally removed things that should have stayed - libseat
can still use the logind API, even if weston doesn't directly use
it.

Note that the logind-launcher does not actually build anymore
because breaking changes landed before this revert.

Since we're removing it again right away, I've not taken care to
fix that.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-09-29 09:46:48 -05:00
Philipp Zabel c93a54ece3 libweston: add explicit weston_compositor::primary_backend pointer
This avoids spreading around the knowledge that the primary backend is
the first backend on weston_compositor::backend:list.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-09-28 14:02:04 +00:00
Philipp Zabel a4f0666659 libweston, compositor: let weston_compositor_load_backend return backend
Let weston_compositor_load_backend() return a backend pointer and remove
the backend pointer from struct weston_compositor.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-09-28 14:02:04 +00:00
Michael Olbrich 44f36b9b55 libweston: don't return buffers early with multiple backends
Releasing the buffer reference here works because the backend has seen the
surface and has updated keep_buffer if necessary. With multiple backends
the assumption breaks. The same surface may be visible (now or later) on an
output from another backend. This backend has not seen the buffer yet so it
cannot update keep_buffer.
As a result, the reference is released to early. A surface that is rendered
on a secondary backend first can no longer be placed on a plane on a DRM
backend.

To avoid this, always keep the buffer reference until it is replaced when
multiple backends are involved.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-09-28 14:02:04 +00:00
Philipp Zabel 6d3fa71d7b libweston: drop workaround for multi-backend incapable backends
All backends add themselves to weston_compositor::backend_list now.
Drop the workaround that catches unconverted backends that still set
weston_compositor::backend.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-09-28 14:02:04 +00:00
Philipp Zabel 14c52a942b backend-x11: enable multi-backend support
Insert the backend into the weston_compositor::backend_list instead
of setting weston_compositor::backend. The compositor uses this to
determine whether the backend is capable of being loaded simultaneously
with other backends.

The X11 backend can only be loaded as primary backend.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-09-28 14:02:04 +00:00
Philipp Zabel bb3b9374aa backend-wayland: multi-backend support
Insert the backend into the weston_compositor::backend_list instead
of setting weston_compositor::backend. The compositor uses this to
determine whether the backend is capable of being loaded simultaneously
with other backends.

The Wayland backend can only be loaded as primary backend.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-09-28 14:02:04 +00:00
Philipp Zabel c857042b45 backend-vnc: enable multi-backend support
Insert the backend into the weston_compositor::backend_list instead
of setting weston_compositor::backend. The compositor uses this to
determine whether the backend is capable of being loaded simultaneously
with other backends.

To stay backwards compatible, the VNC backend can be loaded as primary
backend. It also supports being loaded as secondary backend.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-09-28 14:02:04 +00:00
Philipp Zabel f014009419 backend-rdp: Enable multi-backend support
Insert the backend into the weston_compositor::backend_list instead
of setting weston_compositor::backend. The compositor uses this to
determine whether the backend is capable of being loaded simultaneously
with other backends.

To stay backwards compatible, the RDP backend can be loaded as primary
backend. It also supports being loaded as secondary backend.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-09-28 14:02:04 +00:00
Philipp Zabel 308d5cf367 backend-pipewire: enable multi-backend support
Insert the backend into the weston_compositor::backend_list instead
of setting weston_compositor::backend. The compositor uses this to
determine whether the backend is capable of being loaded simultaneously
with other backends.

To stay backwards compatible, the PipeWire backend can be loaded as
primary backend. It also supports being loaded as secondary backend.

Co-authored-by: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-09-28 14:02:04 +00:00
Philipp Zabel baaef12432 backend-headless: enable multi-backend support
Insert the backend into the weston_compositor::backend_list instead
of setting weston_compositor::backend. The compositor uses this to
determine whether the backend is capable of being loaded simultaneously
with other backends.

The headless backend can only be loaded as primary backend.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-09-28 14:02:04 +00:00
Philipp Zabel 281aa0a4d7 backend-drm: enable multi-backend support
Insert the backend into the weston_compositor::backend_list instead
of setting weston_compositor::backend. The compositor uses this to
determine that the backend is capable of being loaded simultaneously
with other backends.

The DRM backend can only be loaded as primary backend.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-09-28 14:02:04 +00:00
Philipp Zabel 20c5b4527c libweston: allow loading multiple backends
Before loading a backend, clear the weston_compositor::backend pointer
to check whether the backend supports multi-backend operation and adds
itself to the weston_compositor::backend_list.

Keep weston_compositor::backend pointing to the last loaded backend
either way, to allow the calling compositor code to store it away for
later, to check whether a head belongs to a given backend in the output
configuration code. This workaround can be removed after all backends
are converted to be multi-backend aware.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-09-28 14:02:04 +00:00
Philipp Zabel 3d50069afc libweston: intersect all backends' supported presentation clocks
In preparation for multi-backend support, determine the presentation
clocks that are supported by all backends.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-09-28 14:02:04 +00:00
Philipp Zabel 183c309b85 libweston: use weston_compositor::backend_list instead of ::backend
In preparation for multi-backend support, start/flush/cancel repaint on
all backends by looping over the weston_compositor::backend_list.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-09-28 14:02:04 +00:00
Philipp Zabel 76372375ab libweston: store backends in a list
In preparation for multi-backend support, add a list of backends to the
weston_compositor structure. Until backends are converted, this list
just contains the single weston_compositor::backend. Keep that pointer
for now, until the conversion is complete.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-09-28 14:02:04 +00:00
Leandro Ribeiro 08018d3a28 linux-dmabuf: replace assert with the new weston-assert
Make use of the new weston-assert in linux-dmabuf.c

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2023-09-28 06:52:24 +00:00
Derek Foreman 55bf6b5046 launcher: Remove launcher-logind
This has been deprecated and non-default for a full release cycle, so
we're going to remove it now.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-09-28 06:47:06 +00:00
Philipp Zabel b7fb70630a backend-x11: Use weston_output_finish_frame_from_timer()
Replace the finish frame handler logic with a call to the
weston_output_finish_frame_from_timer() helper function that
does the same.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-09-27 12:37:09 +03:00
Philipp Zabel 8888777b26 backend-rdp: Use weston_output_finish_frame_from_timer()
Replace the finish frame handler logic with a call to the
weston_output_finish_frame_from_timer() helper function.

This makes finish_frame_handler() return more exact timestamps
calculated from the previous frame time if the timer callback
was not delayed too much.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-09-27 12:37:09 +03:00
Philipp Zabel 98cd2e9f97 backend-vnc: Use weston_output_finish_frame_from_timer()
Replace the finish frame handler logic with a call to the
weston_output_finish_frame_from_timer() helper function that
does the same.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-09-27 12:37:09 +03:00
Philipp Zabel 2fc6a8bbd2 backend-pipewire, libweston: Extract weston_output_finish_frame_from_timer()
Extract the finish frame timestamp code and the call to
weston_output_finish_frame() into a new helper function
weston_output_finish_frame_from_timer() that can be reused
by the other timer driven backends sharing the same logic.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-09-27 12:37:09 +03:00
Philipp Zabel fd10c92d69 backend-x11: Use weston_output_arm_frame_timer()
Replace the finish frame timer arming logic with a call to the
weston_output_arm_frame_timer() helper function that does the same.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-09-27 12:37:09 +03:00
Philipp Zabel 6fb3443ff4 backend-vnc: Use weston_output_arm_frame_timer()
Replace the finish frame timer arming logic with a call to the
weston_output_arm_frame_timer() helper function that does the same.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-09-27 12:37:09 +03:00
Philipp Zabel b7400c614e backend-rdp: Use weston_output_arm_frame_timer()
Replace the finish frame timer arming logic with a call to the
weston_output_arm_frame_timer() helper function that does the same.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-09-27 12:37:09 +03:00
Philipp Zabel eec50e5aac backend-pipewire, libweston: Extract weston_output_arm_frame_timer()
Extract pipewire_output_arm_timer() into libweston so it can be reused
by the other timer driven backends that use the same delay logic.

Call the shared function weston_output_arm_frame_timer().

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-09-27 12:37:09 +03:00
Marius Vlad b51462d001 backend-wayland: Don't signal out resize events for activation
This should avoid spurious signal events received by the shell in order
to resize its buffer.

As we can have resize events being sent even if xdg-shell activation
doesn't happen, make use of the output dimensions to determine if we
need do send out a resize event or not.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-09-26 14:07:25 +00:00
Philipp Zabel d9a8073568 backend-x11: fix output repaint timing
Copy the output repaint timing code from the PipeWire backend.
This evens frame pacing under varying render time and allows
to actually reach 60 fps.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-09-18 20:41:51 +00:00
Derek Foreman d62c1b7f7b shell-utils: Use weston_coord in curtain params
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-09-18 20:35:37 +00:00
Derek Foreman 9f7f8faff6 input: Use weston_coord in the cursor confinement code
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-09-18 20:35:37 +00:00