[PATCH libdrm 5/7] add timeline signal/transfer ioctls

Chunming Zhou
2018-12-07T09:58:01Z

xf86drm.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
xf86drm.h | 8 ++++++++
2 files changed, 57 insertions(+)

diff --git a/xf86drm.c b/xf86drm.c
index 9816b3b2..9cf01d38 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -4278,6 +4278,21 @@ drm_public int drmSyncobjSignal(int fd, const uint32_t *handles,
return ret;
}

+drm_public int drmSyncobjTimelineSignal(int fd, const uint32_t *handles,
+ uint64_t *points, uint32_t handle_count)
+{
+ struct drm_syncobj_timeline_array args;
+ int ret;
+
+ memclear(args);
+ args.handles = (uintptr_t)handles;
+ args.points = (uint64_t)(uintptr_t)points;
+ args.count_handles = handle_count;
+
+ ret = drmIoctl(fd, DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL, &args);
+ return ret;
+}
+
drm_public int drmSyncobjTimelineWait(int fd, uint32_t *handles, uint64_t *points,
unsigned num_handles,
int64_t timeout_nsec, unsigned flags,
@@ -4320,4 +4335,38 @@ drm_public int drmSyncobjQuery(int fd, uint32_t *handles, uint64_t *points,
return 0;
}

+drm_public int drmSyncobjBinaryToTimeline(int fd, uint32_t binary_handle,
+ uint32_t timeline_handle,
+ uint64_t point)
+{
+ struct drm_syncobj_transfer args;
+ int ret;

+ memclear(args);
+ args.binary_handle = binary_handle;
+ args.timeline_handle = timeline_handle;
+ args.point = point;
+
+ ret = drmIoctl(fd, DRM_IOCTL_SYNCOBJ_BINARY_TO_TIMELINE, &args);
+
+ return ret;
+}
+
+drm_public int drmSyncobjTimelineToBinary(int fd, uint32_t binary_handle,
+ uint32_t timeline_handle,
+ uint64_t point,
+ uint32_t flags)
+{
+ struct drm_syncobj_transfer args;
+ int ret;
+
+ memclear(args);
+ args.binary_handle = binary_handle;
+ args.timeline_handle = timeline_handle;
+ args.point = point;
+ args.flags = flags;
+
+ ret = drmIoctl(fd, DRM_IOCTL_SYNCOBJ_TIMELINE_TO_BINARY, &args);
+
+ return ret;
+}
diff --git a/xf86drm.h b/xf86drm.h
index 49a40633..1b7d8a32 100644
--- a/xf86drm.h
+++ b/xf86drm.h
@@ -875,12 +875,20 @@ extern int drmSyncobjWait(int fd, uint32_t *handles, unsigned num_handles,
uint32_t *first_signaled);
extern int drmSyncobjReset(int fd, const uint32_t *handles, uint32_t handle_count);
extern int drmSyncobjSignal(int fd, const uint32_t *handles, uint32_t handle_count);
+extern int drmSyncobjTimelineSignal(int fd, const uint32_t *handles,
+ uint64_t *points, uint32_t handle_count);
extern int drmSyncobjTimelineWait(int fd, uint32_t *handles, uint64_t *points,
unsigned num_handles,
int64_t timeout_nsec, unsigned flags,
uint32_t *first_signaled);
extern int drmSyncobjQuery(int fd, uint32_t *handles, uint64_t *points,
uint32_t handle_count);
+extern int drmSyncobjBinaryToTimeline(int fd, uint32_t binary_handle,
+ uint32_t timeline_handle,
+ uint64_t point);
+extern int drmSyncobjTimelineToBinary(int fd, uint32_t binary_handle,
+ uint32_t timeline_handle,
+ uint64_t point, uint32_t flags);

#if defined(__cplusplus)