From 2baf7ece5b6d2faccedc56527ec91623f41a85e4 Mon Sep 17 00:00:00 2001 From: Antonio Argenziano Date: Tue, 6 Feb 2018 16:27:14 -0800 Subject: lib: Move __gem_context_create to common ioctl wrapper library. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch adds a context creation ioctl wrapper that returns the error for the caller to consume. Multiple tests that implemented this already, have been changed to use the new library function. v2: - Add gem_require_contexts() to check for contexts support (Chris) v3: - Add gem_has_contexts to check for contexts support and change gem_require_contexts to skip if contests support is not available. (Chris) v4: - Cosmetic changes and use lib function in gem_ctx_create where possible. (Michal) v5: - Use gem_contexts_require() in tests and fixtures. (Chris) Signed-off-by: Antonio Argenziano Cc: Chris Wilson Cc: Michał Winiarski Reviewed-by: Michał Winiarski Signed-off-by: Chris Wilson --- benchmarks/gem_exec_ctx.c | 6 +++--- benchmarks/gem_exec_trace.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'benchmarks') diff --git a/benchmarks/gem_exec_ctx.c b/benchmarks/gem_exec_ctx.c index 0eac04b0..a1c6e5d7 100644 --- a/benchmarks/gem_exec_ctx.c +++ b/benchmarks/gem_exec_ctx.c @@ -64,7 +64,7 @@ static uint32_t batch(int fd) return handle; } -static uint32_t __gem_context_create(int fd) +static uint32_t __gem_context_create_local(int fd) { struct drm_i915_gem_context_create create; @@ -101,7 +101,7 @@ static int loop(unsigned ring, execbuf.flags |= LOCAL_I915_EXEC_HANDLE_LUT; execbuf.flags |= LOCAL_I915_EXEC_NO_RELOC; if (mode != DEFAULT) { - execbuf.rsvd1 = __gem_context_create(fd); + execbuf.rsvd1 = __gem_context_create_local(fd); if (execbuf.rsvd1 == 0) return 77; } @@ -125,7 +125,7 @@ static int loop(unsigned ring, uint32_t ctx = 0; if (mode != DEFAULT && mode != NOP) { - execbuf.rsvd1 = __gem_context_create(fd); + execbuf.rsvd1 = __gem_context_create_local(fd); ctx = gem_context_create(fd); } diff --git a/benchmarks/gem_exec_trace.c b/benchmarks/gem_exec_trace.c index 12577649..2724ee92 100644 --- a/benchmarks/gem_exec_trace.c +++ b/benchmarks/gem_exec_trace.c @@ -105,7 +105,7 @@ static double elapsed(const struct timespec *start, const struct timespec *end) return 1e3*(end->tv_sec - start->tv_sec) + 1e-6*(end->tv_nsec - start->tv_nsec); } -static uint32_t __gem_context_create(int fd) +static uint32_t __gem_context_create_local(int fd) { struct drm_i915_gem_context_create arg = {}; drmIoctl(fd, DRM_IOCTL_I915_GEM_CONTEXT_CREATE, &arg); @@ -216,7 +216,7 @@ static double replay(const char *filename, long nop, long range) num_ctx = new_ctx; } - ctx[t->handle] = __gem_context_create(fd); + ctx[t->handle] = __gem_context_create_local(fd); break; } case DEL_CTX: -- cgit v1.2.3