[igt-dev] [PATCH i-g-t v31 39/40] tests/api_intel_allocator: Check alloc with strategy API
Zbigniew Kempczyński
zbigniew.kempczynski at intel.com
Mon Apr 12 10:31:46 UTC 2021
Verify strategy is properly handled in allocator alloc() call.
Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
Cc: Jason Ekstrand <jason at jlekstrand.net>
---
tests/i915/api_intel_allocator.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/tests/i915/api_intel_allocator.c b/tests/i915/api_intel_allocator.c
index 7ff92a174..182d9ba79 100644
--- a/tests/i915/api_intel_allocator.c
+++ b/tests/i915/api_intel_allocator.c
@@ -50,10 +50,19 @@ static void alloc_simple(int fd)
intel_allocator_get_address_range(ahnd, &start, &end);
offset0 = intel_allocator_alloc(ahnd, 1, end - start, 0);
- offset1 = __intel_allocator_alloc(ahnd, 2, 4096, 0);
+ offset1 = __intel_allocator_alloc(ahnd, 2, 4096, 0, ALLOC_STRATEGY_NONE);
igt_assert(offset1 == ALLOC_INVALID_ADDRESS);
intel_allocator_free(ahnd, 1);
+ offset0 = intel_allocator_alloc_with_strategy(ahnd, 1, 4096, 0,
+ ALLOC_STRATEGY_HIGH_TO_LOW);
+ offset1 = intel_allocator_alloc_with_strategy(ahnd, 2, 4096, 0,
+ ALLOC_STRATEGY_LOW_TO_HIGH);
+ igt_assert(offset0 > offset1);
+
+ intel_allocator_free(ahnd, 1);
+ intel_allocator_free(ahnd, 2);
+
igt_assert_eq(intel_allocator_close(ahnd), true);
}
--
2.26.0
More information about the igt-dev
mailing list