[igt-dev] [PATCH i-g-t v8 08/17] lib/intel_batchbuffer: Reacquire offset for reloc allocator in reset path

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Fri Apr 28 06:22:15 UTC 2023


On reset path we recreate bo for batch (to avoid stalls) so we should
reacquire the offset too. At the moment simple allocator will return
same offset (so unfortunately we'll stall), but for reloc allocator
we'll get new one (so we avoid stall).

I've noticed this is missing during xe_intel_bb test, where on reloc
I noticed unexpected result (direct consequence of using same offset
which pointed to old batch, not new one).

Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
---
 lib/intel_batchbuffer.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c
index 7dbd6dd582..99b0b61585 100644
--- a/lib/intel_batchbuffer.c
+++ b/lib/intel_batchbuffer.c
@@ -1280,8 +1280,9 @@ void intel_bb_reset(struct intel_bb *ibb, bool purge_objects_cache)
 	gem_close(ibb->fd, ibb->handle);
 	ibb->handle = gem_create(ibb->fd, ibb->size);
 
-	/* Keep address for bb in reloc mode and RANDOM allocator */
-	if (ibb->allocator_type == INTEL_ALLOCATOR_SIMPLE)
+	/* Reacquire offset for RELOC and SIMPLE */
+	if (ibb->allocator_type == INTEL_ALLOCATOR_SIMPLE ||
+	    ibb->allocator_type == INTEL_ALLOCATOR_RELOC)
 		ibb->batch_offset = __intel_bb_get_offset(ibb,
 							  ibb->handle,
 							  ibb->size,
-- 
2.34.1



More information about the igt-dev mailing list