[PATCH i-g-t 3/4] NORELOX - gem_exec_gttfill - FIX 2

Andrzej Turko andrzej.turko at linux.intel.com
Mon Apr 26 11:57:56 UTC 2021


From: Andrzej Turko <andrzej.turko at intel.com>

Signed-off-by: Andrzej Turko <andrzej.turko at intel.com>
---
 tests/i915/gem_exec_gttfill.c | 56 +++++++++++++++++++----------------
 1 file changed, 30 insertions(+), 26 deletions(-)

diff --git a/tests/i915/gem_exec_gttfill.c b/tests/i915/gem_exec_gttfill.c
index 3041a5059..a82678856 100644
--- a/tests/i915/gem_exec_gttfill.c
+++ b/tests/i915/gem_exec_gttfill.c
@@ -99,36 +99,40 @@ static void submit(int fd, int gen,
 		reloc[0].target_handle = obj.handle;
 		reloc[1].target_handle = obj.handle;
 
-		obj.offset = __intel_allocator_alloc(ahnd, obj.handle,
-						     BATCH_SIZE,
-						     BATCH_ALIGNMENT,
-						     ALLOC_STRATEGY_HIGH_TO_LOW);
-		for (; obj.offset == -1; j = ((++j) == count ? 0 : j)) {
-			if (i != j)
-				intel_allocator_free(ahnd, batches[j].handle);
+		if (do_relocs) {
+			obj.offset = 0;
+		} else {
 			obj.offset = __intel_allocator_alloc(ahnd, obj.handle,
 							     BATCH_SIZE,
 							     BATCH_ALIGNMENT,
 							     ALLOC_STRATEGY_HIGH_TO_LOW);
-		}
-
-		reloc[0].presumed_offset = obj.offset;
-		reloc[1].presumed_offset = obj.offset;
-		address = obj.offset + reloc[0].delta;
-		value = obj.offset + reloc[1].delta;
-
-		if (gen >= 8) {
-			batch[1] = address;
-			batch[2] = address >> 32;
+			for (; obj.offset == -1; j = ((++j) == count ? 0 : j)) {
+				if (i != j)
+					intel_allocator_free(ahnd, batches[j].handle);
+				obj.offset = __intel_allocator_alloc(ahnd, obj.handle,
+								     BATCH_SIZE,
+								     BATCH_ALIGNMENT,
+								     ALLOC_STRATEGY_HIGH_TO_LOW);
+			}
 
-			batch[3] = value;
-			batch[4] = value >> 32;
-		} else if (gen >=4) {
-			batch[2] = address;
-			batch[3] = value;
-		} else {
-			batch[1] = address;
-			batch[3] = value;
+			reloc[0].presumed_offset = obj.offset;
+			reloc[1].presumed_offset = obj.offset;
+			address = obj.offset + reloc[0].delta;
+			value = obj.offset + reloc[1].delta;
+
+			if (gen >= 8) {
+				batch[1] = address;
+				batch[2] = address >> 32;
+
+				batch[3] = value;
+				batch[4] = value >> 32;
+			} else if (gen >=4) {
+				batch[2] = address;
+				batch[3] = value;
+			} else {
+				batch[1] = address;
+				batch[3] = value;
+			}
 		}
 
 		memcpy(batches[i].ptr + eb->batch_start_offset,
@@ -152,7 +156,7 @@ static void fillgtt(int fd, unsigned ring, int timeout)
 	unsigned nengine;
 	unsigned count;
 	uint64_t size, ahnd;
-	bool do_relocs = !gem_uses_ppgtt(fd);
+	bool do_relocs = gem_has_relocations(fd);
 
 	shared = mmap(NULL, 4096, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
 	igt_assert(shared != MAP_FAILED);
-- 
2.25.1



More information about the Intel-gfx-trybot mailing list