summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2015-12-01 13:33:13 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2015-12-01 13:35:33 +0000
commit3b75839b795c3e206316f4423b1f9ae01c91d64c (patch)
tree798fee5cbdd554a4b756589b1179ce14d2dc51ec
parent4cfcea4056ab78a8097b41e26748c940936cd411 (diff)
lib: gem_set_caching() use drmIoctl() rather than ioctl()
gem_set_caching() tries to be clever and detect when the ioctl isn't supported (thereby skipping the test). However, it forget that we may be acting on active objects and be subject to the usual EAGAIN/EINTR errors. We can use the drmIoctl() to wrap the raw ioctl() in order to get the automatic restart on the interrupted syscall. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--lib/ioctl_wrappers.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
index ce5cc2c0..c24f7057 100644
--- a/lib/ioctl_wrappers.c
+++ b/lib/ioctl_wrappers.c
@@ -199,9 +199,10 @@ void gem_set_caching(int fd, uint32_t handle, uint32_t caching)
memset(&arg, 0, sizeof(arg));
arg.handle = handle;
arg.caching = caching;
- ret = ioctl(fd, LOCAL_DRM_IOCTL_I915_GEM_SET_CACHEING, &arg);
+ ret = drmIoctl(fd, LOCAL_DRM_IOCTL_I915_GEM_SET_CACHEING, &arg);
igt_assert(ret == 0 || (errno == ENOTTY || errno == EINVAL));
+
igt_require(ret == 0);
errno = 0;
}