[igt-dev] [PATCH 2/2] lib/intel_batchbuffer: allow GTT size be not power of 2
Andrzej Hajda
andrzej.hajda at intel.com
Thu Oct 26 15:50:30 UTC 2023
GTT size reported by the driver can be shorter than
the actual size due to possible reserved addresses.
Rounding it up to power of 2 should give us back
actual GTT size.
The patch is prerequisite for upcoming driver changes
introducing per context batch buffers.
Signed-off-by: Andrzej Hajda <andrzej.hajda at intel.com>
---
lib/intel_batchbuffer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c
index df82ef5f5ca..c32d04302fe 100644
--- a/lib/intel_batchbuffer.c
+++ b/lib/intel_batchbuffer.c
@@ -1675,7 +1675,7 @@ __intel_bb_add_object(struct intel_bb *ibb, uint32_t handle, uint64_t size,
offset = __intel_bb_get_offset(ibb, handle, size,
alignment);
} else {
- offset = offset & (ibb->gtt_size - 1);
+ offset = offset & (roundup_power_of_two(ibb->gtt_size) - 1);
/*
* For simple allocator check entry consistency
--
2.34.1
More information about the igt-dev
mailing list