diff options
| author | Chris Wilson <chris@chris-wilson.co.uk> | 2016-01-23 09:44:19 +0000 |
|---|---|---|
| committer | Chris Wilson <chris@chris-wilson.co.uk> | 2016-01-27 14:45:18 +0000 |
| commit | e3b68bb66683ad4cb4c80df904a3a21c98a2b6c2 (patch) | |
| tree | 88a796e097456e3f1c3e8d821da1d91529626679 /tests | |
| parent | 711398e82af469394559105a4f4c6dc21f582ffe (diff) | |
lib: Share common __gem_execbuf()
An oft-repeated function to check EXECBUFFER2 for a particular fail
condition.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'tests')
| -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 |
11 files changed, 8 insertions, 96 deletions
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) { |
