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

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

tests/i915/gem_exec_gttfill.c | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/tests/i915/gem_exec_gttfill.c b/tests/i915/gem_exec_gttfill.c
index efd612bb61c4..6140d36260f7 100644
--- a/tests/i915/gem_exec_gttfill.c
+++ b/tests/i915/gem_exec_gttfill.c
@@ -104,16 +104,16 @@ static void submit(int fd, int gen,
gem_sync(fd, obj.handle);
}

-static void fillgtt(int fd, unsigned ring, int timeout)
+static void fillgtt(int fd, const struct intel_execution_engine2 *e,
+ int timeout)
{
const int gen = intel_gen(intel_get_drm_devid(fd));
struct drm_i915_gem_execbuffer2 execbuf;
struct drm_i915_gem_relocation_entry reloc[2];
volatile uint64_t *shared;
struct batch *batches;
- unsigned engines[16];
- unsigned nengine;
- unsigned engine;
+ unsigned nengine, engines[16];
+ const struct intel_execution_engine2 *other;
uint64_t size;
unsigned count;

@@ -121,18 +121,18 @@ static void fillgtt(int fd, unsigned ring, int timeout)
igt_assert(shared != MAP_FAILED);

nengine = 0;
- if (ring == 0) {
- for_each_physical_engine(fd, engine) {
- if (!gem_can_store_dword(fd, engine))
+ if (!e) {
+ __for_each_physical_engine(fd, other) {
+ if (!gem_class_can_store_dword(fd, other->class))
continue;

- engines[nengine++] = engine;
+ engines[nengine++] = other->flags;
}
} else {
- gem_require_ring(fd, ring);
- igt_require(gem_can_store_dword(fd, ring));
+ gem_require_ring(fd, e->flags);
+ igt_require(gem_class_can_store_dword(fd, e->class));

- engines[nengine++] = ring;
+ engines[nengine++] = e->flags;
}
igt_require(nengine);

@@ -207,7 +207,7 @@ static void fillgtt(int fd, unsigned ring, int timeout)

igt_main
{
- const struct intel_execution_engine *e;
+ const struct intel_execution_engine2 *e;
int device = -1;

igt_skip_on_simulation();
@@ -222,12 +222,12 @@ igt_main
igt_subtest("basic")
fillgtt(device, 0, 1); /* just enough to run a single pass */

- for (e = intel_execution_engines; e->name; e++)
+ __for_each_physical_engine(device, e)
igt_subtest_f("%s", e->name)
- fillgtt(device, e->exec_id | e->flags, 20);
+ fillgtt(device, e, 20);

igt_subtest("all")
- fillgtt(device, 0, 150);
+ fillgtt(device, NULL, 150);

igt_fixture {
igt_stop_hang_detector();