[i-g-t v2 05/12] lib/intel_allocator: Add helper for getting allocator handle

Bhanuprakash Modem bhanuprakash.modem at intel.com
Mon Jun 28 12:44:25 UTC 2021


From: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>

Allocator strategy for simple assigns offsets from the top to be
more malicious and exercise last bits in allocated offsets.

But for many cases we may want to create simple allocator with
allocating from the bottom of vm. Lets add some helper to do this
quickly in the code.

Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
---
 lib/intel_allocator.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lib/intel_allocator.h b/lib/intel_allocator.h
index 3faae0330c..c49ab595d1 100644
--- a/lib/intel_allocator.h
+++ b/lib/intel_allocator.h
@@ -236,6 +236,15 @@ static inline uint64_t get_simple_ahnd(int fd, uint32_t ctx)
 	return do_relocs ? 0 : intel_allocator_open(fd, ctx, INTEL_ALLOCATOR_SIMPLE);
 }
 
+static inline uint64_t get_simple_l2h_ahnd(int fd, uint32_t ctx)
+{
+	bool do_relocs = gem_has_relocations(fd);
+
+	return do_relocs ? 0 : intel_allocator_open_full(fd, ctx, 0, 0,
+							 INTEL_ALLOCATOR_SIMPLE,
+							 ALLOC_STRATEGY_LOW_TO_HIGH);
+}
+
 static inline uint64_t get_reloc_ahnd(int fd, uint32_t ctx)
 {
 	bool do_relocs = gem_has_relocations(fd);
-- 
2.20.1



More information about the Intel-gfx-trybot mailing list