Could not open any dmaHeap device

Hello everyone,

I’m trying to run the YOLOv5 segmentation (but it happens with all models), but getting a hard time to find out why DMA is not allocated properly. Maybe you can see any incompatible or mismatching options in my configuration:

rpicam-hello -t 0 /usr/share/rpi-camera-assets/hailo_yolov5_segmentation.json --framerate 10

Could not open any dmaHeap device
[0:06:01.516314489] [2272]  INFO Camera camera_manager.cpp:327 libcamera v0.4.0+53-29156679
[0:06:01.523838797] [2277]  INFO RPI pisp.cpp:720 libpisp version v1.1.0 e7974a156008 27-01-2025 (21:50:51)
[0:06:01.546943270] [2277]  INFO RPI pisp.cpp:1179 Registered camera /base/axi/pcie@120000/rp1/i2c@80000/imx477@1a to CFE device /dev/media1 and ISP device /dev/media2 using PiSP variant BCM2712_D0
Made X/EGL preview window
Mode selection for 2028:1520:12:P(10)
    SRGGB10_CSI2P,1332x990/120.048 - Score: 3456.22
    SRGGB12_CSI2P,2028x1080/50.0275 - Score: 1083.84
    SRGGB12_CSI2P,2028x1520/40.0096 - Score: 0
    SRGGB12_CSI2P,4056x3040/10 - Score: 887
Stream configuration adjusted
[0:06:01.750460045] [2272]  INFO Camera camera.cpp:1202 configuring streams: (0) 2028x1520-YUV420 (1) 2028x1520-BGGR_PISP_COMP1
[0:06:01.750507159] [2277]  INFO RPI pisp.cpp:1484 Sensor: /base/axi/pcie@120000/rp1/i2c@80000/imx477@1a - Selected sensor format: 2028x1520-SBGGR12_1X12 - Selected CFE format: 2028x1520-PC1B
dmaHeap allocation failure for rpicam-apps0
ERROR: *** failed to allocate capture buffers for stream ***
grep -i cma /boot/config.txt
# It doesn't work either with : dtoverlay=vc4-kms-v3d,cma-256
dtoverlay=vc4-kms-v3d,cma-192

Here then it should report at least 192M

vcgencmd get_mem dma
dma=0M
vcgencmd get_mem gpu
gpu=8M

dmesg output from user cmd:

dmesg | grep -i dma
[    0.000000] OF: reserved mem: initialized node linux,cma, compatible id shared-dma-pool
[    0.000000]   DMA      [mem 0x0000000000000000-0x00000000ffffffff]
[    0.000000]   DMA32    empty
[    0.000000] On node 0, zone DMA: 512 pages in unavailable ranges
[    0.011567] DMA: preallocated 1024 KiB GFP_KERNEL pool for atomic allocations
[    0.011600] DMA: preallocated 1024 KiB GFP_KERNEL|GFP_DMA pool for atomic allocations
[    0.011633] DMA: preallocated 1024 KiB GFP_KERNEL|GFP_DMA32 pool for atomic allocations
[    0.035032] bcm2835-dma 1000010000.dma: DMA legacy API manager, dmachans=0x1
[    0.035279] iommu: DMA domain TLB invalidation policy: strict mode
[    0.559885] dw_axi_dmac_platform 1f00188000.dma: DesignWare AXI DMA Controller, 8 channels
[    0.627480] mmc0: SDHCI controller on 1000fff000.mmc [1000fff000.mmc] using ADMA 64-bit
[    0.778443] mmc1: SDHCI controller on 1001100000.mmc [1001100000.mmc] using ADMA 64-bit
[    2.085927] hailo 0000:01:00.0: Probing: Enabled 64 bit dma
[    2.085929] hailo 0000:01:00.0: Probing: Using userspace allocated vdma buffers

dmesg output from root (I don’t know why it is different from user)

dmesg | grep -i cma          
[    0.000000] Reserved memory: created CMA memory pool at 0x0000000002000000, size 192 MiB
[    0.000000] OF: reserved mem: initialized node linux,cma, compatible id shared-dma-pool
[    0.000000] OF: reserved mem: 0x0000000002000000..0x000000000dffffff (196608 KiB) map reusable linux,cma
[    0.000000] Memory: 16403584K/16769024K available (13504K kernel code, 2220K rwdata, 4320K rodata, 5120K init, 1216K bss, 168832K reserved, 196608K cma-reserved)

And I also tweaked the kernel command line parameters:

cat /boot/firmware/cmdline.txt
root=PARTUUID=5db7ea31-02 rootfstype=ext4 rootwait net.ifnames=0 logo.nologo console=tty1
modules-load=dwc2,g_ether cma=384M cma_debug=on

cat /etc/udev/rules.d/custom.rules  
SUBSYSTEM=="dma_heap", GROUP="video", MODE="0660"

My RPI 5 has 16 GB, this output is from inside X Window:

free -h
               total        used        free      shared  buff/cache   available
Mem:            15Gi       1.8Gi        12Gi       320Mi       1.5Gi        14Gi
Swap:             0B          0B          0B

Any help would be appreciated

Hernan

Hey @user144,

The rpicam app is a Raspberry Pi application, For more specialized help with this Raspberry Pi camera app issue, the Raspberry Pi forums would be the best place.

I will try to do these first :

The error dmaHeap allocation failure for rpicam-apps0 is coming from the Raspberry Pi camera application. You might want to try:

dtoverlay=vc4-kms-v3d,cma-384

If that setting (cma=384M) isn’t being applied correctly, you’ll need to add it to /boot/firmware/cmdline.txt.

Make sure, the ‘OS user’, you’re playing with, is in the group of the DMA devices!! (Group ‘video’ in my case below):

ubuntu@ubuntu-2404-pi5b:~$ ls -altr /dev/dma_heap/
total 0
drwxr-xr-x  2 root root      80 Dec 31  1969 .
crw-rw----  1 root video 252, 0 Mar 20 08:57 system
crw-rw----  1 root video 252, 1 Mar 20 08:57 linux,cma
drwxr-xr-x 19 root root   14780 Mar 20 08:57 ..
ubuntu@ubuntu-2404-pi5b:~$ id
uid=1000(ubuntu) gid=1001(ubuntu) groups=1001(ubuntu),4(adm),24(cdrom),27(sudo),30(dip),44(video),46(plugdev),100(users),113(lpadmin),123(sambashare),1000(lxd)
type or paste code here

I hope, this helps;-)
– Marco

Thank you. The permissions were correct, but only root had access to the camera. For future reference, it was only after I tested the udev rules that my user has now the required permissions to open the rpicam.

This is the command

sudo udevadm test /sys/class/dma_heap/system

That should not have been needed?! Not sure, what was going on on your system.

You did not be any chance keep the output from that udevadm command?