[igt-dev] [RFC v2 27/43] tests/i915/gem_exec_whisper: use the gem_engine_topology library

Ramalingam C
2019-06-21T10:01:49Z

tests/i915/gem_exec_whisper.c | 29 +++++++++++++++--------------
1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/tests/i915/gem_exec_whisper.c b/tests/i915/gem_exec_whisper.c
index de7a14dad605..43998b49b773 100644
--- a/tests/i915/gem_exec_whisper.c
+++ b/tests/i915/gem_exec_whisper.c
@@ -166,7 +166,8 @@ static void ctx_set_random_priority(int fd, uint32_t ctx)
gem_context_set_priority(fd, ctx, prio);
}

-static void whisper(int fd, unsigned engine, unsigned flags)
+static void whisper(int fd, const struct intel_execution_engine2 *engine,
+ unsigned flags)
{
const uint32_t bbe = MI_BATCH_BUFFER_END;
const int gen = intel_gen(intel_get_drm_devid(fd));
@@ -202,16 +203,16 @@ static void whisper(int fd, unsigned engine, unsigned flags)
gpu_power_open(&power);

nengine = 0;
- if (engine == ALL_ENGINES) {
- for_each_physical_engine(fd, engine) {
- if (gem_can_store_dword(fd, engine))
- engines[nengine++] = engine;
+ if (!engine) {
+ __for_each_physical_engine(fd, engine) {
+ if (gem_class_can_store_dword(fd, engine->class))
+ engines[nengine++] = engine->flags;
}
} else {
igt_assert(!(flags & ALL));
- igt_require(gem_has_ring(fd, engine));
- igt_require(gem_can_store_dword(fd, engine));
- engines[nengine++] = engine;
+ igt_require(gem_has_ring(fd, engine->flags));
+ igt_require(gem_class_can_store_dword(fd, engine->class));
+ engines[nengine++] = engine->flags;
}
igt_require(nengine);

@@ -520,6 +521,7 @@ static void whisper(int fd, unsigned engine, unsigned flags)

igt_main
{
+ const struct intel_execution_engine2 *e;
const struct mode {
const char *name;
unsigned flags;
@@ -565,19 +567,18 @@ igt_main

for (const struct mode *m = modes; m->name; m++) {
igt_subtest_f("%s", m->name)
- whisper(fd, ALL_ENGINES, m->flags);
+ whisper(fd, NULL, m->flags);
igt_subtest_f("%s-all", m->name)
- whisper(fd, ALL_ENGINES, m->flags | ALL);
+ whisper(fd, NULL, m->flags | ALL);
}

- for (const struct intel_execution_engine *e = intel_execution_engines;
- e->name; e++) {
+ __for_each_physical_engine(fd, e) {
for (const struct mode *m = modes; m->name; m++) {
if (m->flags & CHAIN)
continue;

igt_subtest_f("%s-%s", e->name, m->name)
- whisper(fd, e->exec_id | e->flags, m->flags);
+ whisper(fd, e, m->flags);
}
}

@@ -590,7 +591,7 @@ igt_main
if (m->flags & INTERRUPTIBLE)
continue;
igt_subtest_f("hang-%s", m->name)
- whisper(fd, ALL_ENGINES, m->flags | HANG);
+ whisper(fd, NULL, m->flags | HANG);