[PATCH] libcamera: dma_heaps: Add support for using udmabuf to alloc DMA heaps

Bryan O'Donoghue bryan.odonoghue at linaro.org
Wed May 29 02:29:22 CEST 2024


On 27/05/2024 15:16, Hans de Goede wrote:
> +static constexpr std::array<DmaHeapInfo, 4> heapInfos = { {
> +	{ DmaHeap::DmaHeapFlag::Cma, "/dev/dma_heap/linux,cma", false },
> +	{ DmaHeap::DmaHeapFlag::Cma, "/dev/dma_heap/reserved", false },
> +	{ DmaHeap::DmaHeapFlag::System, "/dev/dma_heap/system", false },
> +	{ DmaHeap::DmaHeapFlag::System, "/dev/udmabuf", true },
>   } };

I have

deckard at x13s-linux:~/Development/linux$ ls /dev/udmabuf
/dev/udmabuf
deckard at x13s-linux:~/Development/linux$ ls /dev/d
disk/     dma_heap/ dri/
deckard at x13s-linux:~/Development/linux$ ls /dev/dma_heap/
linux,cma  system

LIBCAMERA_LOG_LEVELS=*:DEBUG ./build.master.dbg/src/apps/qcam/qcam

Gives

[0:15:09.128108059] [6874] DEBUG DmaHeap dma_heaps.cpp:112 Using 
/dev/dma_heap/linux,cma

I thought we said udmabuf should be default over cma_heap ?

At a risk of displaying a lack of knowledge, I tried forcing the flag to 
useUDmaBuf = true;

I get

Zero-copy enabled
[0:18:13.834305484] [7388] ERROR DmaHeap dma_heaps.cpp:201 UdmaHeap 
failed to allocate 15073280 bytes: Invalid argument
[0:18:13.834365480] [7388] ERROR SoftwareIsp software_isp.cpp:246 failed 
to allocate a dma_buf

Do I need to do something more than CONFIG_UDAMBUF=y ?

---
bod


More information about the libcamera-devel mailing list