From 3b75839b795c3e206316f4423b1f9ae01c91d64c Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Tue, 1 Dec 2015 13:33:13 +0000 Subject: [PATCH] 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 --- lib/ioctl_wrappers.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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; }