[PATCH 03/27] libcamera: dma_buf_allocator: Favour udmabuf over cma heap allocations
Bryan O'Donoghue
bryan.odonoghue at linaro.org
Tue Apr 22 23:58:56 CEST 2025
When /dev/dma_heap/linux,cma or /dev/dma_heap/system exist currently we
favour allocation from this type of heap over /dev/udmabuf.
We ought to favour udmabuf though
- udmabuf is the preferred method by various distros for security reasons
- Contiguous memory is a scarce resource
Change the ordering of the allocator lookup so that the udmabuf lookup
comes first.
Fixes: ea4baaacc325 ("libcamera: DmaBufAllocator: Support allocating from /dev/udmabuf")
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue at linaro.org>
---
src/libcamera/dma_buf_allocator.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/libcamera/dma_buf_allocator.cpp b/src/libcamera/dma_buf_allocator.cpp
index d8c62dd6..722ffd46 100644
--- a/src/libcamera/dma_buf_allocator.cpp
+++ b/src/libcamera/dma_buf_allocator.cpp
@@ -45,10 +45,10 @@ static constexpr std::array<DmaBufAllocatorInfo, 4> providerInfos = { {
* /dev/dma_heap/linux,cma is the CMA dma-heap. When the cma heap size is
* specified on the kernel command line, this gets renamed to "reserved".
*/
+ { DmaBufAllocator::DmaBufAllocatorFlag::UDmaBuf, "/dev/udmabuf" },
{ DmaBufAllocator::DmaBufAllocatorFlag::CmaHeap, "/dev/dma_heap/linux,cma" },
{ DmaBufAllocator::DmaBufAllocatorFlag::CmaHeap, "/dev/dma_heap/reserved" },
{ DmaBufAllocator::DmaBufAllocatorFlag::SystemHeap, "/dev/dma_heap/system" },
- { DmaBufAllocator::DmaBufAllocatorFlag::UDmaBuf, "/dev/udmabuf" },
} };
LOG_DEFINE_CATEGORY(DmaBufAllocator)
--
2.49.0
More information about the libcamera-devel
mailing list