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>
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>
Simple helper to multiply a surface coordinate by -1, -1. There are no
uses yet, but will be in a follow up patch that wants to have cursor
hotspots in their inverted form.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
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>
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>
This is a trap - it's not harmful to let the animation complete - it is
harmful to call weston_shell_utils_curtain_destroy() in mid animation. It
results in immediately completing the animation, which attempts to destroy
the curtain a second time.
Fixes a crash when (on a multi-output system) the display is disconnected
during the fade out, then reconnected before the fade-in starts.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Instead of trying to cover the desktop with an arbitrarily larger
rectangle, actually calculate the appropriate size.
Fixes the old (but recently reintroduced) bug where the curtain isn't
always large enough.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This essentially reverts 9ad4de1f7a, though much has changed in the
interim to make a simple 'git revert' impossible.
Per-output fade animations were a precursor to implementing support for
zwp_idle_inhibit_v1. Nobody ever followed up on that. Now that we have
the ability to create overlapping outputs, per output curtains don't
make sense - the curtains can overlap and look weird.
This re-introduces the bug where a desktop larger than 8192 pixels in any
direction isn't properly covered by the fade.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
We've already validated this, so if we can't get here with an invalid
type. Just assert() instead.
This lets us remove the very strange tear down of curtains that presumably
couldn't have been created in the first place??
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
weston_view_move_to_layer() recalculates the output, so this can do no
good.
This output is only ever used to test against NULL anyway, so we don't
need to try to set it "properly".
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Merge shell_configure_fullscreen() and
shell_ensure_fullscreen_black_view() into shell_set_view_fullscreen().
Signed-off-by: Daniel Stone <daniels@collabora.com>
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>