64MP with RPI 4b, Rev 1.4, failed to allocate capture buffers

@lefsky
We need some more detailed information,

camera-bug-report -t 5 -o bug.txt -c "libcamera-still -t 1000 -o test.jpg"

it will generate a bug.txt file, please put the information in the code block reply, otherwise there will be unnecessary problems with the display.

The bug.txt file is too large to put into the body of this email. Here is the stdout output

lefsky@raspberrypi:~ $ camera-bug-report -t 5 -o bug.txt -c "libcamera-still -t 1000 -o test.jpg"
Made X/EGL preview window
[12:00:54.210757469] [7305]  INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3572-e13ccdd5
[12:00:54.218821997] [7307]  WARN CameraSensorProperties camera_sensor_properties.cpp:163 No static properties available for 'arducam_64mp'
[12:00:54.218893738] [7307]  WARN CameraSensorProperties camera_sensor_properties.cpp:165 Please consider updating the camera sensor properties database
[12:00:54.219364828] [7307] ERROR CameraSensor camera_sensor.cpp:591 'arducam_64mp 10-001a': Camera sensor does not support test pattern modes.
[12:00:54.264439792] [7307]  WARN RPI raspberrypi.cpp:1263 Mismatch between Unicam and CamHelper for embedded data usage!
[12:00:54.265415509] [7307] ERROR DelayedControls delayed_controls.cpp:87 Delay request for control id 0x009a090a but control is not exposed by device /dev/v4l-subdev0
[12:00:54.265714470] [7307]  INFO RPI raspberrypi.cpp:1386 Registered camera /base/soc/i2c0mux/i2c@1/arducam_64mp@1a to Unicam device /dev/media2 and ISP device /dev/media0
[12:00:54.266512447] [7305]  INFO Camera camera.cpp:1029 configuring streams: (0) 4096x3074-YUV420
[12:00:54.267035426] [7307]  INFO RPI raspberrypi.cpp:764 Sensor: /base/soc/i2c0mux/i2c@1/arducam_64mp@1a - Selected sensor format: 4624x3472-SBGGR10_1X10 - Selected unicam format: 4624x3472-pBAA
[12:00:54.355162107] [7307] ERROR V4L2 v4l2_videodevice.cpp:1211 /dev/video0[18:cap]: Unable to request 4 buffers: Cannot allocate memory
[12:00:54.355236218] [7307] ERROR RPI raspberrypi.cpp:1012 Failed to allocate buffers
ERROR: *** failed to start camera ***

Bug report generated to bug.txt
Please upload this file when you create a new bug report at:
https://github.com/raspberrypi/libcamera-apps/issues/

A link to the bug.txt file
[rpi4_64mp_bug.txt - Google Docs]
(rpi4_64mp_bug.txt - Google Docs)

I found that the camera will work with a GPU ram allocation of 40 Mb, but not with less than that, or with 76Mb.

@lefsky
You can try to modify your config.txt

sudo vi /boot/config.txt

dtoverlay=vc4-kms-v3d,cma-256 become dtoverlay=vc4-kms-v3d,cma-512
Restart after changing and try again

I was using cma-512 already. And it was the GPU memory change that did it for me.

I’m running into same issue with “Failed to allocate buffers” what exact change did solve your issue? Is it setting GPU allocation through raspi-config?

Same issue, any solution? I also updated cmdline.txt with cma=400, tried to assign 128 to GPU, same error.

@nack
please give me some detail

cat /proc/cpuinfo
cat /etc/os-release
cat /boot/config.txt

cat /proc/cpuinfo
processor : 0
model name : ARMv7 Processor rev 3 (v7l)
BogoMIPS : 324.00
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd08
CPU revision : 3

processor : 1
model name : ARMv7 Processor rev 3 (v7l)
BogoMIPS : 324.00
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd08
CPU revision : 3

processor : 2
model name : ARMv7 Processor rev 3 (v7l)
BogoMIPS : 324.00
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd08
CPU revision : 3

processor : 3
model name : ARMv7 Processor rev 3 (v7l)
BogoMIPS : 324.00
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd08
CPU revision : 3

