render/drm_syncobj: add wlr_drm_syncobj_timeline_export()

This commit is contained in:
Simon Ser 2024-02-27 18:38:12 +01:00
parent 5552de65f8
commit edb867bc05
2 changed files with 13 additions and 0 deletions

View File

@ -62,6 +62,10 @@ struct wlr_drm_syncobj_timeline *wlr_drm_syncobj_timeline_ref(struct wlr_drm_syn
* Unreference a synchronization timeline. * Unreference a synchronization timeline.
*/ */
void wlr_drm_syncobj_timeline_unref(struct wlr_drm_syncobj_timeline *timeline); void wlr_drm_syncobj_timeline_unref(struct wlr_drm_syncobj_timeline *timeline);
/**
* Export a drm_syncobj FD from a timeline.
*/
int wlr_drm_syncobj_timeline_export(struct wlr_drm_syncobj_timeline *timeline);
/** /**
* Transfer a point from a timeline to another. * Transfer a point from a timeline to another.
* *

View File

@ -67,6 +67,15 @@ void wlr_drm_syncobj_timeline_unref(struct wlr_drm_syncobj_timeline *timeline) {
free(timeline); free(timeline);
} }
int wlr_drm_syncobj_timeline_export(struct wlr_drm_syncobj_timeline *timeline) {
int drm_syncobj_fd = -1;
if (drmSyncobjHandleToFD(timeline->drm_fd, timeline->handle, &drm_syncobj_fd) != 0) {
wlr_log_errno(WLR_ERROR, "drmSyncobjHandleToFD failed");
return -1;
}
return drm_syncobj_fd;
}
bool wlr_drm_syncobj_timeline_transfer(struct wlr_drm_syncobj_timeline *dst, bool wlr_drm_syncobj_timeline_transfer(struct wlr_drm_syncobj_timeline *dst,
uint64_t dst_point, struct wlr_drm_syncobj_timeline *src, uint64_t src_point) { uint64_t dst_point, struct wlr_drm_syncobj_timeline *src, uint64_t src_point) {
assert(dst->drm_fd == src->drm_fd); assert(dst->drm_fd == src->drm_fd);