[igt-dev] [PATCH i-g-t] lib/igt_dummyload: Use mapping selection to allow run batch from lmem

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Fri Dec 13 09:52:04 UTC 2019


For batches which need to be run from device memory there's a need to
use mmap offset interface to map the buffer.

Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
Cc: Chris Wilson <chris at chris-wilson.co.uk>
---
 lib/igt_dummyload.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/lib/igt_dummyload.c b/lib/igt_dummyload.c
index 32d4d8d3..b7f4caca 100644
--- a/lib/igt_dummyload.c
+++ b/lib/igt_dummyload.c
@@ -107,12 +107,8 @@ emit_recursive_batch(igt_spin_t *spin,
 	memset(relocs, 0, sizeof(relocs));
 
 	obj[BATCH].handle = gem_create(fd, BATCH_SIZE);
-	batch = __gem_mmap__wc(fd, obj[BATCH].handle,
-			       0, BATCH_SIZE, PROT_WRITE);
-	if (!batch)
-		batch = gem_mmap__gtt(fd, obj[BATCH].handle,
-				      BATCH_SIZE, PROT_WRITE);
-
+	batch = gem_mmap__device_coherent(fd, obj[BATCH].handle,
+					  0, BATCH_SIZE, PROT_WRITE);
 	gem_set_domain(fd, obj[BATCH].handle,
 		       I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
 	execbuf->buffer_count++;
@@ -152,9 +148,10 @@ emit_recursive_batch(igt_spin_t *spin,
 						   0, 4096,
 						   PROT_READ | PROT_WRITE);
 		else
-			spin->poll = gem_mmap__wc(fd, spin->poll_handle,
-						  0, 4096,
-						  PROT_READ | PROT_WRITE);
+			spin->poll = gem_mmap__device_coherent(fd,
+							       spin->poll_handle,
+							       0, 4096,
+							       PROT_READ | PROT_WRITE);
 
 		igt_assert_eq(spin->poll[SPIN_POLL_START_IDX], 0);
 
-- 
2.23.0



More information about the igt-dev mailing list