Commit graph

10247 commits

Author SHA1 Message Date
Erico Nunes
fef0de7d72 pixel-formats: Use a single __BYTE_ORDER macro name
This file used both __BYTE_ORDER and __BYTE_ORDER__ which could become
confusing to inspect.
Both appear to be valid, since it is being compared to __LITTLE_ENDIAN
stick to __BYTE_ORDER for all uses.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
2025-09-08 12:02:11 +01:00
Erico Nunes
8c9f395c6c vulkan-renderer: refactor extensions to extension table
Define extension tables for all extensions that are potentially used,
and use that to enumerate and request extensions which will be used.
This allows for a bitset to hold supported extensions and makes it
less cumbersome to define new ones to use later, as well as requiring
less traversing of the extension string list to decide which extensions
to request.
This also fixes some missing dependency issues which could trigger
validation errors on some drivers with limited extension support.
It also allows some code paths that didn't require some specific
extensions that were in the default list before, by checking for
those in the code path that actually uses them at runtime.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
2025-09-08 12:02:11 +01:00
Leandro Ribeiro
b717030a10 backend-drm: assert that there's a valid output state before repaint
Follow-up of "compositor: let backends handle output->disable_planes".
Now we always call assign_planes() before a repaint, so we must have
a valid output state when we enter assign_planes().

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2025-09-08 08:37:28 +00:00
Derek Foreman
439aea0188 compositor: Track DIRTY_POS properly
For clients using old protocol versions, the WESTON_SURFACE_DIRTY_POS bit
currently gets set on any attachment. It should really only be set if
the attachment is non-zero.

Since it's possible to attach mulitple times, or to invoke
wl_surface.offset multiple times, let's allow clearing the bit so it
stays up to date with the state that will actually be used on commmit().

Currently, this is pointlessly pedantic, as we don't really do much with
the bit, but in a future commit I intend to use it to notice states that
may change visibility/occlusion status of a surface.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-09-08 08:14:09 +00:00
Derek Foreman
eac3d78bc6 compositor: Remove view->visible
This is not what any sensible person would expect it to be. It was updated
by a walk of all the paint nodes on the output most recently repainted,
so if a view spanned outputs the visible region would only make sense
within the most recently painted output's region.

It's basically a scratchpad for a mid-repaint operation. Instead of making
it a view member, put it in the paint node, which are always per-output.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-09-05 15:23:08 -05:00
Derek Foreman
ac71d40dec compositor: Add transforms to scene graph debug dump
Add transform information to scene graph debug dumps, which can be
helpful in determining why application surfaces aren't ending up on
hardware planes.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-09-05 13:34:18 -05:00
Derek Foreman
cfaa19a292 libweston: Move transform string code into libweston
Pull this out of the frontend.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-09-05 13:34:18 -05:00
Derek Foreman
628e860ffa compositor: Dump some paint node info with the scene graph
For now I've just added plane failure reasons, but more could follow.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-09-05 13:34:18 -05:00
Derek Foreman
37c94a12d9 drm: Dump scene graph at end of repaint instead of beginning
At the end we'll have the plane failure reasons in their final state for
the frame we're submitting (instead of a stale state from the previous)

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-09-05 13:34:18 -05:00
Derek Foreman
6e7b4d63c2 compositor/drm: Move failure reason stringification into compositor
While this is generally drm specific stuff, it's leaked into paint nodes
a little bit already.

Pushing it into the core gives us the ability to print failure reasons
in the scene graph debug text (in a future commit), which can be very
informative.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-09-05 13:34:17 -05:00
Derek Foreman
b4529320ff drm: Better track plane failure reasons
We have a big bitfield of failure reasons for when we can't place a paint
node on a plane - but between the introduction of this bitfield and now
we added many new reasons, so it's an expecation that the reason
FAILURE_REASON_FORCE_RENDERER only means that the compositor is configured
to force the use of the renderer via the WESTON_FORCE_RENDERER environment
variable, or debug key bind, or similar.

Some of the code retained the older generic use of FORCE_RENDERER to mean
any number of things.

Add some new reasons and use other existing reasons to disambiguate the
FORCE_RENDERER reason.

Since we already print the (somewhat misleading) failure reason strings
late in the repaint pass, we can drop the (currently accurate) debug
prints we fired off along the way, and just print them accurately at the
end.

We also move the failure reason reset point to the start of repaint,
as it is convenient to have it be valid after plane assignment so
we can print it in scene graph debug text in a later commit.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-09-05 13:33:22 -05:00
Derek Foreman
38e6a292a2 drm: Replace dead code with an assert in plane transform check paths
The caller to drm_plane_state_coords_for_paint_node() has already tested
for valid transforms, so drm_plane_state_coords_for_paint_node() is never
called with a transform that needs to be tested.

