[PATCH i-g-t 03/57] lib/intel_allocator: Add helper for getting allocator handle

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Wed Jul 21 05:55:38 UTC 2021


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 3faae0330..c49ab595d 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.26.0



More information about the Intel-gfx-trybot mailing list