Closed Exper1mental closed 6 months ago
Hi, have you increased the amount of CMA memory available? If not, please check out page 58 of the manual.
A couple of other tips:
buffer_count=4
to the create_video_configuration
call.Surprisingly, increasing CMA memory appears to have no impact. Increased to both 512 MB and 2048 MB with no effect.
Changing buffer count appears to resolve the issue. buffer_count=5
or less works. Default, as you said, is 6. Changing CMA memory did not have an effect on this.
Slightly surprising. Maybe look at grep Cma /proc/meminfo
to check how much you have (and whether the update has taken effect). Note that you can't just set the CMA to any value. 512MB might be the largest, can't remember if 640 is an option too.
Without setting CMA memory in config.txt
it is already at 512MB:
CmaTotal: 524288 kB
CmaFree: 441276 kB
I reboot anytime I change CMA memory.
If the dtoverlay -h vc4=fkms-v3d
command is correct, 512 MB is the max CMA memory allocatable for the Pi 4B:
Name: vc4-fkms-v3d
Info: Enable Eric Anholt's DRM VC4 V3D driver on top of the dispmanx
display stack.
Usage: dtoverlay=vc4-fkms-v3d,<param>
Params: cma-512 CMA is 512MB (needs 1GB)
cma-448 CMA is 448MB (needs 1GB)
cma-384 CMA is 384MB (needs 1GB)
cma-320 CMA is 320MB (needs 1GB)
cma-256 CMA is 256MB (needs 1GB)
cma-192 CMA is 192MB (needs 1GB)
cma-128 CMA is 128MB
cma-96 CMA is 96MB
cma-64 CMA is 64MB
cma-size CMA size in bytes, 4MB aligned
cma-default Use upstream's default value
What is odd is that when running the stream I am not getting anywhere close to maxxing out CMA memory, which I would've expected given reducing the buffer count fixes the issue.
Maybe it is just odd to me? I got it working so I am ok with closing this issue if there are no further thoughts on the matter.
EDIT: Ran it again and checked CMA.
Before running script:
CmaTotal: 524288 kB
CmaFree: 441276 kB
After running script:
CmaTotal: 524288 kB
CmaFree: 142320 kB
Closing, looks like everything is behaving as intended. Thanks for the help!
what the script you have run?
what the script you have run?
Iirc this was the script in the OP. That or the one it was based on (linked in the OP)
Describe the bug When I configure Picamera2 to load my Pi Camera Module 3 Wide settings, it throws a
OSError: [Errno 12] Cannot allocate memory
.To Reproduce Run the following code:
This is a simplified form of
app.py
from picamera2-WebUI-Lite v0.0.4 by @monkeymademeExpected behaviour The Picamera2 module to successfully be configured.
Console Output, Screenshots Console output:
Hardware: Raspberry Pi 4B v1.5 (8GB RAM) Raspberry Pi Camera Module 3 Wide
Additional context OS: Raspberry Pi OS with Desktop 64-bit (Bookworm / Debian 12)
Let me know if you need additional information.
Thanks!