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

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

tests/i915/gem_exec_reloc.c | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/tests/i915/gem_exec_reloc.c b/tests/i915/gem_exec_reloc.c
index fdd9661d15ad..541279ef5243 100644
--- a/tests/i915/gem_exec_reloc.c
+++ b/tests/i915/gem_exec_reloc.c
@@ -246,7 +246,7 @@ static void check_bo(int fd, uint32_t handle)
munmap(map, 4096);
}

-static void active(int fd, unsigned engine)
+static void active(int fd, const struct intel_execution_engine2 *e)
{
const int gen = intel_gen(intel_get_drm_devid(fd));
struct drm_i915_gem_relocation_entry reloc;
@@ -257,15 +257,15 @@ static void active(int fd, unsigned engine)
int pass;

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

@@ -654,6 +654,7 @@ static void basic_softpin(int fd)

igt_main
{
+ const struct intel_execution_engine2 *e;
const struct mode {
const char *name;
unsigned before, after;
@@ -750,12 +751,12 @@ igt_main
from_gpu(fd);

igt_subtest("active")
- active(fd, ALL_ENGINES);
- for (const struct intel_execution_engine *e = intel_execution_engines;
- e->name; e++) {
+ active(fd, NULL);
+
+ __for_each_physical_engine(fd, e)
igt_subtest_f("active-%s", e->name)
- active(fd, e->exec_id | e->flags);
- }
+ active(fd, e);
+
igt_fixture
close(fd);