diff options
author | Lionel Landwerlin <lionel.g.landwerlin@intel.com> | 2019-11-22 15:02:51 +0200 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2019-11-23 22:26:47 +0000 |
commit | 20c6ad34cbb3ea96d316ed8e1169920a3f1ea911 (patch) | |
tree | 8b8cb08e056e263624a9ca1b569e0a455b31f616 /lib | |
parent | 360b11e511d98b6370134cff6e8ec3c434a65aee (diff) |
lib/syncobj: drop local declarations
We have copies of the DRM uAPI headers in the repo, so drop the local
declaration of syncobj defines/types.
v2: s/drmIoctl/igt_ioctl/ (Chris)
Clear errno after report it through return value (Chris)
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/igt_syncobj.c | 45 | ||||
-rw-r--r-- | lib/igt_syncobj.h | 26 |
2 files changed, 34 insertions, 37 deletions
diff --git a/lib/igt_syncobj.c b/lib/igt_syncobj.c index 0fddb97a..ad23faaf 100644 --- a/lib/igt_syncobj.c +++ b/lib/igt_syncobj.c @@ -43,8 +43,11 @@ __syncobj_create(int fd, uint32_t *handle, uint32_t flags) int err = 0; create.flags = flags; - if (drmIoctl(fd, DRM_IOCTL_SYNCOBJ_CREATE, &create)) + if (igt_ioctl(fd, DRM_IOCTL_SYNCOBJ_CREATE, &create)) { err = -errno; + igt_assume(err); + errno = 0; + } *handle = create.handle; return err; } @@ -74,8 +77,11 @@ __syncobj_destroy(int fd, uint32_t handle) int err = 0; destroy.handle = handle; - if (drmIoctl(fd, DRM_IOCTL_SYNCOBJ_DESTROY, &destroy)) + if (igt_ioctl(fd, DRM_IOCTL_SYNCOBJ_DESTROY, &destroy)) { err = -errno; + igt_assume(err); + errno = 0; + } return err; } @@ -95,8 +101,11 @@ int __syncobj_handle_to_fd(int fd, struct drm_syncobj_handle *args) { int err = 0; - if (drmIoctl(fd, DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD, args)) + if (igt_ioctl(fd, DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD, args)) { err = -errno; + igt_assume(err); + errno = 0; + } return err; } @@ -125,8 +134,11 @@ int __syncobj_fd_to_handle(int fd, struct drm_syncobj_handle *args) { int err = 0; - if (drmIoctl(fd, DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE, args)) + if (igt_ioctl(fd, DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE, args)) { err = -errno; + igt_assume(err); + errno = 0; + } return err; } @@ -170,11 +182,14 @@ 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 (igt_ioctl(fd, DRM_IOCTL_SYNCOBJ_WAIT, args)) { err = -errno; + igt_assume(err); + errno = 0; + } return err; } @@ -182,7 +197,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 +227,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,13 +251,16 @@ 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 (igt_ioctl(fd, DRM_IOCTL_SYNCOBJ_RESET, &array)) { err = -errno; + igt_assume(err); + errno = 0; + } return err; } @@ -263,13 +281,16 @@ 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 (igt_ioctl(fd, DRM_IOCTL_SYNCOBJ_SIGNAL, &array)) { err = -errno; + igt_assume(err); + errno = 0; + } 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, |