[Intel-gfx] [PATCH i-g-t 05/17] lib/ioctls: make gem_context_set/get_param infallible

Daniel Vetter daniel.vetter at ffwll.ch
Tue Feb 10 10:05:48 PST 2015


We have separate require checks already, so these failing is a bug in
the test logic.

Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
---
 lib/igt_gt.c         |  2 +-
 lib/ioctl_wrappers.c | 18 +++++-------------
 lib/ioctl_wrappers.h |  4 ++--
 3 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/lib/igt_gt.c b/lib/igt_gt.c
index 615f9893b876..e02219acc6fd 100644
--- a/lib/igt_gt.c
+++ b/lib/igt_gt.c
@@ -55,7 +55,7 @@ struct igt_hang_ring igt_hang_ring(int fd, int gen, int ring)
 	ban = param.value;
 
 	param.value = 0;
-	igt_require(gem_context_set_param(fd, &param) == 0);
+	gem_context_set_param(fd, &param);
 
 	memset(&reloc, 0, sizeof(reloc));
 	memset(&exec, 0, sizeof(exec));
diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
index dd89e2c57e7f..c8c0e1c16f8b 100644
--- a/lib/ioctl_wrappers.c
+++ b/lib/ioctl_wrappers.c
@@ -1058,26 +1058,18 @@ off_t prime_get_size(int dma_buf_fd)
 	return ret;
 }
 
-int gem_context_get_param(int fd, struct local_i915_gem_context_param *p)
+void gem_context_get_param(int fd, struct local_i915_gem_context_param *p)
 {
 #define LOCAL_I915_GEM_CONTEXT_GETPARAM       0x34
 #define LOCAL_IOCTL_I915_GEM_CONTEXT_GETPARAM DRM_IOWR (DRM_COMMAND_BASE + LOCAL_I915_GEM_CONTEXT_GETPARAM, struct local_i915_gem_context_param)
-	if (drmIoctl(fd, LOCAL_IOCTL_I915_GEM_CONTEXT_GETPARAM, p))
-		return -1;
-
-	errno = 0;
-	return 0;
+	do_ioctl(fd, LOCAL_IOCTL_I915_GEM_CONTEXT_GETPARAM, p);
 }
 
-int gem_context_set_param(int fd, struct local_i915_gem_context_param *p)
+void gem_context_set_param(int fd, struct local_i915_gem_context_param *p)
 {
 #define LOCAL_I915_GEM_CONTEXT_SETPARAM       0x35
 #define LOCAL_IOCTL_I915_GEM_CONTEXT_SETPARAM DRM_IOWR (DRM_COMMAND_BASE + LOCAL_I915_GEM_CONTEXT_SETPARAM, struct local_i915_gem_context_param)
-	if (drmIoctl(fd, LOCAL_IOCTL_I915_GEM_CONTEXT_SETPARAM, p))
-		return -1;
-
-	errno = 0;
-	return 0;
+	do_ioctl(fd, LOCAL_IOCTL_I915_GEM_CONTEXT_SETPARAM, p);
 }
 
 void gem_context_require_param(int fd, uint64_t param)
@@ -1089,5 +1081,5 @@ void gem_context_require_param(int fd, uint64_t param)
 	p.value = 0;
 	p.size = 0;
 
-	igt_require(gem_context_get_param(fd, &p) == 0);
+	igt_require(drmIoctl(fd, LOCAL_I915_GEM_CONTEXT_GETPARAM, &p) == 0);
 }
diff --git a/lib/ioctl_wrappers.h b/lib/ioctl_wrappers.h
index 663b3da2ecd4..23b8c9d56e44 100644
--- a/lib/ioctl_wrappers.h
+++ b/lib/ioctl_wrappers.h
@@ -132,7 +132,7 @@ struct local_i915_gem_context_param {
 };
 
 void gem_context_require_param(int fd, uint64_t param);
-int gem_context_get_param(int fd, struct local_i915_gem_context_param *p);
-int gem_context_set_param(int fd, struct local_i915_gem_context_param *p);
+void gem_context_get_param(int fd, struct local_i915_gem_context_param *p);
+void gem_context_set_param(int fd, struct local_i915_gem_context_param *p);
 
 #endif /* IOCTL_WRAPPERS_H */
-- 
2.1.4



More information about the Intel-gfx mailing list