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>
This commit is contained in:
Chris Wilson 2015-12-01 13:33:13 +00:00
parent 4cfcea4056
commit 3b75839b79

View File

@ -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;
}