From 7b349f32babd206a4cffcdc6b056e05c2a2f1ec9 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Thu, 13 Oct 2016 22:44:08 +0100 Subject: igt/gem_ctx_param: Tidy error messages Avoid macro expansion inside the asserts so that the error messages are readable. Signed-off-by: Chris Wilson --- lib/ioctl_wrappers.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'lib/ioctl_wrappers.c') diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c index 110465e0..8632878f 100644 --- a/lib/ioctl_wrappers.c +++ b/lib/ioctl_wrappers.c @@ -871,6 +871,17 @@ void gem_context_destroy(int fd, uint32_t ctx_id) do_ioctl(fd, DRM_IOCTL_I915_GEM_CONTEXT_DESTROY, &destroy); } +int __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 (igt_ioctl(fd, LOCAL_IOCTL_I915_GEM_CONTEXT_GETPARAM, p)) + return -errno; + + errno = 0; + return 0; +} + /** * gem_context_get_param: * @fd: open i915 drm file descriptor @@ -883,11 +894,10 @@ void gem_context_destroy(int fd, uint32_t ctx_id) */ 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) - do_ioctl(fd, LOCAL_IOCTL_I915_GEM_CONTEXT_GETPARAM, p); + igt_assert(__gem_context_get_param(fd, p) == 0); } + int __gem_context_set_param(int fd, struct local_i915_gem_context_param *p) { #define LOCAL_I915_GEM_CONTEXT_SETPARAM 0x35 -- cgit v1.2.3