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

Ramalingam C ramalingam.c at intel.com
Fri Jun 21 10:03:34 UTC 2019


Replace the legacy for_each_engine* defines with the ones
implemented in the gem_engine_topology library.

Signed-off-by: Ramalingam C <ramalingam.c at intel.com>
---
 tests/i915/gem_shrink.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/tests/i915/gem_shrink.c b/tests/i915/gem_shrink.c
index 037ff005b0f4..bca6fb88c6da 100644
--- a/tests/i915/gem_shrink.c
+++ b/tests/i915/gem_shrink.c
@@ -328,7 +328,7 @@ static void run_test(int nchildren, uint64_t alloc,
 	igt_waitchildren();
 }
 
-static void reclaim(unsigned engine, int timeout)
+static void reclaim(const struct intel_execution_engine2 *engine, int timeout)
 {
 	const uint64_t timeout_100ms = 100000000LL;
 	int fd = drm_open_driver(DRIVER_INTEL);
@@ -346,9 +346,9 @@ static void reclaim(unsigned engine, int timeout)
 		} while (!*shared);
 	}
 
-	spin = igt_spin_new(fd, .engine = engine);
+	spin = igt_spin_new(fd, .engine = engine->flags);
 	igt_until_timeout(timeout) {
-		igt_spin_t *next = __igt_spin_new(fd, .engine = engine);
+		igt_spin_t *next = __igt_spin_new(fd, .engine = engine->flags);
 
 		igt_spin_set_timeout(spin, timeout_100ms);
 		gem_sync(fd, spin->handle);
@@ -395,12 +395,12 @@ igt_main
 	};
 	uint64_t alloc_size = 0;
 	int num_processes = 0;
+	const struct intel_execution_engine2 *engine;
 
 	igt_skip_on_simulation();
 
 	igt_fixture {
 		uint64_t mem_size = intel_get_total_ram_mb();
-		unsigned int engine;
 		int fd;
 
 		fd = drm_open_driver(DRIVER_INTEL);
@@ -423,15 +423,21 @@ igt_main
 				     CHECK_SWAP | CHECK_RAM);
 
 		nengine = 0;
-		for_each_engine(fd, engine)
-			engines[nengine++] = engine;
+		__for_each_static_engine(engine)
+			engines[nengine++] = engine->flags;
 		igt_require(nengine);
 
 		close(fd);
 	}
 
-	igt_subtest("reclaim")
-		reclaim(I915_EXEC_DEFAULT, 2);
+	igt_subtest("reclaim") {
+		__for_each_static_engine(engine) {
+			if (engine->class == I915_ENGINE_CLASS_RENDER)
+				break;
+		}
+
+		reclaim(engine, 2);
+	}
 
 	for(const struct test *t = tests; t->name; t++) {
 		for(const struct mode *m = modes; m->suffix; m++) {
-- 
2.19.1



More information about the igt-dev mailing list