[igt-dev] [PATCH v24 11/14] test/i915: gem_exec_parallel: use the gem_engine_topology library

Andi Shyti andi.shyti at intel.com
Mon May 13 17:56:10 UTC 2019


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

Signed-off-by: Andi Shyti <andi.shyti at intel.com>
Cc: Chris Wilson <chris at chris-wilson.co.uk>
---
 tests/i915/gem_exec_parallel.c | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/tests/i915/gem_exec_parallel.c b/tests/i915/gem_exec_parallel.c
index 7597befb0b39..8a4482e52a6e 100644
--- a/tests/i915/gem_exec_parallel.c
+++ b/tests/i915/gem_exec_parallel.c
@@ -149,7 +149,7 @@ static void *thread(void *data)
 	return NULL;
 }
 
-static void all(int fd, unsigned engine, unsigned flags)
+static void all(int fd, struct intel_execution_engine2 *engine, unsigned flags)
 {
 	const int gen = intel_gen(intel_get_drm_devid(fd));
 	pthread_mutex_t mutex;
@@ -170,15 +170,15 @@ static void all(int fd, unsigned engine, unsigned flags)
 	}
 
 	nengine = 0;
-	if (engine == ALL_ENGINES) {
-		for_each_physical_engine(fd, engine) {
-			if (gem_can_store_dword(fd, engine))
-				engines[nengine++] = engine;
+	if (!engine) {
+		struct intel_execution_engine2 *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_class_can_store_dword(fd, engine->class));
+		engines[nengine++] = engine->flags;
 	}
 	igt_require(nengine);
 
@@ -229,6 +229,8 @@ static void all(int fd, unsigned engine, unsigned flags)
 
 igt_main
 {
+	struct intel_execution_engine2 *e;
+
 	const struct mode {
 		const char *name;
 		unsigned flags;
@@ -249,16 +251,16 @@ igt_main
 
 	for (const struct mode *m = modes; m->name; m++)
 		igt_subtest_f("%s", *m->name ? m->name : "basic")
-			all(fd, ALL_ENGINES, m->flags);
+			/* NULL value means all engines */
+			all(fd, NULL, m->flags);
 
-	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++)
 			igt_subtest_f("%s%s%s",
 				      e->name,
 				      *m->name ? "-" : "",
 				      m->name)
-				all(fd, e->exec_id | e->flags, m->flags);
+				all(fd, e, m->flags);
 	}
 
 	igt_fixture {
-- 
2.20.1



More information about the igt-dev mailing list