64MP Memory Issues & Resolution

  1. Where did you get the camera module(s)?
    Directly from Arducam

  2. Model number of the product(s)?
    64MP-AF

  3. What hardware/platform were you working on?
    Raspberry Pi 4 B w/ 8GB RAM

  4. Instructions you have followed. (link/manual/etc.)
    Regular guide. I’ve also followed some forum posts.

  5. Problems you were having?
    ** libcamera-still -t 5000 -o 65mp.jpg does not work but libcamera-still -t 5000 -o 65mp.jpg --width 4000 --height 4000 DOES work. I cannot capture images at the full resolution. Oddly, an equivalent pixel count size such as libcamera-still -t 5000 -o 65mp.jpg --width 8000 --height 2000 does NOT work despite being 16 Million px**

  6. The dmesg log from your hardware?

[   62.931371] CPU: 0 PID: 1097 Comm: libcamera-jpeg Tainted: G         C O      5.15.32-v8+ #1538
[   62.931376] Hardware name: Raspberry Pi 4 Model B Rev 1.5 (DT)
[   62.931380] pstate: 20000005 (nzCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[   62.931385] pc : __alloc_pages+0x2d0/0x330
[   62.931390] lr : __dma_direct_alloc_pages+0x168/0x1b0
[   62.931396] sp : ffffffc00a513880
[   62.931398] x29: ffffffc00a513880 x28: ffffff8104105c60 x27: ffffffc00a513b58
[   62.931406] x26: 0000000000000001 x25: ffffffc008115144 x24: 0000000000000000
[   62.931413] x23: 0000000004bde000 x22: 0000000000000cc1 x21: ffffffc008e8a9c8
[   62.931420] x20: ffffff81001f8810 x19: ffffffc008e8a9c8 x18: 0000000000000001
[   62.931426] x17: 72202c7365676170 x16: 203232343931203a x15: 657a69732d716572
[   62.931433] x14: 202c64656c696166 x13: 32312d203a746572 x12: ffffffc0093a6670
[   62.931439] x11: 0000000000000003 x10: ffffffc00938e630 x9 : ffffffc008115788
[   62.931446] x8 : 0000000000017fe8 x7 : c0000000ffffefff x6 : ffffff81fef75908
[   62.931452] x5 : 0000000000000001 x4 : 000000000000003f x3 : 0000000000000000
[   62.931459] x2 : 0000000000000000 x1 : 000000000000000f x0 : 0000000000000cc1
[   62.931466] Call trace:
[   62.931468]  __alloc_pages+0x2d0/0x330
[   62.931473]  __dma_direct_alloc_pages+0x168/0x1b0
[   62.931478]  dma_direct_alloc+0x7c/0x330
[   62.931482]  dma_alloc_attrs+0xac/0xc0
[   62.931486]  vb2_dc_alloc+0x70/0x130 [videobuf2_dma_contig]
[   62.931497]  __vb2_queue_alloc+0x220/0x488 [videobuf2_common]
[   62.931510]  vb2_core_reqbufs+0x288/0x480 [videobuf2_common]
[   62.931520]  vb2_ioctl_reqbufs+0x8c/0xc8 [videobuf2_v4l2]
[   62.931529]  v4l_reqbufs+0x54/0x68 [videodev]
[   62.931564]  __video_do_ioctl+0x188/0x410 [videodev]
[   62.931588]  video_usercopy+0x310/0x7d0 [videodev]
[   62.931613]  video_ioctl2+0x20/0x38 [videodev]
[   62.931637]  v4l2_ioctl+0x48/0x68 [videodev]
[   62.931662]  __arm64_sys_ioctl+0xb0/0xf0
[   62.931668]  invoke_syscall+0x4c/0x110
[   62.931673]  el0_svc_common.constprop.3+0xfc/0x120
[   62.931678]  do_el0_svc+0x2c/0x90
[   62.931682]  el0_svc+0x24/0x60
[   62.931688]  el0t_64_sync_handler+0x90/0xb8
[   62.931693]  el0t_64_sync+0x1a0/0x1a4
[   62.931697] ---[ end trace 0069abc6c3105d09 ]---
[   62.931704] unicam fe801000.csi: dma_alloc_coherent of size 79552512 failed
[  137.269691] cma: cma_alloc: reserved: alloc failed, req-size: 19422 pages, ret: -12
[  137.269731] unicam fe801000.csi: dma_alloc_coherent of size 79552512 failed
[  147.615915] v3d fec00000.v3d: MMU error from client CLE (4) at 0x1fc1000, pte invalid
[  256.563851] cma: cma_alloc: reserved: alloc failed, req-size: 19422 pages, ret: -12
[  256.563891] unicam fe801000.csi: dma_alloc_coherent of size 79552512 failed
[  332.062060] cma: cma_alloc: reserved: alloc failed, req-size: 19422 pages, ret: -12
[  332.062104] unicam fe801000.csi: dma_alloc_coherent of size 79552512 failed
[  342.610650] cma: cma_alloc: reserved: alloc failed, req-size: 19422 pages, ret: -12
[  342.610693] unicam fe801000.csi: dma_alloc_coherent of size 79552512 failed
[  354.506365] cma: cma_alloc: reserved: alloc failed, req-size: 19422 pages, ret: -12
[  354.506407] unicam fe801000.csi: dma_alloc_coherent of size 79552512 failed
[  365.685443] cma: cma_alloc: reserved: alloc failed, req-size: 19422 pages, ret: -12
[  365.685482] unicam fe801000.csi: dma_alloc_coherent of size 79552512 failed
[  395.536415] cma: cma_alloc: reserved: alloc failed, req-size: 19422 pages, ret: -12
[  395.536457] unicam fe801000.csi: dma_alloc_coherent of size 79552512 failed
[  432.425927] cma: cma_alloc: reserved: alloc failed, req-size: 19422 pages, ret: -12
[  432.425965] unicam fe801000.csi: dma_alloc_coherent of size 79552512 failed

  1. Troubleshooting attempts you’ve made?
    Hard to count but pretty much all other forum posts

  2. What help do you need?
    Getting full res images off of the camera :slight_smile:

@aidanc

Maybe memory no assignment
cat /proc/meminfo

MemTotal:        7999964 kB
MemFree:         7380304 kB
MemAvailable:    7598524 kB
Buffers:           33824 kB
Cached:           296372 kB
SwapCached:            0 kB
Active:            92480 kB
Inactive:         393796 kB
Active(anon):       1040 kB
Inactive(anon):   179984 kB
Active(file):      91440 kB
Inactive(file):   213812 kB
Unevictable:       20900 kB
Mlocked:              16 kB
SwapTotal:        102396 kB
SwapFree:         102396 kB
Dirty:                 0 kB
Writeback:             0 kB
AnonPages:        177004 kB
Mapped:           134156 kB
Shmem:             24944 kB
KReclaimable:      26504 kB
Slab:              54184 kB
SReclaimable:      26504 kB
SUnreclaim:        27680 kB
KernelStack:        3808 kB
PageTables:         5420 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     4102376 kB
Committed_AS:    1076336 kB
VmallocTotal:   259653632 kB
VmallocUsed:       10728 kB
VmallocChunk:          0 kB
Percpu:              688 kB
CmaTotal:         409600 kB
CmaFree:          379276 kB

@Edward

Hi, @aidanc

You can try adding “dtoverlay=vc4-kms-v3d,cma-512” in the /boot/config.txt file.

hi @yang
I had tried that earlier

Solution!

CMA=512 in boot.txt (not CMA=400) AND disabling the desktop environment entirely ended up solving this issue for me.

So the takeaway for me is that the memory allocation, even between Pi’s of identical specs and fresh installs, is sorta a black-box.

Pls continue this thread if anyone has any questions - this bug KILLED me.