Commit Graph

9151 Commits

Author SHA1 Message Date
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
Philipp Zabel e541aea2d7 backend-rdp: make sure to finish frames with timestamps in the past
Round up the ms delay to make sure that the finish_frame_timer always
expires after the next frame_time. That way, finish_frame_handler()
never passes a timestamp in the future to weston_output_finish_frame().
Setting frame_time into the future risks hitting an assert in
weston_output_finish_frame(), when it is called from start_repaint_loop
within the frame interval.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-09-15 09:52:37 +03:00
Philipp Zabel 5a95339d7a backend-vnc: make sure to finish frames with timestamps in the past
Round up the ms delay to make sure that the finish_frame_timer always
expires after the next frame_time. That way, finish_frame_handler()
never passes a timestamp in the future to weston_output_finish_frame().
Setting frame_time into the future risks hitting an assert in
weston_output_finish_frame(), when it is called from start_repaint_loop
within the frame interval.

Use CLIP() to simplify limiting the ms delay to a reasonable range.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-09-15 09:48:37 +03:00
Philipp Zabel 4d14adaa2c backend-pipewire: make sure to finish frames with timestamps in the past
Round up the ms delay to make sure that the finish_frame_timer always
expires after the next frame_time. That way, finish_frame_handler()
never passes a timestamp in the future to weston_output_finish_frame().
Setting frame_time into the future risks hitting an assert in
weston_output_finish_frame(), when it is called from start_repaint_loop
within the frame interval.

Use CLIP() to simplify limiting the ms delay to a reasonable range.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-09-15 09:44:44 +03:00
Philipp Zabel b3d94c9843 helpers: Add an integer division helper that rounds up
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-09-15 09:44:44 +03:00
Joshua Watt 617bb9afc9 Check weston_head_from_resource for NULL return
If the compositor is disabling a weston_output,
weston_head_from_resource can return NULL, so the return code must be
checked where used.

Fixes #638

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
2023-09-14 13:31:06 +03:00
Loïc Yhuel 623646bbfd gl-renderer: Do not attach the first buffer twice
When gl_renderer_attach is called, surface->buffer_ref.buffer points to the buffer.
So if the surface state needs to be created, we have :
gl_renderer_attach -> get_surface_state -> gl_renderer_create_surface -> gl_renderer_attach

Fixes: 895b1fdcb2 ("gl-renderer: Attach buffer during surface state creation if possible")
Signed-off-by: Loïc Yhuel <loic.yhuel@softathome.com>
2023-09-13 15:31:19 +00:00
Alexandros Frantzis 7dcde16f22 desktop-shell: Don't process surfaces under destruction during output resize
An output resize may occur while a shell surface is in the process of
being destroyed, e.g., while the destruction fade-out animation is in
progress. In such cases although the shell surface exists, it's missing
the backing weston_desktop_surface, so ensure to check for that.

Fixes: #805
Fixes: eefd8ae2e0
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2023-09-13 15:21:55 +00:00
Loïc Yhuel c00ef0a5ce libweston: Do not include private headers in shell-utils.h
Since it's a public header, it should be usable outside of weston tree.

Signed-off-by: Loïc Yhuel <loic.yhuel@softathome.com>
2023-09-11 10:28:57 +02:00
Robert Mader 12744bcbee renderer-gl: Add YUV format descriptors for P010/P012/P016
For drivers not supporting importing them directly. We use the equivalent
values to NV12 but with 16bit. The lowest 6 or 4 bits for P010/P012 are
padding and set to zero, so we can use the same subformats like for P016
and share the shader with NV12.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2023-09-07 15:46:57 +02:00
Robert Mader 3c9e9d721e pixel-formats: Add P010/P012/P016 formats
They are the 10/12/16bit equivalents of NV12 and at least P010 is widely
supported for a while now, so let's support them.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2023-09-07 15:44:13 +02:00
Robert Mader 68e2a606c0 clients/simple-dmabuf-v4l: Add pointer support
To make the app a little bit more pleasant to work with and, crucially,
makes the cursor hide in fullscreen mode. This is useful when testing
hardware planes on devices with no cursor plane / a single primary plane.

Also add an option to keep the cursor around in fullscreen mode.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2023-08-31 21:32:36 +00:00
Robert Mader 6cee95af37 client/simple-dmabuf-v4l: Add fullscreen support
Effectively making the app behave very similar to a simple video player.
It was useful to me for testing hardware plane YUV support, so it's
likely worth upstreaming.

If available, wp_viewporter is used to scale up the image. The width to
height ratio is kept, allowing to further test black bars in fullscreen
mode.

For now scaling is only applied if xdg-shell is used.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2023-08-31 21:32:36 +00:00
Robert Mader bf209e3985 clients/simple-dmabuf-v4l: Use interface name variables
It's good practice nowadays, so let's be a good example.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2023-08-31 21:32:36 +00:00
Robert Mader d5753805b7 clients/simple-egl: Use interface name variables
It's good practice nowadays, so let's be a good example.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2023-08-31 21:32:36 +00:00
Marius Vlad a414d379fb kiosk-shell: Make sure we have seat focused_surface
We might not have a focused_surface if the surface was only added and
removed, without any commit which would actually allow to set a
focused_surface in kiosk_shell_surface_activate().

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-08-25 09:06:42 +00:00
Marius Vlad d33636ae48 kiosk-shell: Don't attempt to activate a window
Without a active_surface_tree there's no point in attempting to access
the shell surfaces list, nor we're going to to have a temorary list
based on it.