Replace the test with an assert() - and this also lets us stop returning
a bool, and drop the debug prints that could never trigger.


Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-09-05 13:33:22 -05:00
Derek Foreman
a2a6030902 drm: Test cursor plane transform when finding plane for view
Explicitly test the cursor transform so we can properly set
the plane failure reason.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-09-05 13:33:22 -05:00
Derek Foreman
23b9f92398 surface-state: refactor weston_surface_commit
Move some code around so we only have a single call to
weston_surface_apply(). This will simplify having deferred state updates
later.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-09-05 10:01:42 -05:00
Derek Foreman
8966ea79fe surface-state: remove more subsurface specific paths
weston_subsurface_commit_to_cache and weston_subsurface_commit are
trivial functions with single call sites. Eliminate them.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-09-05 10:01:42 -05:00
Derek Foreman
f322b41b3d surface-state: Remove weston_subsurface_apply_from_cache
Now that we don't have a buffer_ref to manage outside the surface_state
struct, this function is a trivial wrapper.

Just inline it where it's used.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-09-05 10:01:42 -05:00
Derek Foreman
ed1edb7b5c compositor: replace surface_state->buffer with a buffer_ref
Use a buffer_ref here to allow us to remove the subsurface
cached_buffer_ref and keep it in the surface state struct instead.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-09-05 10:01:42 -05:00
Derek Foreman
760ca22e8f compositor: Remove unused forward declaration
We don't need to define weston_compositor_build_view_list here, as it's
already defined before it's used.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-09-05 10:01:42 -05:00
Derek Foreman
cd58c45daa compositor: Move weston_surface_commit()
Moving this later in the file lets us drop the prototype for
weston_subsurface_commit().

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-09-05 10:01:42 -05:00
Derek Foreman
f4bad074e6 compositor: Move some surface state functions
Just code motion to get rid of an unnecessary prototype.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-09-05 10:01:42 -05:00
Derek Foreman
0ea8141195 compositor: Move a bunch of surface state handling stuff to another file
compositor.c is too big, let's try to peel off a bit of surface state
handling code into another file.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-09-05 10:01:42 -05:00
Derek Foreman
72f73f6692 compositor: internally export weston_surface_to_subsurface
I'll want to use this in another file soon, but for now let's just
clean up the extra prototypes.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-09-05 10:01:42 -05:00
Derek Foreman
3b017341b7 compositor: Make weston_surface_commit handle subsurfaces
Push the subsurface vs surface logic into weston_surface_commit so there's
just one function to call from surface_commit to handle both.

This is mostly preparation for splitting off a bunch of surface handling
functions into their own file later.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-09-05 10:01:42 -05:00
Derek Foreman
76dc730d3d compositor: Move region_init_infinite to a header
We've got it in two places, let's share the code.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-09-05 10:01:42 -05:00
Derek Foreman
e79c9ceee5 compositor: Move cache flush into weston_subsurface_set_synchronized
Do a subsurface cache flush in weston_subsurface_set_effectively_synchronized
instead of in the protocol handler.

This is just so when I move some functions into another file later, I don't
need to expose weston_subsurface_apply_from_cache().

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-09-05 10:01:42 -05:00
Derek Foreman
b76e6ebd82 compositor: rename surface_commit_from_cache to apply_from_cache
Finish up renaming functions so that committing state and applying state
have their own function names. This will be useful soon when we have a
mechanism to commit state into a queue and apply it later.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-09-05 10:01:42 -05:00
Derek Foreman
98253554c8 compositor: Remove weston_subsurface_synchronized_commit
This is now just a call to weston_subsurface_commit_from_cache, so just
call that directly.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-09-05 10:01:42 -05:00
Derek Foreman
93ad388414 compositor: Move parent_apply call into weston_surface_apply
To streamline state handling, push the weston_subsurface_parent_apply
calls and list walks into weston_surface_apply().

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-09-05 10:01:42 -05:00
Derek Foreman
fb7b3e2880 compositor: Make subsurface state application order consistent
We have several places where we apply surface state, then walk the
subsurface list.

In surface_commit() however, we walk the list first then apply state.

Re-order surface_commit() so it's the same as the other sites.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-09-05 10:01:42 -05:00
Derek Foreman
051f0ac7d9 compositor: Rename parent_commit to parent_apply
Continue renaming "commit" functions to "apply" in anticipation of
a violent split between the two concepts.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-09-05 10:01:42 -05:00
Derek Foreman
ae9b99352c compositor: move some prototypes
In a future commit, we'll need weston_subsurface_parent_commit sooner,
so just move both of these prototypes earlier in the file.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-09-05 10:01:42 -05:00
Derek Foreman
8479772d2d compositor: drop has_cached_data subsurface bit
We don't use it anymore, we just casually commit and expect that
applying clean state is harmless.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-09-05 10:01:42 -05:00
Derek Foreman
3db7d41642 compositor: Don't check for cached data in synchronized_commit
It really doesn't matter if we do a little extra work here,
weston_subsurface_commit_from_cache() is harmless if called on clean state.

