[PATCH i-g-t 42/46] WIP: tests/gem_exec_schedule at wide (ok) + reorder_wide (still to be fixed)

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Wed Jun 30 03:22:51 UTC 2021


---
 tests/i915/gem_exec_schedule.c | 39 ++++++++++++++++++++++++++++------
 1 file changed, 33 insertions(+), 6 deletions(-)

diff --git a/tests/i915/gem_exec_schedule.c b/tests/i915/gem_exec_schedule.c
index 66758dabb..bfb2c72e4 100644
--- a/tests/i915/gem_exec_schedule.c
+++ b/tests/i915/gem_exec_schedule.c
@@ -2021,8 +2021,8 @@ static void deep(int fd, unsigned ring)
 	int dep_nreq;
 	int n;
 
-#undef MAX_CONTEXTS
-#define MAX_CONTEXTS 32
+//#undef MAX_CONTEXTS
+//#define MAX_CONTEXTS 32
 
 	ctx = malloc(sizeof(*ctx) * MAX_CONTEXTS);
 	for (n = 0; n < MAX_CONTEXTS; n++) {
@@ -2247,12 +2247,14 @@ static void wide(int fd, unsigned ring)
 	uint32_t *ctx;
 	unsigned int count;
 	int fence;
+	uint64_t ahnd = get_reloc_ahnd(fd, 0), result_offset;
 
 	ctx = malloc(sizeof(*ctx)*MAX_CONTEXTS);
 	for (int n = 0; n < MAX_CONTEXTS; n++)
 		ctx[n] = gem_context_clone_with_engines(fd, 0);
 
 	result = gem_create(fd, 4*MAX_CONTEXTS);
+	result_offset = get_offset(ahnd, result, 4 * MAX_CONTEXTS, 0);
 
 	fence = igt_cork_plug(&cork, fd);
 
@@ -2261,14 +2263,15 @@ static void wide(int fd, unsigned ring)
 	     igt_seconds_elapsed(&tv) < 5 && count < ring_size;
 	     count++) {
 		for (int n = 0; n < MAX_CONTEXTS; n++) {
-			store_dword_fenced(fd, ctx[n], ring, result, 4*n, ctx[n],
+			store_dword_fenced2(fd, ahnd, ctx[n], ring,
+					    result, result_offset, 4*n, ctx[n],
 					   fence, I915_GEM_DOMAIN_INSTRUCTION);
 		}
 	}
 	igt_info("Submitted %d requests over %d contexts in %.1fms\n",
 		 count, MAX_CONTEXTS, igt_nsec_elapsed(&tv) * 1e-6);
 
-	unplug_show_queue(fd, &cork, ring);
+	unplug_show_queue2(fd, &cork, ring);
 	close(fence);
 
 	for (int n = 0; n < MAX_CONTEXTS; n++)
@@ -2280,6 +2283,7 @@ static void wide(int fd, unsigned ring)
 
 	gem_close(fd, result);
 	free(ctx);
+	put_ahnd(ahnd);
 }
 
 static void reorder_wide(int fd, unsigned ring)
@@ -2295,8 +2299,11 @@ static void reorder_wide(int fd, unsigned ring)
 	IGT_CORK_FENCE(cork);
 	uint32_t *expected;
 	int fence;
+	uint64_t ahnd = get_reloc_ahnd(fd, 0), result_offset;
+	unsigned int sz = ALIGN(ring_size * 64, 4096);
 
 	result = gem_create(fd, 4096);
+	result_offset = get_offset(ahnd, result, 4096, 0);
 	target = gem_create(fd, 4096);
 	fence = igt_cork_plug(&cork, fd);
 
@@ -2323,14 +2330,28 @@ static void reorder_wide(int fd, unsigned ring)
 	execbuf.flags |= I915_EXEC_FENCE_IN;
 	execbuf.rsvd2 = fence;
 
+	if (ahnd) {
+		obj[0].offset = result_offset;
+		obj[0].flags |= EXEC_OBJECT_PINNED;
+		obj[1].offset = get_offset(ahnd, obj[1].handle, sz, 0);
+		reloc.presumed_offset = obj[1].offset;
+		obj[1].flags |= EXEC_OBJECT_PINNED;
+		obj[1].relocation_count = 0;
+	}
+
+	igt_info("Presumed offset: %llx\n", reloc.presumed_offset);
 	for (int n = 0, x = 1; n < ARRAY_SIZE(priorities); n++, x++) {
-		unsigned int sz = ALIGN(ring_size * 64, 4096);
 		uint32_t *batch;
 
 		execbuf.rsvd1 = gem_context_clone_with_engines(fd, 0);
 		gem_context_set_priority(fd, execbuf.rsvd1, priorities[n]);
 
 		obj[1].handle = gem_create(fd, sz);
+		//if (ahnd) {
+		//	obj[1].offset = get_offset(ahnd, obj[1].handle, sz, 0);
+		//	reloc.presumed_offset = obj[1].offset;
+		//}
+
 		batch = gem_mmap__device_coherent(fd, obj[1].handle, 0, sz, PROT_WRITE);
 		gem_set_domain(fd, obj[1].handle, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
 
@@ -2344,6 +2365,8 @@ static void reorder_wide(int fd, unsigned ring)
 			reloc.delta = idx * sizeof(uint32_t);
 			addr = reloc.presumed_offset + reloc.delta;
 
+			igt_info("Addr: %llx\n", addr);
+
 			i = execbuf.batch_start_offset / sizeof(uint32_t);
 			batch[i] = MI_STORE_DWORD_IMM | (gen < 6 ? 1 << 22 : 0);
 			if (gen >= 8) {
@@ -2364,6 +2387,10 @@ static void reorder_wide(int fd, unsigned ring)
 				expected[idx] =  x;
 
 			gem_execbuf(fd, &execbuf);
+			igt_info("ctx[%u] obj[0].offset: %llx, handle: %u\n", (uint32_t) execbuf.rsvd1,
+				 obj[0].offset, obj[0].handle);
+			igt_info("ctx[%u] obj[1].offset: %llx, handle: %u\n", (uint32_t) execbuf.rsvd1,
+				 obj[1].offset, obj[1].handle);
 		}
 
 		munmap(batch, sz);
@@ -2371,7 +2398,7 @@ static void reorder_wide(int fd, unsigned ring)
 		gem_context_destroy(fd, execbuf.rsvd1);
 	}
 
-	unplug_show_queue(fd, &cork, ring);
+	unplug_show_queue2(fd, &cork, ring);
 	close(fence);
 
 	__sync_read_u32_count(fd, result, result_read, sizeof(result_read));
-- 
2.26.0



More information about the Intel-gfx-trybot mailing list