raspberrypi / rpicam-apps

BSD 2-Clause "Simplified" License
419 stars 228 forks source link

[BUG] Failed to allocate buffers #718

Closed Oxize closed 1 month ago

Oxize commented 2 months ago

Describe the bug Failed to allocate buffers

Bug report

[23:50:08.514187869] [4304] �[1;31mERROR �[1;37mV4L2 �[1;34mv4l2_videodevice.cpp:1241 �[0;32m/dev/video0[12:cap]: �[0mUnable to request 1 buffers: Cannot allocate memory ERROR: *** failed to allocate capture buffers **

Additional context Error generated within Allsky software. This error is rpi cam related which we cant solve. It has been adressed by alot more ppl in the past. Please pick it up again.

555

** Hardware

RPI 4B 8GB with HQ Camera. Cables good attached, no throtteling when it happens, no memory leakage, no overheating.

naushir commented 2 months ago

Please can you give more details on this. There could be several reasons for your error. What rpicam-apps command line are you running? Have you modified anything in config.txt or any other configuration file? Can you reproduce this error outside of the allsky software?

Oxize commented 2 months ago

It uses libcamerastill in CL. I dont have modified anything in config.txt. Looks to me standard file.

No i cannot reproduce this error outside allysky.

naushir commented 2 months ago

Do you know what the allsky application does in terms of memory (particularly CMA) allocations outside of the camera? It seems that it might be using up quite a bit of the memory available for the camera. This is the cause of your failures.

Can you run the following command:

grep -i cma /proc/meminfo

You should see 512MB total. Can you let me know the amount you have free?

dtoverlay=vc4-kms-v3d

naushir commented 1 month ago

Any update on this? If not I'll close shortly.

zanco commented 2 weeks ago

Hi, hope it's ok to reply to this. I have ran into the same problem , with the same software, and I did run the command you asked. Below the error and the output of you requested command:

Mode selection for 2028:1520:12:P SRGGB10_CSI2P,1332x990/0 - Score: 3456.22 SRGGB12_CSI2P,2028x1080/0 - Score: 1083.84 SRGGB12_CSI2P,2028x1520/0 - Score: 0 SRGGB12_CSI2P,4056x3040/0 - Score: 887 Mode selection for 4056:3040:12:P SRGGB10_CSI2P,1332x990/0 - Score: 10552.2 SRGGB12_CSI2P,2028x1080/0 - Score: 8179.84 SRGGB12_CSI2P,2028x1520/0 - Score: 7096 SRGGB12_CSI2P,4056x3040/0 - Score: 0 dmaHeap allocation failure for rpicam-apps0 ERROR: failed to allocate capture buffers for stream

Camera is Pi HQ

pe2bz@allsky:~ $ grep -i cma /proc/meminfo CmaTotal: 524288 kB CmaFree: 289372 kB `