[igt-dev] [PATCH i-g-t 1/3] lib/syncobj: drop local declarations

Lionel Landwerlin lionel.g.landwerlin at intel.com
Fri Mar 8 15:46:07 UTC 2019


We have copies of the DRM uAPI headers in the repo, so drop the local
declaration of syncobj defines/types.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
---
 lib/igt_syncobj.c     | 16 ++++++------
 lib/igt_syncobj.h     | 26 +------------------
 tests/syncobj_basic.c |  2 +-
 tests/syncobj_wait.c  | 58 +++++++++++++++++++++----------------------
 4 files changed, 39 insertions(+), 63 deletions(-)

diff --git a/lib/igt_syncobj.c b/lib/igt_syncobj.c
index d9114ca8..6a419b07 100644
--- a/lib/igt_syncobj.c
+++ b/lib/igt_syncobj.c
@@ -170,10 +170,10 @@ syncobj_import_sync_file(int fd, uint32_t handle, int sync_file)
 }
 
 int
-__syncobj_wait(int fd, struct local_syncobj_wait *args)
+__syncobj_wait(int fd, struct drm_syncobj_wait *args)
 {
 	int err = 0;
-	if (drmIoctl(fd, LOCAL_IOCTL_SYNCOBJ_WAIT, args))
+	if (drmIoctl(fd, DRM_IOCTL_SYNCOBJ_WAIT, args))
 		err = -errno;
 	return err;
 }