This might happen in situations where
kiosk_shell_output_set_active_surface_tree() is being passed a NULL shell
surface root.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-08-25 09:06:42 +00:00
Brendan King 751c1c9496 xwayland: fix segfault when running x11perf
Running "x11perf -reps 1 -repeat 1 -all" will segfault, due to
windows being left on lists after being destroyed.

The fix was devised after running Weston under valgrind whilst
x11perf was running.

Fixes: https://gitlab.freedesktop.org/wayland/weston/-/issues/797

Signed-off-by: Brendan King <Brendan.King@imgtec.com>
2023-08-11 14:18:13 +03:00
Daniel Stone f7d8095352 desktop-shell: Use weston_view_move_to_layer() in switcher
Use our new helper instead of doing this by hand.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-08-11 14:10:45 +03:00
Daniel Stone fb64b00da7 desktop-shell: Remove manual damage for minimised surfaces
We don't need to inflict any damage here, because it's been done for us
when we move the layers.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-08-11 14:10:45 +03:00
Daniel Stone 73050c358d desktop-shell: Don't open-code animate_focus_change()
It already does what we want, so just use it when we're losing focus.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-08-11 14:10:45 +03:00
Daniel Stone f17581fdd2 desktop-shell: Regularise focus_animation_type checks
Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-08-11 14:10:45 +03:00
Daniel Stone 72a52454ad desktop-shell: Reject invalid focus types in configuration
Just refuse to start up if someone passes an incorrect focus type.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-08-11 14:10:45 +03:00
Daniel Stone fca71ff4bb desktop-shell: Initialise lists earlier
Make sure that we can exit cleanly if we have to fail.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-08-11 14:10:45 +03:00
Daniel Stone f04e1ec9ab desktop-shell: Clean up animate_focus_change()
Now that we're not allocating surfaces on demand, animate_focus_change()
becomes a lot more straightforward and common, and using some local
variables sure does cut out a lot of typing.

Knowing that both from and to cannot both be NULL (because we check if
from == to), we can change the juggling to be extremely simple:
calculate where we need the curtains to be in the view list, put them
there, and set up the fade.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-08-11 14:10:45 +03:00
Daniel Stone 42334db41e desktop-shell: Create focus surfaces for animation up front
Rather than creating them the first time we need to switch focus, just
create them at startup if we're going to be needing them at some point.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-08-11 14:10:45 +03:00
Daniel Stone a168dc0659 desktop-shell: Don't set alpha for unused views
We don't need to be setting this because it isn't (yet) used anywhere.
It will get set when it is used.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-08-11 14:10:45 +03:00
Daniel Stone 6738c738ab desktop-shell: Use weston_view_move_to_layer for focus animation
Rather than juggling our layers manually, just use
weston_view_move_to_layer. This obviates the need for manually marking
the view as mapped.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-08-11 14:10:45 +03:00
Daniel Stone db97820919 desktop-shell: Simplify condition for focus change
We must have (from || to), because if (!from && !to), we would've caught
the if (from == to) early-return case.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-08-11 14:10:45 +03:00
Daniel Stone 77b9dbb730 desktop-shell: Remove yet another center_on_output()
However many times you thought this might reasonably be called when
setting up for fullscreen, there were more.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-08-11 14:10:45 +03:00
Daniel Stone e32557131e desktop-shell: Simplify confusing conditional
The only place we ever set shsurf->fullscreen.black_view is when we're
going into fullscreen, and we destroy it when we're going out of
fullscreen. Hence if we do ever have a fullscreen black view, we should
move it out of the way.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-08-11 14:10:45 +03:00
Daniel Stone a019aa6b2a desktop-shell: Flatten and rename shell_configure_fullscreen()
Merge shell_configure_fullscreen() and
shell_ensure_fullscreen_black_view() into shell_set_view_fullscreen().

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-08-11 14:10:45 +03:00
Daniel Stone e4e3cc198f desktop-shell: Delete pointless function wrapper
shell_map_fullscreen() just duplicated shell_configure_fullscreen()
exactly.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-08-11 14:10:45 +03:00
Daniel Stone 49a122bd30 desktop-shell: Assume fullscreen views are mapped
If we're asked to set a view as fullscreen, assume we're not doing so
with the surface not being mapped.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-08-11 14:10:45 +03:00
Daniel Stone 4bbe4e6e98 desktop-shell: Use weston_view_move_to_layer() for fullscreen
Use our helper to move stuff around.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-08-11 14:10:45 +03:00
Daniel Stone e2a48f6f68 desktop-shell: Deduplicate center_on_output() in fullscreen
weston_shell_utils_center_on_output() already handles the case where we
don't have an output to aim at.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-08-11 14:10:45 +03:00
Daniel Stone 2ab3d33903 desktop-shell: Deduplicate center_on_output() in fullscreen
weston_shell_utils_center_on_output() already calculates the subsurface
bounding box for us.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-08-11 14:10:45 +03:00
Daniel Stone 8ed7f0f459 desktop-shell: Use weston_view_move_to_layer() for minimised views
When we're moving a view to the minimised layer, use our new(ish) helper
to move it.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-08-11 14:10:45 +03:00
Tomohito Esaki 1e781d9f88 drm-backend: Drop support libgbm older than 21.1.1
Since drm-backend requires libgbm 21.1.1 or later, there is no need to
support the old libgbm which does not support modifiers or fd import.

Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
2023-08-09 21:45:42 +03:00
Tomohito Esaki d31ab9163d clients/simple-dmabuf-egl: Drop support libgbm older than 21.1.1
Since clients using dmabuf require libgbm 21.1.1, there is no need to
support the old libgbm which does not support modifiers.

Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
2023-08-09 21:45:42 +03:00
Tomohito Esaki fef8410866 clients/meson.build: Require libgbm 21.1.1 for clients using dmabuf
Since drm-backend requires libgbm 21.1.1, client samples using dmabuf
should be similar to drm-backend.

Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
2023-08-09 21:45:42 +03:00
Tomohito Esaki 1ffd387d0e clients/simple-dmabuf-feedback: Drop support libgbm older than 21.1.1
Since simple-dmabuf-feedback requires libgbm 21.1.1, there is no need to
support the old libgbm which does not support modifiers.

Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
2023-08-09 21:45:42 +03:00
Marius Vlad c59a02c15e desktop-shell: Don't reposition windows on every resize
Remove any attempt to reposition windows when handling an output resize.