If this turns out to waste some cycles we can add some more dirty bits
later.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-09-05 10:01:42 -05:00
Derek Foreman
26625a4928 compositor: Don't pass parent sync status to subsurface_parent_commit
We called subsurface_parent_commit with a flag to indicate whether we're
committing from a synchronized parent or not - this was used for
determining if a subsurface was effectively synchronized.

Now that we know whether a subsurface is effectively synchronized, we
can drop the parameter.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-09-05 10:01:42 -05:00
Derek Foreman
c0053057db compositor: Simplify weston_subsurface_commit
Just bouncing everything through the cache makes for a much
simpler flow.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-09-05 10:01:42 -05:00
Derek Foreman
b5970e6e68 compositor: remove weston_subsurface_is_synchronized
This was used to check if a subsurface was effectively sync,
and we now have a bool to check for that instead.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-09-05 10:01:42 -05:00
Derek Foreman
1326428f41 compositor: track subsurface effective sync status
Keep track of subsurface effective sync status when it changes instead of
figuring it out when we need to know it.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-09-05 10:01:42 -05:00
Derek Foreman
4afd8961fc compositor: Create a common path for applying surface state
Create a common weston_surface_apply() for both subsurface and normal
surfaces to push state through, as this will let us remove a bunch of
common code in the future.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-09-05 10:01:42 -05:00
Derek Foreman
2deb5e1dfd compositor: use early return in set sync/desync
Trivial change for clarity.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-09-05 10:01:42 -05:00
Derek Foreman
3674d9665b compositor: rename commit_subsurface_order to apply_subsurface_order
Continuing to make a split between "commit" and "apply" in preparation
for a future where the application happens later.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-09-05 10:01:42 -05:00
Derek Foreman
a84db969f4 compositor: Rename weston_surface_commit_state
We'll eventually have a hard split between the commit and the application
of state, so rename this function to better indicate what it does.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-09-05 10:01:42 -05:00
Derek Foreman
ee90650c8c compositor: Make subsurface->synchronized a bool
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-09-05 10:01:42 -05:00
Jonas Ådahl
ed6beb1dbf compositor: Make surface state caching reusable
Intended to be used by other inter surface synchronization mechanisms
than subsurfaces.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2025-09-05 10:01:42 -05:00
Robert Mader
ccce6cfdda clients: screenshot: Use shared client-buffer utils
In preparation for dmabuf support.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-09-05 11:47:18 +02:00
Robert Mader
4d43e63ab5 clients: screenshot: Sort imports
In preparation for more additions.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-09-05 11:47:18 +02:00
Robert Mader
106beccc91 weston-test-client-helper: Use shared client-buffer utils
For now just wrap the existing buffer struct around the new shared one.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-09-05 11:47:18 +02:00
Robert Mader
af834d1419 tests/client-buffer: Use shared client-buffer utils
Use the shared helper in order to avoid duplication. This will also
ensure that any format added to the test will also be usable by other
tests and clients.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-09-05 11:47:18 +02:00
Robert Mader
6951ff578b shared: Add client-buffer helpers
Factor out client-buffer creation into a helper library in order to
avoid duplication. This notably allows clients and tests to easily reuse
the dmabuf and yuv logic.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-09-05 11:47:18 +02:00
Derek Foreman
bf311ff232 screenshooter: Don't fail the first time an output won't capture
Historically, weston-screenshooter attempts a capture on all
wl_outputs, and if any output fails to capture it exits immediately.

These days it's possible to set up the pipewire backend to mirror
a drm backend output. This leads to surprising behaviour if one
tries to screenshot while no pipewire client is in use. Since the
pipewire backend has no buffer to render into at this point, the
screenshot fails. The drm screenshot is then dropped on the floor
because one of the wl_outputs failed to capture.

Avoid this for now by just continuing in the case of such
"graceful failures". Though maybe in the future we should allow
picking a wl_output by name, or have a command line switch to
decide whether to stop after a failure or not.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-09-04 08:54:52 -05:00
Derek Foreman
724d3707ec pipewire: Shoot down unsatisfiable capture tasks
If there's no running connection, we can't capture, so just burn down any
waiting tasks so we don't assert later.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-09-04 08:54:52 -05:00