Documentation for <wlr/render/drm_syncobj.h>

Back to index

Table of contents

struct wlr_drm_syncobj_timeline

struct wlr_drm_syncobj_timeline {
	int drm_fd;
	uint32_t handle;
	
	// private state
	
	size_t n_refs;
};

A synchronization timeline.

Timelines are used to synchronize accesses to buffers. Given a producer (writing contents to a buffer) and a consumer (reading from the buffer), the compositor needs to synchronize back-and-forth between these two users. The consumer needs to wait for the producer to signal that they're done with the writes, and the producer needs to wait for the consumer to signal that they're done with the reads.

Timelines provide synchronization points in the form of monotonically increasing 64-bit integer values.

wlroots timelines are designed after Vulkan timeline semaphores. For more information on the Vulkan APIs, see: https://www.khronos.org/blog/vulkan-timeline-semaphores

wlroots timelines are powered by DRM synchronization objects (drm_syncobj): https://dri.freedesktop.org/docs/drm/gpu/drm-mm.html#drm-sync-objects

wlr_drm_syncobj_timeline_check()

bool wlr_drm_syncobj_timeline_check(​struct wlr_drm_syncobj_timeline *timeline, uint64_t point, uint32_t flags, bool *result);

wlr_drm_syncobj_timeline_create()

struct wlr_drm_syncobj_timeline *wlr_drm_syncobj_timeline_create(​int drm_fd);

Create a new synchronization timeline.

wlr_drm_syncobj_timeline_export_sync_file()

int wlr_drm_syncobj_timeline_export_sync_file(​struct wlr_drm_syncobj_timeline *timeline, uint64_t src_point);

Export a timeline point as a sync_file FD.

The returned sync_file will be signalled when the provided point is signalled on the timeline.

This allows inter-operation with other APIs which don't support drm_syncobj yet. The synchronization point needs to have already materialized: wait-before-signal is not supported.

wlr_drm_syncobj_timeline_import()

struct wlr_drm_syncobj_timeline *wlr_drm_syncobj_timeline_import(​int drm_fd, int drm_syncobj_fd);

Import a timeline from a drm_syncobj FD.

wlr_drm_syncobj_timeline_import_sync_file()

bool wlr_drm_syncobj_timeline_import_sync_file(​struct wlr_drm_syncobj_timeline *timeline, uint64_t dst_point, int sync_file_fd);

wlr_drm_syncobj_timeline_ref()

struct wlr_drm_syncobj_timeline *wlr_drm_syncobj_timeline_ref(​struct wlr_drm_syncobj_timeline *timeline);

Reference a synchronization timeline.

wlr_drm_syncobj_timeline_unref()

void wlr_drm_syncobj_timeline_unref(​struct wlr_drm_syncobj_timeline *timeline);

Unreference a synchronization timeline.

struct wlr_drm_syncobj_timeline_waiter

struct wlr_drm_syncobj_timeline_waiter {
	struct {
		struct wl_signal ready;
	} events;
	
	// private state
	
	int ev_fd;
	struct wl_event_source *event_source;
};

wlr_drm_syncobj_timeline_waiter_finish()

void wlr_drm_syncobj_timeline_waiter_finish(​struct wlr_drm_syncobj_timeline_waiter *waiter);

Cancel a timeline waiter.

wlr_drm_syncobj_timeline_waiter_init()

bool wlr_drm_syncobj_timeline_waiter_init(​struct wlr_drm_syncobj_timeline_waiter *waiter, struct wlr_drm_syncobj_timeline *timeline, uint64_t point, uint32_t flags, struct wl_event_loop *loop);