[igt-dev] [PATCH i-g-t 1/3] lib/intel_batchbuffer: Use safe alignment for intel-bb

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Wed Mar 2 12:12:51 UTC 2022


Discrete cards can have different memory alignment requirements
when objects used in execbuffer comes from different memory regions.
Lets use safe alignment which should be fine regardless objects
location.

Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
Cc: Ashutosh Dixit <ashutosh.dixit at intel.com>
Cc: Kamil Konieczny <kamil.konieczny at linux.intel.com>
---
 lib/intel_batchbuffer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c
index ddb8d8c1fd..e50ab9055e 100644
--- a/lib/intel_batchbuffer.c
+++ b/lib/intel_batchbuffer.c
@@ -1370,7 +1370,7 @@ __intel_bb_create(int i915, uint32_t ctx, uint32_t size, bool do_relocs,
 	ibb->enforce_relocs = do_relocs;
 	ibb->handle = gem_create(i915, size);
 	ibb->size = size;
-	ibb->alignment = 4096;
+	ibb->alignment = gem_detect_safe_alignment(i915);
 	ibb->ctx = ctx;
 	ibb->vm_id = 0;
 	ibb->batch = calloc(1, size);
@@ -1927,7 +1927,7 @@ intel_bb_add_object(struct intel_bb *ibb, uint32_t handle, uint64_t size,
 		   || ALIGN(offset, alignment) == offset);
 
 	object = __add_to_cache(ibb, handle);
-	alignment = alignment ?: 4096;
+	alignment = max_t(uint64_t, alignment, gem_detect_safe_alignment(ibb->i915));
 	__add_to_objects(ibb, object);
 
 	/*
-- 
2.32.0



More information about the igt-dev mailing list