diff options
-rw-r--r-- | benchmarks/gem_blt.c | 8 | ||||
-rw-r--r-- | benchmarks/gem_create.c | 9 | ||||
-rw-r--r-- | benchmarks/gem_exec_ctx.c | 8 | ||||
-rw-r--r-- | benchmarks/gem_exec_nop.c | 8 | ||||
-rw-r--r-- | lib/ioctl_wrappers.c | 21 | ||||
-rw-r--r-- | lib/ioctl_wrappers.h | 1 | ||||
-rw-r--r-- | tests/gem_busy.c | 8 | ||||
-rw-r--r-- | tests/gem_eio.c | 8 | ||||
-rw-r--r-- | tests/gem_exec_alignment.c | 7 | ||||
-rw-r--r-- | tests/gem_exec_parse.c | 8 | ||||
-rw-r--r-- | tests/gem_fenced_exec_thrash.c | 12 | ||||
-rw-r--r-- | tests/gem_reset_stats.c | 16 | ||||
-rw-r--r-- | tests/gem_ring_sync_loop.c | 8 | ||||
-rw-r--r-- | tests/gem_ringfill.c | 8 | ||||
-rw-r--r-- | tests/gem_softpin.c | 8 | ||||
-rw-r--r-- | tests/gem_streaming_writes.c | 13 | ||||
-rw-r--r-- | tests/gem_sync.c | 8 |
17 files changed, 26 insertions, 133 deletions
diff --git a/benchmarks/gem_blt.c b/benchmarks/gem_blt.c index 820695c9..0d1c54d4 100644 --- a/benchmarks/gem_blt.c +++ b/benchmarks/gem_blt.c @@ -178,14 +178,6 @@ static int gem_linear_blt(int fd, return (b+2 - batch) * sizeof(uint32_t); } -static int __gem_execbuf(int fd, struct drm_i915_gem_execbuffer2 *execbuf) -{ - int err = 0; - if (drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, execbuf)) - err = -errno; - return err; -} - static int run(int object, int batch, int time, int reps) { struct drm_i915_gem_execbuffer2 execbuf; diff --git a/benchmarks/gem_create.c b/benchmarks/gem_create.c index 9ead30cf..d0634bbe 100644 --- a/benchmarks/gem_create.c +++ b/benchmarks/gem_create.c @@ -49,15 +49,6 @@ #define LOCAL_I915_EXEC_NO_RELOC (1<<11) #define LOCAL_I915_EXEC_HANDLE_LUT (1<<12) -static int __gem_execbuf(int fd, struct drm_i915_gem_execbuffer2 *execbuf) -{ - int err = 0; - if (drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, execbuf)) - err = -errno; - return err; -} - - static double elapsed(const struct timespec *start, const struct timespec *end) { diff --git a/benchmarks/gem_exec_ctx.c b/benchmarks/gem_exec_ctx.c index d84ca3b5..b859018e 100644 --- a/benchmarks/gem_exec_ctx.c +++ b/benchmarks/gem_exec_ctx.c @@ -56,14 +56,6 @@ static double elapsed(const struct timespec *start, return (end->tv_sec - start->tv_sec) + 1e-9*(end->tv_nsec - start->tv_nsec); } -static int __gem_execbuf(int fd, struct drm_i915_gem_execbuffer2 *execbuf) -{ - int err = 0; - if (drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, execbuf)) - err = -errno; - return err; -} - static uint32_t batch(int fd) { const uint32_t buf[] = {MI_BATCH_BUFFER_END}; diff --git a/benchmarks/gem_exec_nop.c b/benchmarks/gem_exec_nop.c index 8ea5a43c..2c39b9c3 100644 --- a/benchmarks/gem_exec_nop.c +++ b/benchmarks/gem_exec_nop.c @@ -55,14 +55,6 @@ static double elapsed(const struct timespec *start, return (end->tv_sec - start->tv_sec) + 1e-9*(end->tv_nsec - start->tv_nsec); } -static int __gem_execbuf(int fd, struct drm_i915_gem_execbuffer2 *execbuf) -{ - int err = 0; - if (drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, execbuf)) - err = -errno; - return err; -} - static uint32_t batch(int fd) { const uint32_t buf[] = {MI_BATCH_BUFFER_END}; diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c index 34351c95..bc6c490f 100644 --- a/lib/ioctl_wrappers.c +++ b/lib/ioctl_wrappers.c @@ -503,6 +503,22 @@ uint32_t gem_create(int fd, uint64_t size) } /** + * __gem_execbuf: + * @fd: open i915 drm file descriptor + * @execbuf: execbuffer data structure + * + * This wraps the EXECBUFFER2 ioctl, which submits a batchbuffer for the gpu to + * run. This is allowed to fail, with -errno returned. + */ +int __gem_execbuf(int fd, struct drm_i915_gem_execbuffer2 *execbuf) +{ + int err = 0; + if (drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, execbuf)) + err = -errno; + return err; +} + +/** * gem_execbuf: * @fd: open i915 drm file descriptor * @execbuf: execbuffer data structure @@ -512,10 +528,7 @@ uint32_t gem_create(int fd, uint64_t size) */ void gem_execbuf(int fd, struct drm_i915_gem_execbuffer2 *execbuf) { - int result; - - result = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, execbuf); - igt_assert(result == 0); + igt_assert_eq(__gem_execbuf(fd, execbuf), 0); errno = 0; } diff --git a/lib/ioctl_wrappers.h b/lib/ioctl_wrappers.h index 04ac9bb7..4d913c59 100644 --- a/lib/ioctl_wrappers.h +++ b/lib/ioctl_wrappers.h @@ -62,6 +62,7 @@ uint32_t gem_create_stolen(int fd, uint64_t size); uint32_t __gem_create(int fd, int size); uint32_t gem_create(int fd, uint64_t size); void gem_execbuf(int fd, struct drm_i915_gem_execbuffer2 *execbuf); +int __gem_execbuf(int fd, struct drm_i915_gem_execbuffer2 *execbuf); void *gem_mmap__gtt(int fd, uint32_t handle, uint64_t size, unsigned prot); void *gem_mmap__cpu(int fd, uint32_t handle, uint64_t offset, uint64_t size, unsigned prot); diff --git a/tests/gem_busy.c b/tests/gem_busy.c index 40b901be..d99806f4 100644 --- a/tests/gem_busy.c +++ b/tests/gem_busy.c @@ -122,14 +122,6 @@ static uint32_t busy_blt(int fd) return object[0].handle; } -static int __gem_execbuf(int fd, struct drm_i915_gem_execbuffer2 *eb) -{ - int err = 0; - if (drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, eb)) - err = -errno; - return err; -} - static bool exec_noop(int fd, uint32_t *handles, unsigned ring, diff --git a/tests/gem_eio.c b/tests/gem_eio.c index d2e4ed76..d209816c 100644 --- a/tests/gem_eio.c +++ b/tests/gem_eio.c @@ -112,14 +112,6 @@ static void test_throttle(int fd) trigger_reset(fd); } -static int __gem_execbuf(int fd, struct drm_i915_gem_execbuffer2 *eb) -{ - int err = 0; - if (drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, eb)) - err = -errno; - return err; -} - static void test_execbuf(int fd) { struct drm_i915_gem_execbuffer2 execbuf; diff --git a/tests/gem_exec_alignment.c b/tests/gem_exec_alignment.c index 397b4413..d975846e 100644 --- a/tests/gem_exec_alignment.c +++ b/tests/gem_exec_alignment.c @@ -40,11 +40,6 @@ IGT_TEST_DESCRIPTION("Exercises the basic execbuffer using object alignments"); -static int __gem_execbuf(int fd, struct drm_i915_gem_execbuffer2 *eb) -{ - return drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, eb); -} - static uint32_t find_last_bit(uint64_t x) { uint32_t i = 0; @@ -163,8 +158,8 @@ static void single(int fd) if (__gem_execbuf(fd, &execbuf)) { execobj.flags = 0; gtt_size = 1ull << 32; + gem_execbuf(fd, &execbuf); } - gem_execbuf(fd, &execbuf); execobj.alignment = 3*4096; non_pot = __gem_execbuf(fd, &execbuf) == 0; diff --git a/tests/gem_exec_parse.c b/tests/gem_exec_parse.c index 77903ab6..261d45fa 100644 --- a/tests/gem_exec_parse.c +++ b/tests/gem_exec_parse.c @@ -35,14 +35,6 @@ #define I915_PARAM_CMD_PARSER_VERSION 28 #endif -static int __gem_execbuf(int fd, struct drm_i915_gem_execbuffer2 *execbuf) -{ - if (drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, execbuf)) - return -errno; - - return 0; -} - static void exec_batch_patched(int fd, uint32_t cmd_bo, uint32_t *cmds, int size, int patch_offset, uint64_t expected_value) { diff --git a/tests/gem_fenced_exec_thrash.c b/tests/gem_fenced_exec_thrash.c index a74bc361..53ab7d05 100644 --- a/tests/gem_fenced_exec_thrash.c +++ b/tests/gem_fenced_exec_thrash.c @@ -141,14 +141,6 @@ static void fill_reloc(struct drm_i915_gem_relocation_entry *reloc, uint32_t han reloc->write_domain = 0; } -static int __gem_execbuf(int fd, struct drm_i915_gem_execbuffer2 *eb) -{ - int err = 0; - if (drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, eb)) - err = errno; - return err; -} - #define BUSY_LOAD (1 << 0) #define INTERRUPTIBLE (1 << 1) @@ -200,8 +192,8 @@ static void run_test(int fd, int num_fences, int expected_errno, if (flags & BUSY_LOAD) emit_dummy_load(); - igt_assert_eq(__gem_execbuf(fd, &execbuf[0]), expected_errno); - igt_assert_eq(__gem_execbuf(fd, &execbuf[1]), expected_errno); + igt_assert_eq(__gem_execbuf(fd, &execbuf[0]), -expected_errno); + igt_assert_eq(__gem_execbuf(fd, &execbuf[1]), -expected_errno); } while (--loop); if (flags & INTERRUPTIBLE) diff --git a/tests/gem_reset_stats.c b/tests/gem_reset_stats.c index 4cbbb4ee..1617cd36 100644 --- a/tests/gem_reset_stats.c +++ b/tests/gem_reset_stats.c @@ -136,20 +136,6 @@ static int gem_reset_status(int fd, int ctx_id) return RS_NO_ERROR; } -static int gem_exec(int fd, struct drm_i915_gem_execbuffer2 *execbuf) -{ - int ret; - - ret = ioctl(fd, - DRM_IOCTL_I915_GEM_EXECBUFFER2, - execbuf); - - if (ret < 0) - return -errno; - - return 0; -} - static int exec_valid_ring(int fd, int ctx, int ring) { struct drm_i915_gem_execbuffer2 execbuf; @@ -180,7 +166,7 @@ static int exec_valid_ring(int fd, int ctx, int ring) i915_execbuffer2_set_context_id(execbuf, ctx); execbuf.rsvd2 = 0; - ret = gem_exec(fd, &execbuf); + ret = __gem_execbuf(fd, &execbuf); if (ret < 0) return ret; diff --git a/tests/gem_ring_sync_loop.c b/tests/gem_ring_sync_loop.c index ca9f5687..52181951 100644 --- a/tests/gem_ring_sync_loop.c +++ b/tests/gem_ring_sync_loop.c @@ -35,14 +35,6 @@ IGT_TEST_DESCRIPTION("Basic check of ring<->ring write synchronisation."); * Extremely efficient at catching missed irqs with semaphores=0 ... */ -static int __gem_execbuf(int fd, struct drm_i915_gem_execbuffer2 *eb) -{ - int err = 0; - if (drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, eb)) - err = -errno; - return err; -} - static void sync_loop(int fd) { diff --git a/tests/gem_ringfill.c b/tests/gem_ringfill.c index 9236543d..a4ec7355 100644 --- a/tests/gem_ringfill.c +++ b/tests/gem_ringfill.c @@ -71,14 +71,6 @@ static void fill_ring(int fd, struct drm_i915_gem_execbuffer2 *execbuf) gem_execbuf(fd, execbuf); } -static int __gem_execbuf(int fd, struct drm_i915_gem_execbuffer2 *execbuf) -{ - int err = 0; - if (drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, execbuf)) - err = -errno; - return err; -} - #define INTERRUPTIBLE 0x1 #define HANG 0x2 #define CHILD 0x8 diff --git a/tests/gem_softpin.c b/tests/gem_softpin.c index bfd02b06..f9e88fd8 100644 --- a/tests/gem_softpin.c +++ b/tests/gem_softpin.c @@ -43,14 +43,6 @@ static uint64_t gen8_canonical_addr(uint64_t address) return (__s64)(address << shift) >> shift; } -static int __gem_execbuf(int fd, struct drm_i915_gem_execbuffer2 *eb) -{ - int err = 0; - if (drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, eb)) - err = -errno; - return err; -} - static void test_invalid(int fd) { const uint32_t bbe = MI_BATCH_BUFFER_END; diff --git a/tests/gem_streaming_writes.c b/tests/gem_streaming_writes.c index 0406aa62..24230040 100644 --- a/tests/gem_streaming_writes.c +++ b/tests/gem_streaming_writes.c @@ -51,11 +51,6 @@ IGT_TEST_DESCRIPTION("Test of streaming writes into active GPU sources"); -static bool __gem_execbuf(int fd, struct drm_i915_gem_execbuffer2 *eb) -{ - return drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, eb) == 0; -} - #define SRC 0 #define DST 1 #define BATCH 2 @@ -109,9 +104,9 @@ static void test_streaming(int fd, int mode, int sync) execbuf.buffers_ptr = (uintptr_t)exec; execbuf.buffer_count = 2; execbuf.flags = LOCAL_I915_EXEC_HANDLE_LUT; - if (!__gem_execbuf(fd, &execbuf)) { + if (__gem_execbuf(fd, &execbuf)) { execbuf.flags = 0; - igt_require(__gem_execbuf(fd, &execbuf)); + igt_require(__gem_execbuf(fd, &execbuf) == 0); } /* We assume that the active objects are fixed to avoid relocations */ __src_offset = src_offset; @@ -135,7 +130,7 @@ static void test_streaming(int fd, int mode, int sync) reloc[2*i+1].read_domains = I915_GEM_DOMAIN_RENDER; reloc[2*i+1].write_domain = 0; } - igt_assert(__gem_execbuf(fd, &execbuf)); + gem_execbuf(fd, &execbuf); igt_assert_eq_u64(__src_offset, src_offset); igt_assert_eq_u64(__dst_offset, dst_offset); @@ -304,7 +299,7 @@ static void test_batch(int fd, int mode, int reverse) execbuf.flags = LOCAL_I915_EXEC_HANDLE_LUT; if (gem_has_blt(fd)) execbuf.flags |= I915_EXEC_BLT; - if (!__gem_execbuf(fd, &execbuf)) { + if (__gem_execbuf(fd, &execbuf)) { execbuf.flags &= ~LOCAL_I915_EXEC_HANDLE_LUT; gem_execbuf(fd, &execbuf); } diff --git a/tests/gem_sync.c b/tests/gem_sync.c index 8b7490d7..8450bcd0 100644 --- a/tests/gem_sync.c +++ b/tests/gem_sync.c @@ -65,14 +65,6 @@ out: return ts.tv_sec + 1e-9*ts.tv_nsec; } -static int __gem_execbuf(int fd, struct drm_i915_gem_execbuffer2 *eb) -{ - int err = 0; - if (drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, eb)) - err = -errno; - return err; -} - static void sync_ring(int fd, int ring, unsigned flags) { |