[igt-dev] [PATCH i-g-t 2/2] tests/i915/api_intel_allocator: Fixed start offset

Dominik Karol Piatkowski dominik.karol.piatkowski at intel.com
Tue Dec 20 07:07:17 UTC 2022


It is safer to use intel_allocator_get_address_range than arbitrary
hardcoded start offset that may be too low.

Signed-off-by: Dominik Karol Piatkowski <dominik.karol.piatkowski at intel.com>
Cc: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
---
 tests/i915/api_intel_allocator.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/i915/api_intel_allocator.c b/tests/i915/api_intel_allocator.c
index 87abd900..e9039a21 100644
--- a/tests/i915/api_intel_allocator.c
+++ b/tests/i915/api_intel_allocator.c
@@ -96,9 +96,10 @@ static void reserve_simple(int fd)
 static void reserve(int fd, uint8_t type)
 {
 	struct test_obj obj;
-	uint64_t ahnd, offset = 0x40000, size = 0x1000;
+	uint64_t ahnd, offset, size = 0x1000;
 
 	ahnd = intel_allocator_open(fd, 0, type);
+	intel_allocator_get_address_range(ahnd, &offset, NULL);
 
 	igt_assert_eq(intel_allocator_reserve(ahnd, 0, size, offset), true);
 	/* try overlapping won't succeed */
-- 
2.34.1



More information about the igt-dev mailing list