libdmabufheap: Introduce AllocSystem() API
The API selects the correct system heap variant depending on whether or
not CPU access of the allocated data is expected.
Bug: 154310076
Test: atest dmabufheap-unit-tests
Change-Id: Iff6c1f891c402998286816da81639163e063425f
diff --git a/BufferAllocatorWrapper.cpp b/BufferAllocatorWrapper.cpp
index a4ef981..6e2ebed 100644
--- a/BufferAllocatorWrapper.cpp
+++ b/BufferAllocatorWrapper.cpp
@@ -30,10 +30,16 @@
};
int DmabufHeapAlloc(BufferAllocator* buffer_allocator, const char* heap_name, size_t len,
- unsigned int heap_flags) {
+ unsigned int heap_flags, size_t legacy_align) {
if (!buffer_allocator)
return -EINVAL;
- return buffer_allocator->Alloc(heap_name, len, heap_flags);
+ return buffer_allocator->Alloc(heap_name, len, heap_flags, legacy_align);
+}
+
+int DmabufHeapAllocSystem(BufferAllocator* buffer_allocator, bool cpu_access, size_t len,
+ unsigned int heap_flags, size_t legacy_align) {
+ if (!buffer_allocator) return -EINVAL;
+ return buffer_allocator->AllocSystem(cpu_access, len, heap_flags, legacy_align);
}
int MapDmabufHeapNameToIonHeap(BufferAllocator* buffer_allocator, const char* heap_name,