diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2018-02-21 14:13:16 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2018-02-23 16:42:36 +0000 |
commit | 305ebcedc36e98f3118ac27a5bbde0ce7cd71a74 (patch) | |
tree | 3e392be546ac6e667b13ad6b494d724ab4822707 /tests/gem_exec_latency.c | |
parent | f9b6fd624be9692e9a892c0976fa72cedefc9fed (diff) |
Iterate over physical engines
We current have a single for_each_engine() iterator which we use to
generate both a set of uABI engines and a set of physical engines.
Determining what uABI ring-id corresponds to an actual HW engine is
tricky, so pull that out to a library function and introduce
for_each_physical_engine() for cases where we want to issue requests
once on each HW ring (avoiding aliasing issues).
v2: Remember can_store_dword for gem_sync
v3: Find more open-coded for_each_physical
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Diffstat (limited to 'tests/gem_exec_latency.c')
-rw-r--r-- | tests/gem_exec_latency.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/tests/gem_exec_latency.c b/tests/gem_exec_latency.c index 909dbbe6..f0e13419 100644 --- a/tests/gem_exec_latency.c +++ b/tests/gem_exec_latency.c @@ -202,13 +202,13 @@ static void latency_from_ring(int fd, unsigned ring, const char *name, unsigned flags) { - const struct intel_execution_engine *e; const int gen = intel_gen(intel_get_drm_devid(fd)); const int has_64bit_reloc = gen >= 8; struct drm_i915_gem_exec_object2 obj[3]; struct drm_i915_gem_relocation_entry reloc; struct drm_i915_gem_execbuffer2 execbuf; const unsigned int repeats = ring_size / 2; + unsigned int other; uint32_t *map, *results; uint32_t ctx[2] = {}; int i, j; @@ -254,22 +254,16 @@ static void latency_from_ring(int fd, reloc.presumed_offset = obj[1].offset; reloc.target_handle = flags & CORK ? 1 : 0; - for (e = intel_execution_engines; e->name; e++) { + for_each_physical_engine(fd, other) { igt_spin_t *spin = NULL; IGT_CORK_HANDLE(c); - if (e->exec_id == 0) - continue; - - if (!gem_has_ring(fd, e->exec_id | e->flags)) - continue; - gem_set_domain(fd, obj[2].handle, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT); if (flags & PREEMPT) - spin = igt_spin_batch_new(fd, ctx[0], ring, 0); + spin = __igt_spin_batch_new(fd, ctx[0], ring, 0); if (flags & CORK) { obj[0].handle = igt_cork_plug(&c, fd); @@ -306,7 +300,7 @@ static void latency_from_ring(int fd, gem_execbuf(fd, &execbuf); execbuf.flags &= ~ENGINE_FLAGS; - execbuf.flags |= e->exec_id | e->flags; + execbuf.flags |= other; execbuf.batch_start_offset = 64 * (j + repeats); reloc.offset = @@ -339,7 +333,8 @@ static void latency_from_ring(int fd, igt_spin_batch_free(fd, spin); igt_info("%s-%s delay: %.2f\n", - name, e->name, (results[2*repeats-1] - results[0]) / (double)repeats); + name, e__->name, + (results[2*repeats-1] - results[0]) / (double)repeats); } munmap(map, 64*1024); @@ -388,7 +383,7 @@ igt_main igt_subtest_group { igt_fixture { - gem_require_ring(device, e->exec_id | e->flags); + igt_require(gem_ring_has_physical_engine(device, e->exec_id | e->flags)); } igt_subtest_f("%s-dispatch", e->name) |