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

Ramalingam C ramalingam.c at intel.com
Fri Jun 21 10:03:36 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_storedw_loop.c | 39 +++++++++++++++++------------------
 1 file changed, 19 insertions(+), 20 deletions(-)

diff --git a/tests/i915/gem_storedw_loop.c b/tests/i915/gem_storedw_loop.c
index b00555e0cb85..f7eb5a64169f 100644
--- a/tests/i915/gem_storedw_loop.c
+++ b/tests/i915/gem_storedw_loop.c
@@ -65,7 +65,7 @@ mmap_coherent(int fd, uint32_t handle, int size)
 }
 
 static void
-store_dword_loop(int fd, int ring, int divider)
+store_dword_loop(int fd, const struct intel_execution_engine2 *e, int divider)
 {
 	int i, val = 0;
 	struct drm_i915_gem_execbuffer2 execbuf;
@@ -107,7 +107,7 @@ store_dword_loop(int fd, int ring, int divider)
 	memset(&execbuf, 0, sizeof(execbuf));
 	execbuf.buffers_ptr = to_user_pointer(obj);
 	execbuf.buffer_count = 2;
-	execbuf.flags = ring;
+	execbuf.flags = e->flags;
 
 	igt_info("running storedw loop on render with stall every %i batch\n", divider);
 
@@ -143,32 +143,31 @@ store_dword_loop(int fd, int ring, int divider)
 }
 
 static void
-store_test(int fd, int ring)
+store_test(int fd, const struct intel_execution_engine2 *e)
 {
-	gem_require_ring(fd, ring);
-	store_dword_loop(fd, ring, 1);
-	store_dword_loop(fd, ring, 2);
+	gem_require_ring(fd, e->flags);
+	store_dword_loop(fd, e, 1);
+	store_dword_loop(fd, e, 2);
 	if (!igt_run_in_simulation()) {
-		store_dword_loop(fd, ring, 3);
-		store_dword_loop(fd, ring, 5);
-		store_dword_loop(fd, ring, 7);
-		store_dword_loop(fd, ring, 11);
-		store_dword_loop(fd, ring, 13);
-		store_dword_loop(fd, ring, 17);
-		store_dword_loop(fd, ring, 19);
+		store_dword_loop(fd, e, 3);
+		store_dword_loop(fd, e, 5);
+		store_dword_loop(fd, e, 7);
+		store_dword_loop(fd, e, 11);
+		store_dword_loop(fd, e, 13);
+		store_dword_loop(fd, e, 17);
+		store_dword_loop(fd, e, 19);
 	}
 }
 
 static void
-check_test_requirements(int fd, int ringid)
+check_test_requirements(int fd, const struct intel_execution_engine2 *e)
 {
-	gem_require_ring(fd, ringid);
-	igt_require(gem_can_store_dword(fd, ringid));
+	igt_require(gem_class_can_store_dword(fd, e->class));
 }
 
 igt_main
 {
-	const struct intel_execution_engine *e;
+	const struct intel_execution_engine2 *e;
 	int fd;
 
 	igt_fixture {
@@ -183,10 +182,10 @@ igt_main
 		igt_require(gem_uses_ppgtt(fd));
 	}
 
-	for (e = intel_execution_engines; e->name; e++) {
+	__for_each_physical_engine(fd, e) {
 		igt_subtest_f("store-%s", e->name) {
-			check_test_requirements(fd, e->exec_id);
-			store_test(fd, e->exec_id | e->flags);
+			check_test_requirements(fd, e);
+			store_test(fd, e);
 		}
 	}
 
-- 
2.19.1



More information about the igt-dev mailing list