summaryrefslogtreecommitdiff
path: root/tests/gem_exec_async.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2018-02-21 14:13:16 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2018-02-23 16:42:36 +0000
commit305ebcedc36e98f3118ac27a5bbde0ce7cd71a74 (patch)
tree3e392be546ac6e667b13ad6b494d724ab4822707 /tests/gem_exec_async.c
parentf9b6fd624be9692e9a892c0976fa72cedefc9fed (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_async.c')
-rw-r--r--tests/gem_exec_async.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/tests/gem_exec_async.c b/tests/gem_exec_async.c
index 30e9452f..9a06af7e 100644
--- a/tests/gem_exec_async.c
+++ b/tests/gem_exec_async.c
@@ -88,6 +88,7 @@ static void one(int fd, unsigned ring, uint32_t flags)
#define BATCH 1
struct drm_i915_gem_relocation_entry reloc;
struct drm_i915_gem_execbuffer2 execbuf;
+ unsigned int other;
uint32_t *batch;
int i;
@@ -142,19 +143,14 @@ static void one(int fd, unsigned ring, uint32_t flags)
gem_close(fd, obj[BATCH].handle);
i = 0;
- for (const struct intel_execution_engine *e = intel_execution_engines;
- e->name; e++) {
- if (e->exec_id == 0 || e->exec_id == ring)
+ for_each_physical_engine(fd, other) {
+ if (other == ring)
continue;
- if (!gem_has_ring(fd, e->exec_id | e->flags))
+ if (!gem_can_store_dword(fd, other))
continue;
- if (!gem_can_store_dword(fd, e->exec_id | e->flags))
- continue;
-
- store_dword(fd, e->exec_id | e->flags,
- obj[SCRATCH].handle, 4*i, i);
+ store_dword(fd, other, obj[SCRATCH].handle, 4*i, i);
i++;
}
@@ -209,6 +205,7 @@ igt_main
continue;
igt_subtest_f("concurrent-writes-%s", e->name) {
+ igt_require(gem_ring_has_physical_engine(fd, e->exec_id | e->flags));
igt_require(gem_can_store_dword(fd, e->exec_id | e->flags));
one(fd, e->exec_id, e->flags);
}