diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2020-03-31 15:47:56 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2020-04-03 12:57:54 +0100 |
commit | d8d0b2242f76e075086e2fd7d050f4260a90eaa3 (patch) | |
tree | 0660c1fc05de3c25288439de3f2b6a1489ab7dfb /tests/prime_busy.c | |
parent | d4d97a0027aa1284712a9d24466a14809d65d790 (diff) |
prime_busy: Dynamic active engine tests
Use igt_subtest_with_dynamic for the flexible approach to engine
dependent test discovery.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Acked-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Diffstat (limited to 'tests/prime_busy.c')
-rw-r--r-- | tests/prime_busy.c | 68 |
1 files changed, 27 insertions, 41 deletions
diff --git a/tests/prime_busy.c b/tests/prime_busy.c index 1e94805e..caab95a3 100644 --- a/tests/prime_busy.c +++ b/tests/prime_busy.c @@ -53,9 +53,6 @@ static void busy(int fd, unsigned ring, unsigned flags) uint32_t *batch, *bbe; int i, count, timeout; - if ((flags & HANG) == 0) - igt_require(gem_engine_has_mutable_submission(fd, ring)); - gem_quiescent_gpu(fd); memset(&execbuf, 0, sizeof(execbuf)); @@ -187,49 +184,35 @@ static void busy(int fd, unsigned ring, unsigned flags) close(pfd[SCRATCH].fd); } -static void test_engine_mode(int fd, - const struct intel_execution_engine *e, - const char *name, unsigned int flags) +static void test_mode(int fd, unsigned int flags) { + const struct intel_execution_engine2 *e; igt_hang_t hang = {}; - igt_subtest_group { - igt_fixture { - gem_require_ring(fd, eb_ring(e)); - igt_require(gem_can_store_dword(fd, eb_ring(e))); - - if ((flags & HANG) == 0) - { - igt_fork_hang_detector(fd); - } - else - { - hang = igt_allow_hang(fd, 0, 0); - } - } + if ((flags & HANG) == 0) + igt_fork_hang_detector(fd); + else + hang = igt_allow_hang(fd, 0, 0); - igt_subtest_f("%s%s-%s", - !e->exec_id && !(flags & HANG) ? "basic-" : "", - name, e->name) - busy(fd, eb_ring(e), flags); - - igt_subtest_f("%swait-%s-%s", - !e->exec_id && !(flags & HANG) ? "basic-" : "", - name, e->name) - busy(fd, eb_ring(e), flags | POLL); - - igt_fixture { - if ((flags & HANG) == 0) - igt_stop_hang_detector(); - else - igt_disallow_hang(fd, hang); - } + __for_each_physical_engine(fd, e) { + if (!gem_class_can_store_dword(fd, e->class)) + continue; + + if (!gem_class_has_mutable_submission(fd, e->class)) + continue; + + igt_dynamic_f("%s", e->name) + busy(fd, e->flags, flags); } + + if ((flags & HANG) == 0) + igt_stop_hang_detector(); + else + igt_disallow_hang(fd, hang); } igt_main { - const struct intel_execution_engine *e; int fd = -1; igt_fixture { @@ -245,15 +228,18 @@ igt_main { "before", BEFORE }, { "after", AFTER }, { "hang", BEFORE | HANG }, - { NULL }, + { }, }; igt_fixture gem_require_mmap_wc(fd); - for (e = intel_execution_engines; e->name; e++) { - for (const struct mode *m = modes; m->name; m++) - test_engine_mode(fd, e, m->name, m->flags); + for (const struct mode *m = modes; m->name; m++) { + igt_subtest_with_dynamic(m->name) + test_mode(fd, m->flags); + + igt_subtest_with_dynamic_f("%s-wait", m->name) + test_mode(fd, m->flags | POLL); } } |