This had some side-effects on x11 and wayland backends that keep moving
windows at random positions when manually the output.

A more smarter approach would be to move them only if they're actually
affected by a resize -- like no longer in the output's viewing area, but
that remains for another day.

Fixes: #793

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Reported-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-08-09 21:26:10 +03:00
Derek Foreman 3f2ce98278 libweston: Rebuild view list after adding an output
This fixes an assert() that can fire when outputs are hotplugged.

Fixes #787

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-08-07 09:39:26 -05:00
Philipp Zabel 63e473a9cf libweston: Move color manager fallback into weston_compositor_backends_loaded()
Initialize no-op color manager in weston_compositor_backends_loaded()
if weston_compositor_load_color_manager() was never called.

This makes weston_compositor_load_backend() live up to its name and
prepares it to be called multiple times.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-08-02 17:16:35 +02:00
Philipp Zabel 53a51461f9 libweston: Prepare weston_compositor_backends_loaded for extension
Move the presentation clock selection loop into
weston_compositor_set_presentation_clock() and refactor
weston_compositor_backends_loaded() to make it possible
to add more functionality.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-08-02 17:16:30 +02:00
Marius Vlad 0713ea7ee6 backend-drm/meson.build: Require at least mesa 21.1.1
We seem to be using at least mesa 21.1.1 since Weston 10, but we never
explicitly asked for it.

Fixes: #790

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-08-02 15:42:19 +03:00
Derek Foreman b75f1c0fd1 libweston: Delete paint nodes when views change layers
Since we use paint nodes to track damage, we have to be very careful to
make sure that we never have paint nodes that aren't actually being
displayed on their outputs.

Shells may move views to invisible layers (minimized_layer, inactive_layer)
and this currently leaves the paint node alive but not visible on its
output.

When this happens, the paint node's previous visible region is left
undamaged, and the paint node is removed from processing.

Let's delete paint nodes when their views change layers, thus creating
damage for their full visible region.

This may create excess damage if the paint node moves between two visible
layers, but this is probably far less harmful than leaving pieces of
invisible views on screen.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-08-02 12:08:19 +03:00
Derek Foreman ea4700c81f libweston: Fix "fix paint_node_damage_below"
Commit 43b59786 errantly claimed that paint_node_damage_below() needed to
damage all planes because it's used when moving paint nodes between
planes.

This is wrong because the destination plane will receive damage correctly
from paint_node_update_late() when the node's visible region is added to
its damage.

Leave the rest of that commit's changes, but make it once again only
damage the plane the node is currently on.

The problem this caused is easily seen by turning on triangle fan debug
and moving the mouse. Extra damage is generated beneath the cursor plane.

Fixes 43b59786

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-08-02 12:08:19 +03:00
Philipp Zabel 1d59530e4b libweston: Set the presentation clock in the compositor
Let backends declare the presentation clocks they can use with a
new bitfield weston_backend::supported_presentation_clocks and set
presentation clock after loading the backend in the compositor.

Make weston_compositor_set_presentation_clock() internal and replace
weston_compositor_set_presentation_clock_software() with an exported
weston_compositor_backends_loaded(), which is called by the compositor
after the backend is loaded.

In the future, this can be extended to determine the subset of clocks
supported by all backends.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-08-02 11:51:56 +03:00