Add wlr_compositor_dmabuf_waiter

This helper monitors buffers for implicit and explicit work
synchronization, delaying the surface commit until the fences are ready
to be consumed for synchronization (i.e., fences have materialized), or
for the work to be complete, depending on the specified waiter mode.

Through this, the compositor can avoid stalling on incomplete work,
staying fully interactive until the buffer is ready to be sampled.

This is a generalization of Simon's patch that added a waiter for
traditional implicit sync.

Based-on-patch-by: Simon Ser <contact@emersion.fr>
This commit is contained in:
Kenny Levinsen 2026-04-01 14:32:08 +00:00
parent c66a910753
commit b84aadb5c1
4 changed files with 427 additions and 22 deletions

View file

@ -97,11 +97,7 @@ bool wlr_drm_syncobj_timeline_signal(struct wlr_drm_syncobj_timeline *timeline,
/**
* Asynchronously wait for a timeline point.
*
* Flags can be:
*
* - 0 to wait for the point to be signalled
* - DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE to only wait for a fence to
* materialize
* See wlr_drm_syncobj_timeline_eventfd for available flags.
*
* A callback must be provided that will be invoked when the waiter has finished.
*/
@ -112,6 +108,20 @@ bool wlr_drm_syncobj_timeline_waiter_init(struct wlr_drm_syncobj_timeline_waiter
* Cancel a timeline waiter.
*/
void wlr_drm_syncobj_timeline_waiter_finish(struct wlr_drm_syncobj_timeline_waiter *waiter);
/**
* Create an eventfd that becomes readable when a timeline point is ready.
*
* Flags can be:
*
* - 0 to wait for the point to be signaled
* - DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE to only wait for a fence to
* materialize
*
* The returned FD is owned by the caller and must be closed when no longer
* needed.
*/
int wlr_drm_syncobj_timeline_eventfd(struct wlr_drm_syncobj_timeline *timeline,
uint64_t point, uint32_t flags);
/**
* Export a timeline point as a sync_file FD.
*