[igt-dev] [PATCH i-g-t 5/6] tests/i915/gem_exec_schedule: Avoid cmdparser dependencies in deep()

Jason Ekstrand jason at jlekstrand.net
Sun Jul 11 03:52:03 UTC 2021


When we have a command parser which runs synchronously, it blocks until
the batch is idle.  For most userspace, this doesn't matter as they
never re-use a batch.  With IGT, this can be a problem because it means
we can't queue up multiple instances of the same batch.  The easy
solution is to create a new batch BO for each execbuf.

Signed-off-by: Jason Ekstrand <jason at jlekstrand.net>
---
 tests/i915/gem_exec_schedule.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/tests/i915/gem_exec_schedule.c b/tests/i915/gem_exec_schedule.c
index a75faeb68..ee7b10f7f 100644
--- a/tests/i915/gem_exec_schedule.c
+++ b/tests/i915/gem_exec_schedule.c
@@ -1891,7 +1891,6 @@ static void deep(int fd, const intel_ctx_cfg_t *cfg,
 		reloc.delta = sizeof(uint32_t) * n;
 		reloc.read_domains = I915_GEM_DOMAIN_RENDER;
 		reloc.write_domain = I915_GEM_DOMAIN_RENDER;
-		obj[2].handle = gem_create(fd, 4096);
 		obj[2].relocs_ptr = to_user_pointer(&reloc);
 		obj[2].relocation_count = 1;
 
@@ -1910,15 +1909,20 @@ static void deep(int fd, const intel_ctx_cfg_t *cfg,
 		}
 		batch[++i] = eb.rsvd1;
 		batch[++i] = MI_BATCH_BUFFER_END;
-		gem_write(fd, obj[2].handle, 0, batch, sizeof(batch));
 
 		gem_context_set_priority(fd, eb.rsvd1, MAX_PRIO - nreq + n);
 		for (int m = 0; m < XS; m++) {
 			obj[1].handle = dep[m];
 			reloc.target_handle = obj[1].handle;
+
+			/* Create a new batch BO every time so we don't end
+			 * up with extra dependencies
+			 */
+			obj[2].handle = gem_create(fd, 4096);
+			gem_write(fd, obj[2].handle, 0, batch, sizeof(batch));
 			gem_execbuf(fd, &eb);
+			gem_close(fd, obj[2].handle);
 		}
-		gem_close(fd, obj[2].handle);
 	}
 	igt_info("First deptree: %d requests [%.3fs]\n",
 		 n * XS, 1e-9*igt_nsec_elapsed(&tv));
-- 
2.31.1



More information about the igt-dev mailing list