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