diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2016-10-13 22:44:08 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2016-10-13 22:47:47 +0100 |
commit | 7b349f32babd206a4cffcdc6b056e05c2a2f1ec9 (patch) | |
tree | 0bab03873cf426ff8ca1c21200f3a6c938390bca /lib/ioctl_wrappers.c | |
parent | dc27c73c7d0e146944fdb9bf680cd60eed503c99 (diff) |
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 <chris@chris-wilson.co.uk>
Diffstat (limited to 'lib/ioctl_wrappers.c')
-rw-r--r-- | lib/ioctl_wrappers.c | 16 |
1 files changed, 13 insertions, 3 deletions
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 |