Hardware : BCM2711
Revision : d03114
Serial : 10000000e4273f4b
Model : Raspberry Pi 4 Model B Rev 1.4

cat /etc/os-release
PRETTY_NAME=“Raspbian GNU/Linux 11 (bullseye)”
NAME=“Raspbian GNU/Linux”
VERSION_ID=“11”
VERSION=“11 (bullseye)”
VERSION_CODENAME=bullseye
ID=raspbian
ID_LIKE=debian
HOME_URL=“http://www.raspbian.org/
SUPPORT_URL=“RaspbianForums - Raspbian
BUG_REPORT_URL=“RaspbianBugs - Raspbian

cat /boot/config.txt

For more options and information see

Raspberry Pi Documentation - Configuration

Some settings may impact device functionality. See link above for details

uncomment if you get no picture on HDMI for a default “safe” mode

#hdmi_safe=1

uncomment the following to adjust overscan. Use positive numbers if console

goes off screen, and negative if there is too much border

#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16

uncomment to force a console size. By default it will be display’s size minus

overscan.

#framebuffer_width=1280
#framebuffer_height=720

uncomment if hdmi display is not detected and composite is being output

#hdmi_force_hotplug=1

uncomment to force a specific HDMI mode (this will force VGA)

#hdmi_group=1
#hdmi_mode=1

uncomment to force a HDMI mode rather than DVI. This can make audio work in

DMT (computer monitor) modes

#hdmi_drive=2

uncomment to increase signal to HDMI, if you have interference, blanking, or

no display

#config_hdmi_boost=4

uncomment for composite PAL

#sdtv_mode=2

#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800

Uncomment some or all of these to enable the optional hardware interfaces

#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on

Uncomment this to enable infrared communication.

#dtoverlay=gpio-ir,gpio_pin=17
#dtoverlay=gpio-ir-tx,gpio_pin=18

Additional overlays and parameters are documented /boot/overlays/README

Enable audio (loads snd_bcm2835)

dtparam=audio=on

Automatically load overlays for detected cameras

camera_auto_detect=1

Automatically load overlays for detected DSI displays

display_auto_detect=1

Enable DRM VC4 V3D driver

dtoverlay=vc4-kms-v3d
max_framebuffers=2

Disable compensation for displays with overscan

disable_overscan=1

[cm4]

Enable host mode on the 2711 built-in XHCI USB controller.

This line should be removed if the legacy DWC2 controller is required

(e.g. for USB device mode) or if USB support is not required.

otg_mode=1

[all]
dtoverlay=vc4-kms-v3d,cma-512

[pi4]

Run as fast as firmware / board allows

arm_boost=1

[all]
dtoverlay=arducam_64mp

Okey,I see nothing wrong with your configuration information.

We can’t reproduce your problem, everything seems to be fine with us. I have some suggestions here:

  1. cat /proc/meminfo CmaTotal and CmaFree should be around 500000kB
  2. Retry a few times, because sometimes it doesn’t work well
  3. Reduce the resolution to ensure that the camera is OK

If you still have problems, send me the following information
dmesg

CmaTotal: 524288 kB
CmaFree: 351144 kB

Reduce screen resolution to 600x800, now it works.

CmaTotal: 524288 kB
CmaFree: 484732 kB

@nack
ok, did you lower the resolution of the monitor?
Someone has also reduced the resolution of the screen before, I think this is a solution that can temporarily solve this problem

@nack
Is the maximum resolution available now?

Yes, reduced screen resolution to 800x600, just tested all 4 camera’s, all work! Thank’s a lot.

hey, i was working with two 16MP cameras in a raspberry pi cm4 with 4GB RAM.

I am trying to capture the images simultaneously for stereo setup, i can capture my first set of images but when i try to capture second set i get this failed to allocate memory issue

I am using below libcamera drivers:
ii libcamera-apps 0.0.10 arm64 libcamera-apps
ii libcamera-dev 0.0.10 arm64 libcamera

ans i am using picamera2 version 0.3.6

@Edward please help us to solve this problem

@mullermuttu

What is your configuration file?

sudo vi /boot/config.txt