Commit graph

2033 commits

Author SHA1 Message Date
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
Derek Foreman 9e12250707 shells: Use weston_coord for shell API
Replaces a lot of x, y pairs with weston_coord.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-09-18 20:35:37 +00:00
Derek Foreman 5fa3ef26c9 libweston: Use weston_coord for touch interfaces
Most of these don't use the parameter that changes at all, but some get
a nice simplification.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-09-18 20:35:37 +00:00
Derek Foreman 8eed64c7df libweston: Add weston_view_set_position_with_offset
There are many times when we want to set a global position with a surface
offset added.

It's a fairly nasty operation, and most places in the code currently do
it naively, ignoring the painful existence of freeform window rotations
and other complex transforms that could be in play (but probably aren't)

Add a helper for this and convert existing usage.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-09-18 20:35:37 +00:00
Derek Foreman b87dcbdf34 input: Fix pointer hotspot coordinate space
Oops, this was always wrong but nothing actually checked it. Checks are
coming, so it needs to be fixed.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-09-18 20:35:37 +00:00
Loïc Yhuel 71616edc4d gl-renderer: use correct read-back format and support WL_SHM_FORMAT_ABGR8888
PIXMAN_a8r8g8b8 / PIXMAN_a8b8g8r8 only matches GL_BGRA_EXT / GL_BGRA on little-endian.
So to have a GL format, we should use DRM_FORMAT_ARGB8888 / DRM_FORMAT_ABGR8888.

Without GL_EXT_read_format_bgra, the read-back format is DRM_FORMAT_ABGR8888.
Then weston-screenshooter fails to create a wl_shm buffer with WL_SHM_FORMAT_ABGR8888,
unless it has been added with wl_display_add_shm_format.

Signed-off-by: Loïc Yhuel <loic.yhuel@softathome.com>
2023-09-15 07:04:02 +00:00
Pekka Paalanen d79fc78152 libweston: set default monitor strings
Allow passing NULL to monitor string in order to set the default
"unknown" strings. This allows a head to be initialized with the default
strings, meaning that it will no longer be mandatory for a backend to
call weston_head_set_monitor_strings(). In DRM-backend case this makes
future changes more convenient.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-09-15 06:56:59 +00:00
Pekka Paalanen c26335bfdb libweston: use xstrdup for head strings
We never expected these strdups to fail, and things tend to assume these
fields are not NULL (except serial_number).

Use xstrdup to ensure that a catastrophic OOM is immediately obvious.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-09-15 06:56:59 +00:00
Pekka Paalanen 3728d7e99b backend-drm,pipewire,remoting: do not set monitor serial to "unknown"
If serial is unknown, it's best to leave it as NULL. All usage sites
already deal with it possibly being NULL.

This makes DRM-backend consistent with all other backend that leave
serial as NULL, allowing to move the initialization of these fields into
core.

Pipewire and remoting plugins are modified just for consistency.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-09-15 06:56:59 +00:00