Commit graph

22 commits

Author SHA1 Message Date
Robert Mader
32f6148afd libweston: Implement color-representation protocol
For now limited to coefficients and ranges that are typically
supported by KMS drivers. We notably leave out alpha modes and
chroma locations for now.

The protocol initialization is guarded by the WESTON_CAP_COLOR_REP
backend capability and thus not enabled anywhere yet.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-12-19 17:08:29 +01:00
Derek Foreman
a3f0e97a71 compositor: Support the commit-timing protocol
Introduce support for the commit-timing protocol to allow applications
to attach a presentation time to a content update.

We use the repaint timer to schedule content updates in advance of
the frame time when they should be displayed.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-12-16 10:58:01 -06:00
Derek Foreman
cb97abd4f7 compositor: Add the fifo-v1 protocol
Add support for the fifo protocol, which allows an application to submit
a content update that can only be applied after the previous content
update has been active for a display refresh.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-12-04 14:03:13 -06:00
Derek Foreman
f50296d4e9 compositor: Add a deferred content update framework
Now that we have surface-state application streamlined, it's fairly easy to
add a framework for deferring content updates.

This will be used soon for fifo and commit timing. For now, the
weston_surface_state_ready() call that makes any of this do something
will always return true.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-12-04 14:03:10 -06:00
Derek Foreman
73e0bb2829 compositor: Try to remove some unnecessary repaints
If a surface isn't visible, there's no point in performing a repaint when
its state changes. However, we don't know if a surface is visible until
we perform the scene graph updates at repaint.

Use our new visibility tracking API to check whether we need to perform
a repaint, or if we can just skip it.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-12-04 13:55:23 -06:00
Derek Foreman
61134fa151 compositor: Track view and surface visibility per output
Keep track of whether a view has any unoccluded pixels on an output,
use this information to add a weston_surface_visibility_mask() function
that we'll use later.

Since the visibility information is calculated at repaint, and invalidated
by some (but not all) state updates, we'll keep track of when the previous
repaint's status is still valid by watching surface status bits.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-12-04 13:55:20 -06:00
Derek Foreman
6a280a8fad compositor: Push subsurface order application into apply_state
Seems like it makes sense to have it there, and this cleans up a bunch of
paths where we return status bits so a caller can do this.

We can also drop the explicit setting of view_list_needs_rebuild, as it's
going to happen automatically when applying subsurface order.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-12-04 12:38:17 -06:00
Derek Foreman
7bfedba650 compositor: move weston_surface_schedule_repaint into surface-state.c
Only user is there, so move it across.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-12-04 12:38:17 -06:00
Derek Foreman
e4be014f93 compositor: Add an explicit latch point
Latch is the moment when the compositor considers updates for an upcoming
redraw. Nothing that takes place after an output latches for repaint can
change what will be repainted.

This needs a more explicit treatment now that upcoming transactional
protocols require things to happen immediately after the latch (ie:
when it's too late to change the upcoming render).

Add an explicit latch point, a signal to tap for testing, and some asserts
to make sure nothing can violate the inevitability of the current render
state.

Note that currently latch is tied to repaint such that we only claim to
have latched when a repaint will happen. In a future commit this will lead
to forcing the repaint loop to fire without damage when the fifo protocol
needs something to happen after a latch. This could be an area for
future improvement.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-12-04 12:38:17 -06:00
Derek Foreman
b700c7cbee compositor: Add flow id into surface state
We're going to be adding protocols (commit-timing, fifo, syncobj) that
allow deferred surface content updates.

It makes sense to start the perfetto flow ids from the surface state so
we can track a flow from creation (ie:commit) to presentation.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-12-04 12:38:17 -06:00
Derek Foreman
5e0099ddbb compositor: Dispatch feedback for all content updates
This was discussed in wayland-protocols MR 273, and clarified in wayland
MR 379 - presentation feedback applies to content updates, not buffers.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-12-04 12:38:17 -06:00
Derek Foreman
6070dd8069 compositor: Add a WESTON_PAINT_NODE_BUFFER_PARAMS_DIRTY
This already existed for surface, so it is trivial to add.

This will let the upcoming plane state reuse code notice a format change.

This is handy because a client might respond to dmabuf feedback by changing
formats, with the expectation that doing so would land content on a plane.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-10-23 16:22:00 +01:00
Derek Foreman
dc27dd7e95 compositor: Validate buffer scale
We're supposed to generate an INVALID_SIZE error if the buffer size isn't
an integer multiple of the scale.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-10-18 11:51:05 -05:00
Daniel Stone
7f8c5f984e paint-node: Expose weston_paint_node_status
Expose the dirty status as public API so we can use it as a part of
weston_output.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2025-10-17 13:51:04 -05:00
Daniel Stone
abfe874a51 core: Don't rebuild view list on surface-local changes
If a surface changes size or opaque region, or a view changes position,
we don't need to rebuild the entire view list from scratch: we can just
rebuild what's changed and nothing else.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2025-10-17 13:49:21 -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
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