@@ -182,7 +182,7 @@ int
 syncobj_wait_err(int fd, uint32_t *handles, uint32_t count,
 		 uint64_t abs_timeout_nsec, uint32_t flags)
 {
-	struct local_syncobj_wait wait;
+	struct drm_syncobj_wait wait;
 
 	wait.handles = to_user_pointer(handles);
 	wait.timeout_nsec = abs_timeout_nsec;
@@ -212,7 +212,7 @@ syncobj_wait(int fd, uint32_t *handles, uint32_t count,
 	     uint64_t abs_timeout_nsec, uint32_t flags,
 	     uint32_t *first_signaled)
 {
-	struct local_syncobj_wait wait;
+	struct drm_syncobj_wait wait;
 	int ret;
 
 	wait.handles = to_user_pointer(handles);
@@ -236,12 +236,12 @@ syncobj_wait(int fd, uint32_t *handles, uint32_t count,
 static int
 __syncobj_reset(int fd, uint32_t *handles, uint32_t count)
 {
-	struct local_syncobj_array array = { 0 };
+	struct drm_syncobj_array array = { 0 };
 	int err = 0;
 
 	array.handles = to_user_pointer(handles);
 	array.count_handles = count;
-	if (drmIoctl(fd, LOCAL_IOCTL_SYNCOBJ_RESET, &array))
+	if (drmIoctl(fd, DRM_IOCTL_SYNCOBJ_RESET, &array))
 		err = -errno;
 	return err;
 }
@@ -263,12 +263,12 @@ syncobj_reset(int fd, uint32_t *handles, uint32_t count)
 static int
 __syncobj_signal(int fd, uint32_t *handles, uint32_t count)
 {
-	struct local_syncobj_array array = { 0 };
+	struct drm_syncobj_array array = { 0 };
 	int err = 0;
 
 	array.handles = to_user_pointer(handles);
 	array.count_handles = count;
-	if (drmIoctl(fd, LOCAL_IOCTL_SYNCOBJ_SIGNAL, &array))
+	if (drmIoctl(fd, DRM_IOCTL_SYNCOBJ_SIGNAL, &array))
 		err = -errno;
 	return err;
 }
diff --git a/lib/igt_syncobj.h b/lib/igt_syncobj.h
index 44d1378d..51ad2364 100644
--- a/lib/igt_syncobj.h
+++ b/lib/igt_syncobj.h
@@ -28,30 +28,6 @@
 #include <stdbool.h>
 #include <drm.h>
 
-#define LOCAL_SYNCOBJ_CREATE_SIGNALED (1 << 0)
-
-#define LOCAL_SYNCOBJ_WAIT_FLAGS_WAIT_ALL (1 << 0)
-#define LOCAL_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT (1 << 1)
-struct local_syncobj_wait {
-       __u64 handles;
-       /* absolute timeout */
-       __s64 timeout_nsec;
-       __u32 count_handles;
-       __u32 flags;
-       __u32 first_signaled; /* only valid when not waiting all */
-       __u32 pad;
-};
-
-struct local_syncobj_array {
-       __u64 handles;
-       __u32 count_handles;
-       __u32 pad;
-};
-
-#define LOCAL_IOCTL_SYNCOBJ_WAIT	DRM_IOWR(0xC3, struct local_syncobj_wait)
-#define LOCAL_IOCTL_SYNCOBJ_RESET	DRM_IOWR(0xC4, struct local_syncobj_array)
-#define LOCAL_IOCTL_SYNCOBJ_SIGNAL	DRM_IOWR(0xC5, struct local_syncobj_array)
-
 uint32_t syncobj_create(int fd, uint32_t flags);
 void syncobj_destroy(int fd, uint32_t handle);
 int __syncobj_handle_to_fd(int fd, struct drm_syncobj_handle *args);
@@ -59,7 +35,7 @@ int __syncobj_fd_to_handle(int fd, struct drm_syncobj_handle *args);
 int syncobj_handle_to_fd(int fd, uint32_t handle, uint32_t flags);
 uint32_t syncobj_fd_to_handle(int fd, int syncobj_fd, uint32_t flags);
 void syncobj_import_sync_file(int fd, uint32_t handle, int sync_file);
-int __syncobj_wait(int fd, struct local_syncobj_wait *args);
+int __syncobj_wait(int fd, struct drm_syncobj_wait *args);
 int syncobj_wait_err(int fd, uint32_t *handles, uint32_t count,
 		     uint64_t abs_timeout_nsec, uint32_t flags);
 bool syncobj_wait(int fd, uint32_t *handles, uint32_t count,
diff --git a/tests/syncobj_basic.c b/tests/syncobj_basic.c
index 44769d3b..1dce45c9 100644
--- a/tests/syncobj_basic.c
+++ b/tests/syncobj_basic.c
@@ -149,7 +149,7 @@ test_bad_create_flags(int fd)
 static void
 test_create_signaled(int fd)
 {
-	uint32_t syncobj = syncobj_create(fd, LOCAL_SYNCOBJ_CREATE_SIGNALED);
+	uint32_t syncobj = syncobj_create(fd, DRM_SYNCOBJ_CREATE_SIGNALED);
 
 	igt_assert_eq(syncobj_wait_err(fd, &syncobj, 1, 0, 0), 0);
 
diff --git a/tests/syncobj_wait.c b/tests/syncobj_wait.c
index 04d79de7..669d0adf 100644
--- a/tests/syncobj_wait.c
+++ b/tests/syncobj_wait.c
@@ -140,7 +140,7 @@ syncobj_trigger_delayed(int fd, uint32_t syncobj, uint64_t nsec)
 static void
 test_wait_bad_flags(int fd)
 {
-	struct local_syncobj_wait wait = { 0 };
+	struct drm_syncobj_wait wait = { 0 };
 	wait.flags = 0xdeadbeef;
 	igt_assert_eq(__syncobj_wait(fd, &wait), -EINVAL);
 }
@@ -148,14 +148,14 @@ test_wait_bad_flags(int fd)
 static void
 test_wait_zero_handles(int fd)
 {
-	struct local_syncobj_wait wait = { 0 };
+	struct drm_syncobj_wait wait = { 0 };
 	igt_assert_eq(__syncobj_wait(fd, &wait), -EINVAL);
 }
 
 static void
 test_wait_illegal_handle(int fd)
 {
-	struct local_syncobj_wait wait = { 0 };
+	struct drm_syncobj_wait wait = { 0 };
 	uint32_t handle = 0;
 
 	wait.count_handles = 1;
@@ -166,43 +166,43 @@ test_wait_illegal_handle(int fd)
 static void
 test_reset_zero_handles(int fd)
 {
-	struct local_syncobj_array array = { 0 };
+	struct drm_syncobj_array array = { 0 };
 	int ret;
 
-	ret = drmIoctl(fd, LOCAL_IOCTL_SYNCOBJ_RESET, &array);
+	ret = drmIoctl(fd, DRM_IOCTL_SYNCOBJ_RESET, &array);
 	igt_assert(ret == -1 && errno ==  EINVAL);
 }
 
 static void
 test_reset_illegal_handle(int fd)
 {
-	struct local_syncobj_array array = { 0 };
+	struct drm_syncobj_array array = { 0 };
 	uint32_t handle = 0;
 	int ret;
 
 	array.count_handles = 1;
 	array.handles = to_user_pointer(&handle);
-	ret = drmIoctl(fd, LOCAL_IOCTL_SYNCOBJ_RESET, &array);
+	ret = drmIoctl(fd, DRM_IOCTL_SYNCOBJ_RESET, &array);
 	igt_assert(ret == -1 && errno == ENOENT);
 }
 
 static void
 test_reset_one_illegal_handle(int fd)
 {
-	struct local_syncobj_array array = { 0 };
+	struct drm_syncobj_array array = { 0 };
 	uint32_t syncobjs[3];
 	int ret;
 
-	syncobjs[0] = syncobj_create(fd, LOCAL_SYNCOBJ_CREATE_SIGNALED);
+	syncobjs[0] = syncobj_create(fd, DRM_SYNCOBJ_CREATE_SIGNALED);
 	syncobjs[1] = 0;
-	syncobjs[2] = syncobj_create(fd, LOCAL_SYNCOBJ_CREATE_SIGNALED);
+	syncobjs[2] = syncobj_create(fd, DRM_SYNCOBJ_CREATE_SIGNALED);
 
 	igt_assert_eq(syncobj_wait_err(fd, &syncobjs[0], 1, 0, 0), 0);
 	igt_assert_eq(syncobj_wait_err(fd, &syncobjs[2], 1, 0, 0), 0);
 
 	array.count_handles = 3;
 	array.handles = to_user_pointer(syncobjs);
-	ret = drmIoctl(fd, LOCAL_IOCTL_SYNCOBJ_RESET, &array);
+	ret = drmIoctl(fd, DRM_IOCTL_SYNCOBJ_RESET, &array);
 	igt_assert(ret == -1 && errno == ENOENT);
 
 	/* Assert that we didn't actually reset anything */
@@ -216,44 +216,44 @@ test_reset_one_illegal_handle(int fd)
 static void
 test_reset_bad_pad(int fd)
 {
-	struct local_syncobj_array array = { 0 };
+	struct drm_syncobj_array array = { 0 };
 	uint32_t handle = 0;
 	int ret;
 
 	array.pad = 0xdeadbeef;
 	array.count_handles = 1;
 	array.handles = to_user_pointer(&handle);
-	ret = drmIoctl(fd, LOCAL_IOCTL_SYNCOBJ_RESET, &array);
+	ret = drmIoctl(fd, DRM_IOCTL_SYNCOBJ_RESET, &array);
 	igt_assert(ret == -1 && errno == EINVAL);
 }
 
 static void
 test_signal_zero_handles(int fd)
 {
-	struct local_syncobj_array array = { 0 };
+	struct drm_syncobj_array array = { 0 };
 	int ret;
 
-	ret = drmIoctl(fd, LOCAL_IOCTL_SYNCOBJ_SIGNAL, &array);
+	ret = drmIoctl(fd, DRM_IOCTL_SYNCOBJ_SIGNAL, &array);
 	igt_assert(ret == -1 && errno == EINVAL);
 }
 
 static void
 test_signal_illegal_handle(int fd)
 {
-	struct local_syncobj_array array = { 0 };
+	struct drm_syncobj_array array = { 0 };
 	uint32_t handle = 0;
 	int ret;
 
 	array.count_handles = 1;
 	array.handles = to_user_pointer(&handle);
-	ret = drmIoctl(fd, LOCAL_IOCTL_SYNCOBJ_SIGNAL, &array);
+	ret = drmIoctl(fd, DRM_IOCTL_SYNCOBJ_SIGNAL, &array);
 	igt_assert(ret == -1 && errno == ENOENT);
 }
 
 static void
 test_signal_one_illegal_handle(int fd)
 {
-	struct local_syncobj_array array = { 0 };
+	struct drm_syncobj_array array = { 0 };
 	uint32_t syncobjs[3];
 	int ret;
 
@@ -266,7 +266,7 @@ test_signal_one_illegal_handle(int fd)
 
 	array.count_handles = 3;
 	array.handles = to_user_pointer(syncobjs);
-	ret = drmIoctl(fd, LOCAL_IOCTL_SYNCOBJ_SIGNAL, &array);
+	ret = drmIoctl(fd, DRM_IOCTL_SYNCOBJ_SIGNAL, &array);
 	igt_assert(ret == -1 && errno == ENOENT);
 
 	/* Assert that we didn't actually reset anything */
@@ -280,14 +280,14 @@ test_signal_one_illegal_handle(int fd)
 static void
 test_signal_bad_pad(int fd)
 {
-	struct local_syncobj_array array = { 0 };
+	struct drm_syncobj_array array = { 0 };
 	uint32_t handle = 0;
 	int ret;
 
 	array.pad = 0xdeadbeef;
 	array.count_handles = 1;
 	array.handles = to_user_pointer(&handle);
-	ret = drmIoctl(fd, LOCAL_IOCTL_SYNCOBJ_SIGNAL, &array);
+	ret = drmIoctl(fd, DRM_IOCTL_SYNCOBJ_SIGNAL, &array);
 	igt_assert(ret == -1 && errno ==  EINVAL);
 }
 
@@ -304,10 +304,10 @@ flags_for_test_flags(uint32_t test_flags)
 	uint32_t flags = 0;
 
 	if (test_flags & WAIT_FOR_SUBMIT)
-		flags |= LOCAL_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT;
+		flags |= DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT;
 
 	if (test_flags & WAIT_ALL)
-		flags |= LOCAL_SYNCOBJ_WAIT_FLAGS_WAIT_ALL;
+		flags |= DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL;
 
 	return flags;
 }
@@ -432,7 +432,7 @@ static void
 test_reset_during_wait_for_submit(int fd)
 {
 	uint32_t syncobj = syncobj_create(fd, 0);
-	uint32_t flags = LOCAL_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT;
+	uint32_t flags = DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT;
 	struct fd_handle_pair pair;
 	timer_t timer;
 
@@ -454,7 +454,7 @@ static void
 test_signal(int fd)
 {
 	uint32_t syncobj = syncobj_create(fd, 0);
-	uint32_t flags = LOCAL_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT;
+	uint32_t flags = DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT;
 
 	igt_assert_eq(syncobj_wait_err(fd, &syncobj, 1, 0, 0), -EINVAL);
 	igt_assert_eq(syncobj_wait_err(fd, &syncobj, 1, 0, flags), -ETIME);
@@ -511,7 +511,7 @@ test_multi_wait(int fd, uint32_t test_flags, int expect)
 
 struct wait_thread_data {
 	int fd;
-	struct local_syncobj_wait wait;
+	struct drm_syncobj_wait wait;
 };
 
 static void *
@@ -713,7 +713,7 @@ test_wait_complex(int fd, uint32_t test_flags)
 static void
 test_wait_interrupted(int fd, uint32_t test_flags)
 {
-	struct local_syncobj_wait wait = { 0 };
+	struct drm_syncobj_wait wait = { 0 };
 	uint32_t syncobj = syncobj_create(fd, 0);
 	int timeline;
 
@@ -740,7 +740,7 @@ test_wait_interrupted(int fd, uint32_t test_flags)
 static bool
 has_syncobj_wait(int fd)
 {
-	struct local_syncobj_wait wait = { 0 };
+	struct drm_syncobj_wait wait = { 0 };
 	uint32_t handle = 0;
 	uint64_t value;
 	int ret;
@@ -753,7 +753,7 @@ has_syncobj_wait(int fd)
 	/* Try waiting for zero sync objects should fail with EINVAL */
 	wait.count_handles = 1;
 	wait.handles = to_user_pointer(&handle);
-	ret = drmIoctl(fd, LOCAL_IOCTL_SYNCOBJ_WAIT, &wait);
+	ret = drmIoctl(fd, DRM_IOCTL_SYNCOBJ_WAIT, &wait);
 	return ret == -1 && errno == ENOENT;
 }
 
-- 
2.20.1



More information about the igt-dev mailing list