[PATCH i-g-t v4 19/26] intel_batchbuffer: use relocations for !ppgtt

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Fri Oct 16 11:31:54 UTC 2020


---
 lib/intel_batchbuffer.c | 33 +++++++++++++++++++++++++++------
 1 file changed, 27 insertions(+), 6 deletions(-)

diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c
index 0a57532f..cad81fa0 100644
--- a/lib/intel_batchbuffer.c
+++ b/lib/intel_batchbuffer.c
@@ -1274,6 +1274,18 @@ __intel_bb_create(int i915, uint32_t ctx, uint32_t size, bool do_relocs,
 
 	igt_assert(ibb);
 
+	ibb->uses_full_ppgtt = gem_uses_full_ppgtt(i915);
+
+	/*
+	 * If we don't have full ppgtt driver can change our addresses
+	 * so allocator is useless in this case. Just enforce relocations
+	 * for such gens and don't use allocator at all.
+	 */
+	if (!ibb->uses_full_ppgtt) {
+		do_relocs = true;
+		allocator_type = INTEL_ALLOCATOR_NONE;
+	}
+
 	if (!do_relocs)
 		ibb->allocator_handle = intel_allocator_open(i915, ctx, allocator_type);
 	else
@@ -1300,7 +1312,6 @@ __intel_bb_create(int i915, uint32_t ctx, uint32_t size, bool do_relocs,
 		ibb->supports_48b_address = true;
 
 	ibb->gtt_size = gtt_size;
-	ibb->uses_full_ppgtt = gem_uses_full_ppgtt(i915);
 
 	object = intel_bb_add_object(ibb, ibb->handle, ibb->size,
 				     INTEL_BUF_INVALID_ADDRESS, ibb->alignment,
@@ -1784,9 +1795,18 @@ intel_bb_add_object(struct intel_bb *ibb, uint32_t handle, uint64_t size,
 			}
 		}
 	} else {
-		igt_assert_f(object->offset == gen8_canonical_addr(offset),
-			     "(pid: %ld) handle: %u, offset not match: %" PRIx64 " <> %" PRIx64 "\n",
-			     (long) getpid(), handle, (uint64_t) object->offset, gen8_canonical_addr(offset));
+		/*
+		 * This assertion makes sense only when we have to be consistent
+		 * with underlying allocator. For relocations and when !ppgtt
+		 * we can expect addresses passed by the user can be moved
+		 * within the driver.
+		 */
+		if (ibb->allocator_type == INTEL_ALLOCATOR_SIMPLE)
+			igt_assert_f(object->offset == gen8_canonical_addr(offset),
+				     "(pid: %ld) handle: %u, offset not match: %" PRIx64 " <> %" PRIx64 "\n",
+				     (long) getpid(), handle,
+				     (uint64_t) object->offset,
+				     gen8_canonical_addr(offset));
 	}
 
 	object->offset = offset;
@@ -2169,11 +2189,12 @@ static void intel_bb_dump_execbuf(struct intel_bb *ibb,
 	int i, j;
 	uint64_t address;
 
-	igt_debug("[pid: %ld] execbuf batch len: %u, start offset: 0x%x, "
+	igt_debug("execbuf [pid: %ld, fd: %d, ctx: %u]\n",
+		  (long) getpid(), ibb->i915, ibb->ctx);
+	igt_debug("execbuf batch len: %u, start offset: 0x%x, "
 		  "DR1: 0x%x, DR4: 0x%x, "
 		  "num clip: %u, clipptr: 0x%llx, "
 		  "flags: 0x%llx, rsvd1: 0x%llx, rsvd2: 0x%llx\n",
-		  (long) getpid(),
 		  execbuf->batch_len, execbuf->batch_start_offset,
 		  execbuf->DR1, execbuf->DR4,
 		  execbuf->num_cliprects, execbuf->cliprects_ptr,
-- 
2.26.0



More information about the Intel-gfx-trybot mailing list