therealdavidp
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 710
Joined: Tue Jan 07, 2020 9:15 am

libcamera apps on Bullseye running on Pi 0 - 3

Thu Nov 11, 2021 11:54 am

Hi,

People will have noticed that libcamera-apps are not functioning correctly on Pi 0 to 3 devices when running the latest Bullseye images. The symptom in question is that the camera starts but the preview window, when running under X Windows, fails with a "failed to import fd" message.

This problem does not affect Pi 4s. It also does not affect users who are rendering through DRM/KMS (i.e. not X Windows), nor those who disable the preview window (the "-n" option).

A workaround is to open a terminal, run "sudo raspi-config", navigate to "Advanced Options" and enable "Glamor" graphic acceleration. Then reboot your Pi.

We're still investigating a longer term solution, as well as other problems that have been reported.

User avatar
RetromanIE
Posts: 1
Joined: Mon Nov 15, 2021 12:14 pm
Location: Ireland

Re: libcamera apps on Bullseye running on Pi 0 - 3

Mon Nov 15, 2021 12:19 pm

Hi, I cant seem to get the Pi02 to see my v2.1 camera module at all on the latest Bullseye image. It works on an older Pi0W as well as Pi4 without issue.
Is there some compatibility issue? The "Glamor" fix doesn't seem to do anything.
thanks

therealdavidp
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 710
Joined: Tue Jan 07, 2020 9:15 am

Re: libcamera apps on Bullseye running on Pi 0 - 3

Mon Nov 15, 2021 4:57 pm

Hi, some of the other threads here have been asking about this. There are some known problems with Pi Zero 2Ws at the moment, and we are working on it.

AngryPi
Posts: 1
Joined: Mon Nov 22, 2021 6:48 pm

Re: libcamera apps on Bullseye running on Pi 0 - 3

Mon Nov 22, 2021 6:50 pm

Hi, thank you such much. it solves my problem of libcamera-hello on my RPi 3B+ problem!

jgrmpf
Posts: 8
Joined: Thu Dec 02, 2021 3:53 pm

Re: libcamera apps on Bullseye running on Pi 0 - 3

Fri Dec 03, 2021 1:46 pm

Hi,
while I am having trouble with Bullseye on the Zero 2 W with the v2.1 camera module (see viewtopic.php?t=325227), libcamera seems basically to work on my Raspi2 with a Bullseye Os from today. Only when I do time-lapse recordings with command

Code: Select all

libcamera-still -o test%04d.jpg -t 600000 --timelapse 10000 --vflip --hflip --immediate
it stops after 18 pictures with

Code: Select all

...
[0:36:20.413061748] [1281]  INFO RPI raspberrypi.cpp:620 Sensor: /base/soc/i2c0mux/i2c@1/imx219@10 - Selected mode: 3280x2464-pRAA
[0:36:20.474603250] [1281] ERROR V4L2 v4l2_videodevice.cpp:1158 /dev/video0[13:cap]: Unable to request 1 buffers: Cannot allocate memory
[0:36:20.474887310] [1281] ERROR RPI raspberrypi.cpp:817 Failed to allocate buffers
I watched in parallel with "htop" on the memory consumption. With each picture taken it rises about 10..12MB, but right before the time of the error message the overall memory usage is around 280MB which should not mean that it generally runs out of RAM at all. When the error appears the used memory drops down to 51MB and libcamera-still just stalls.

So not sure what kind of memory runs out - is this issue known?

-jgrmpf

jgrmpf
Posts: 8
Joined: Thu Dec 02, 2021 3:53 pm

Re: libcamera apps on Bullseye running on Pi 0 - 3

Fri Dec 03, 2021 1:58 pm

Ah - just seen in the "dmesg" kernel log:

Code: Select all

[   35.050509] imx219_vdig: disabling
[   35.050545] imx219_vana: disabling
[ 1348.853880] cma: cma_alloc: alloc failed, req-size: 2484 pages, ret: -12
[ 1348.853927] unicam 3f801000.csi: dma_alloc_coherent of size 10174464 failed
[ 2180.506279] cma: cma_alloc: alloc failed, req-size: 2484 pages, ret: -12
[ 2180.506316] unicam 3f801000.csi: dma_alloc_coherent of size 10174464 failed
So it seems to run out of DMA buffers... Does anybody know a fix for that?

-jgrmpf

naushir
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 223
Joined: Mon Apr 25, 2016 10:21 am

Re: libcamera apps on Bullseye running on Pi 0 - 3

Fri Dec 03, 2021 2:03 pm

I have seen other reports of this allocation failure, and am in the process of trying to create some instrumentation to investigate this.

jgrmpf
Posts: 8
Joined: Thu Dec 02, 2021 3:53 pm

Re: libcamera apps on Bullseye running on Pi 0 - 3

Fri Dec 03, 2021 3:47 pm

Ok thanks for the info. Weird - I tried to reproduce the issue with a "strace" record - now it ran smoothly for 145 pictures and I don't see the "htop" memory consumption rising again. And I think I even did not reboot. :? ?!!? This means the issue is not so easily reproducible...

jgrmpf
Posts: 8
Joined: Thu Dec 02, 2021 3:53 pm

Re: libcamera apps on Bullseye running on Pi 0 - 3

Tue Dec 07, 2021 9:38 am

In order to get the camera working, is it at least for now required to increase the CMA reservation on the Raspi (2B)? I would like to try that because I need a solution in 2 weeks... Does anybody know how I can increase the CMA reservation to 320MB or even more?

Thanks in advance
-jgrmpf

Farhankhosravi
Posts: 7
Joined: Fri Dec 10, 2021 12:48 pm

Re: libcamera apps on Bullseye running on Pi 0 - 3

Mon Dec 20, 2021 8:43 pm

therealdavidp wrote:
Thu Nov 11, 2021 11:54 am
Hi,

People will have noticed that libcamera-apps are not functioning correctly on Pi 0 to 3 devices when running the latest Bullseye images. The symptom in question is that the camera starts but the preview window, when running under X Windows, fails with a "failed to import fd" message.

This problem does not affect Pi 4s. It also does not affect users who are rendering through DRM/KMS (i.e. not X Windows), nor those who disable the preview window (the "-n" option).

A workaround is to open a terminal, run "sudo raspi-config", navigate to "Advanced Options" and enable "Glamor" graphic acceleration. Then reboot your Pi.

We're still investigating a longer term solution, as well as other problems that have been reported.

Hi, I am using Raspberry pi zero W with bullseye; trying to capture a picture with "libcamera-hello", the results is:

Code: Select all

libEGL warning: DRI2: failed to authenticate
[4:24:28.981932792] [1466]  INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3156-f4070274
[4:24:29.770543289] [1466]  INFO Camera camera.cpp:937 configuring streams: (0) 1296x972-YUV420
[4:24:29.771311290] [1472]  INFO RPI raspberrypi.cpp:122 Mode: 2592x1944 fmt BG10 Score: 2067 (best 2067)
[4:24:29.772823293] [1472]  INFO RPI raspberrypi.cpp:122 Mode: 1920x1080 fmt BG10 Score: 1849.67 (best 1849.67)
[4:24:29.773288294] [1472]  INFO RPI raspberrypi.cpp:122 Mode: 1296x972 fmt BG10 Score: 1500 (best 1500)
[4:24:29.773650295] [1472]  INFO RPI raspberrypi.cpp:122 Mode: 640x480 fmt BG10 Score: 3796 (best 1500)
[4:24:29.774052295] [1472]  INFO RPI raspberrypi.cpp:122 Mode: 640x480 fmt BA81 Score: 4796 (best 1500)
[4:24:29.774477296] [1472]  INFO RPI raspberrypi.cpp:122 Mode: 2592x1944 fmt pBAA Score: 1567 (best 1500)
[4:24:29.774883297] [1472]  INFO RPI raspberrypi.cpp:122 Mode: 1920x1080 fmt pBAA Score: 1349.67 (best 1349.67)
[4:24:29.775298298] [1472]  INFO RPI raspberrypi.cpp:122 Mode: 1296x972 fmt pBAA Score: 1000 (best 1000)
[4:24:29.780316307] [1472]  INFO RPI raspberrypi.cpp:122 Mode: 640x480 fmt pBAA Score: 3296 (best 1000)
[4:24:29.790419326] [1472]  INFO RPI raspberrypi.cpp:620 Sensor: /base/soc/i2c0mux/i2c@1/ov5647@36 - Selected mode: 1296x972-pBAA
[4:24:30.619620889] [1476]  INFO IPARPI raspberrypi.cpp:626 Request ctrl: Saturation = 1.000000
[4:24:30.633031914] [1476]  INFO IPARPI raspberrypi.cpp:626 Request ctrl: Contrast = 1.000000
[4:24:30.633500915] [1476]  INFO IPARPI raspberrypi.cpp:626 Request ctrl: Brightness = 0.000000
[4:24:30.633885916] [1476]  INFO IPARPI raspberrypi.cpp:626 Request ctrl: AwbMode = 0
[4:24:30.634229916] [1476]  INFO IPARPI raspberrypi.cpp:626 Request ctrl: Sharpness = 1.000000
[4:24:30.634612917] [1476]  INFO IPARPI raspberrypi.cpp:626 Request ctrl: ExposureValue = 0.000000
[4:24:30.639089925] [1476]  INFO IPARPI raspberrypi.cpp:626 Request ctrl: AeExposureMode = 0
[4:24:30.639517926] [1476]  INFO IPARPI raspberrypi.cpp:626 Request ctrl: FrameDurationLimits = [ 33333, 33333 ]
[4:24:30.639887927] [1476]  INFO IPARPI raspberrypi.cpp:626 Request ctrl: AeMeteringMode = 0
[4:24:30.640326928] [1476]  INFO IPARPI raspberrypi.cpp:626 Request ctrl: NoiseReductionMode = 3
[4:24:30.672269988] [1472]  INFO RPISTREAM rpi_stream.cpp:122 No buffers available for ISP Output0
[4:24:30.684547011] [1472]  INFO RPISTREAM rpi_stream.cpp:122 No buffers available for ISP Output0
[4:24:30.684916012] [1472]  INFO RPISTREAM rpi_stream.cpp:122 No buffers available for ISP Output0
[4:24:30.685206012] [1472]  INFO RPISTREAM rpi_stream.cpp:122 No buffers available for ISP Output0
[4:24:30.836241296] [1472]  INFO RPI raspberrypi.cpp:1636 Dropping frame at the request of the IPA (7 left)
[4:24:30.883533385] [1472]  INFO RPI raspberrypi.cpp:1636 Dropping frame at the request of the IPA (6 left)
[4:24:30.962874533] [1472]  INFO RPI raspberrypi.cpp:1636 Dropping frame at the request of the IPA (5 left)
[4:24:31.065607725] [1472]  INFO RPI raspberrypi.cpp:1636 Dropping frame at the request of the IPA (4 left)
[4:24:31.140730866] [1472]  INFO RPI raspberrypi.cpp:1636 Dropping frame at the request of the IPA (3 left)
[4:24:31.212675000] [1472]  INFO RPI raspberrypi.cpp:1636 Dropping frame at the request of the IPA (2 left)
[4:24:31.298527161] [1472]  INFO RPI raspberrypi.cpp:1636 Dropping frame at the request of the IPA (1 left)
[4:24:31.430650407] [1472]  INFO RPI raspberrypi.cpp:1636 Dropping frame at the request of the IPA (0 left)
terminate called after throwing an instance of 'std::runtime_error'
  what():  failed to import fd 19
Aborted
I am using my pi through VNC, tried other commands and camera still doesn't work.
What can i do now? i have an important project; this is fully updated OS with latest apps and we can't simply use a camera?!!...
Please help....

therealdavidp
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 710
Joined: Tue Jan 07, 2020 9:15 am

Re: libcamera apps on Bullseye running on Pi 0 - 3

Mon Dec 20, 2021 9:40 pm

Hi, there are a few things we should probably check.

1. Can you confirm that you have re-enabled Glamor?
2. By "capture a picture" do you mean that you want to see a preview window, or that you want to capture a JPEG, or both?
3. If you don't need the preview window you can use the "-n" option. This will work better on a Pi Zero, especially a Pi Zero running X Windows.
4. A Pi Zero always struggles somewhat with X WIndows. If you can attach a monitor directly to the Pi and use this for display, then you will get much improved performance if you quit or suspend X Windows (it will automatically switch to DRM/KMS for rendering).
5. If you do want to run X Windows and forward the preview window across the network (whether using ssh or VNC), the "--qt-preview" option (which switches to software rendering) will perform better.

richtong
Posts: 1
Joined: Sun Feb 20, 2022 5:56 am

Re: libcamera apps on Bullseye running on Pi 0 - 3

Sun Feb 20, 2022 5:59 am

OK, I have the same configuration, a Raspberry Pi Camera Module 2 and a Raspberry Pi Zero 2 W and I'm getting a similar message. I have enabled Glamor as noted above and the error is:

```
libcamera-jpeg -o foo.jpg
[0:01:13.877213033] [1203] INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3384-44d59841
[0:01:13.966915794] [1216] WARN RPI raspberrypi.cpp:1202 Mismatch between Unicam and CamHelper for embedded data usage!
[0:01:13.969656711] [1216] INFO RPI raspberrypi.cpp:1313 Registered camera /base/soc/i2c0mux/i2c@1/imx219@10 to Unicam device /dev/media3 and ISP device /dev/media1
[0:01:13.971701495] [1203] INFO Camera camera.cpp:1028 configuring streams: (0) 1640x1232-YUV420
[0:01:13.972547716] [1216] INFO RPI raspberrypi.cpp:738 Sensor: /base/soc/i2c0mux/i2c@1/imx219@10 - Selected sensor format: 1640x1232-SBGGR10_1X10 - Selected unicam format: 1640x1232-pBAA
[0:01:14.014233322] [1228] INFO IPARPI raspberrypi.cpp:626 Request ctrl: Saturation = 1.000000
[0:01:14.014405245] [1228] INFO IPARPI raspberrypi.cpp:626 Request ctrl: Contrast = 1.000000
[0:01:14.014472055] [1228] INFO IPARPI raspberrypi.cpp:626 Request ctrl: Brightness = 0.000000
[0:01:14.014533236] [1228] INFO IPARPI raspberrypi.cpp:626 Request ctrl: AwbMode = 0
[0:01:14.014593792] [1228] INFO IPARPI raspberrypi.cpp:626 Request ctrl: Sharpness = 1.000000
[0:01:14.014656224] [1228] INFO IPARPI raspberrypi.cpp:626 Request ctrl: ExposureValue = 0.000000
[0:01:14.014718761] [1228] INFO IPARPI raspberrypi.cpp:626 Request ctrl: AeExposureMode = 0
[0:01:14.014819288] [1228] INFO IPARPI raspberrypi.cpp:626 Request ctrl: FrameDurationLimits = [ 33333, 33333 ]
[0:01:14.014993296] [1228] INFO IPARPI raspberrypi.cpp:626 Request ctrl: AeMeteringMode = 0
[0:01:14.015132491] [1228] INFO IPARPI raspberrypi.cpp:626 Request ctrl: NoiseReductionMode = 3
[0:01:14.016258146] [1216] INFO RPISTREAM rpi_stream.cpp:133 No buffers available for ISP Output0
[0:01:14.016351169] [1216] INFO RPISTREAM rpi_stream.cpp:133 No buffers available for ISP Output0
[0:01:14.016783608] [1216] INFO RPISTREAM rpi_stream.cpp:133 No buffers available for ISP Output0
[0:01:14.017323193] [1216] INFO RPISTREAM rpi_stream.cpp:133 No buffers available for ISP Output0
[0:01:14.017385208] [1216] INFO RPISTREAM rpi_stream.cpp:133 No buffers available for ISP Output0
[0:01:14.017921353] [1216] INFO RPISTREAM rpi_stream.cpp:133 No buffers available for ISP Output0
terminate called after throwing an instance of 'std::runtime_error'
what(): failed to import fd 19
```

Any ideas what is going on, what is this no buffers things, anything else to try, it is a 64-bit version of Bullseye, so is that the problem?

therealdavidp
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 710
Joined: Tue Jan 07, 2020 9:15 am

Re: libcamera apps on Bullseye running on Pi 0 - 3

Sun Feb 20, 2022 1:57 pm

Hi, please can you report the output of "uname -a", "vcgencmd version" and "libcamera-hello --version".

Are you running over ssh? That message tends to come up when trying to use X forwarding with the hardware accelerated preview implementation. If that's the case, maybe try adding "--qt-preview" (for an X forwarding friendly preview window), or "-n" (no preview window at all).

brian_miller
Posts: 2
Joined: Mon Apr 11, 2022 10:13 pm

Re: libcamera apps on Bullseye running on Pi 0 - 3

Thu Apr 14, 2022 9:31 pm

Is libcamera-hello supposed to work for a USB camera ?

Model : Raspberry Pi Model B Plus Rev 1.2
Revision: 0010
Raspbian GNU/Linux 11 (bullseye)

lsusb shows one of the USB Bus Devices as
HD USB Camera HD USB Camera

"v4l2-ctl --list-devices" output includes

HD USB Camera (usb-1-7):
/dev/video1

But then ... :

$ libcamera-hello --list-cameras
[0:16:45.261354891] [4348] INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3424-e68e0f1e
No cameras available!

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 13801
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: libcamera apps on Bullseye running on Pi 0 - 3

Fri Apr 15, 2022 10:34 am

brian_miller wrote:
Thu Apr 14, 2022 9:31 pm
Is libcamera-hello supposed to work for a USB camera ?
No. It is aimed at the raw sensors that typically connect via CSI2, not USB cameras that deliver fully processed MJPEG or YUYV images.
libcamera does have a pipeline handler for UVC (USB Video Class) cameras, but that's not the target for the Pi libcamera-apps.
Software Engineer at Raspberry Pi Ltd. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

AntoineLB
Posts: 1
Joined: Mon Apr 25, 2022 2:58 pm

Re: libcamera apps on Bullseye running on Pi 0 - 3

Mon Apr 25, 2022 3:05 pm

running `libcamera-hello --qt-preview` did the job for me, more details about it here: https://github.com/raspberrypi/libcamera-apps/issues/46

- I added the `camera_auto_detect=1` according to this doc: https://www.raspberrypi.com/documentati ... ng-started
- I have legacy camera, I2C and Glamor activated from the settings. I am a noob so I don't really know if those affect in anything

Tormund1985
Posts: 4
Joined: Wed Sep 29, 2021 9:41 am

Re: libcamera apps on Bullseye running on Pi 0 - 3

Thu Apr 28, 2022 7:37 am

AntoineLB wrote: running `libcamera-hello --qt-preview` did the job for me, more details about it here: https://github.com/raspberrypi/libcamera-apps/issues/46

- I added the `camera_auto_detect=1` according to this doc: https://www.raspberrypi.com/documentati ... ng-started
- I have legacy camera, I2C and Glamor activated from the settings. I am a noob so I don't really know if those affect in anything
exactly same problem than you... i am gonna try to contact with arducam...

Arducam-Support
Posts: 59
Joined: Tue Apr 19, 2022 8:16 am

Re: libcamera apps on Bullseye running on Pi 0 - 3

Thu Apr 28, 2022 8:07 am

Tormund1985 wrote:
AntoineLB wrote: running `libcamera-hello --qt-preview` did the job for me, more details about it here: https://github.com/raspberrypi/libcamera-apps/issues/46

- I added the `camera_auto_detect=1` according to this doc: https://www.raspberrypi.com/documentati ... ng-started
- I have legacy camera, I2C and Glamor activated from the settings. I am a noob so I don't really know if those affect in anything
exactly same problem than you... i am gonna try to contact with arducam...
Hi, Tormund

We have received your request about Arducam camera.
Actually, you can directly contact support@arducam.com for more support.

Best regards
Alternative ways to get support from Arducam:

The Arducam forum: https://forum.arducam.com/
The Support Email: support at arducam.com
The Support Phone: +1(319)471-7640

robmlr
Posts: 1
Joined: Fri Apr 29, 2022 7:01 pm

Re: libcamera apps on Bullseye running on Pi 0 - 3

Fri Apr 29, 2022 7:14 pm

I find that with a fresh install of bullseye, updated 29-apr-2022 on a Raspberry Pi Model 2 B (v1.1), I am unable to 'Enable direct capture mode' under VNC GUI 'hamburger' - options - troubleshooting.

Attempting to do so causes VNC to crash and not come back after rebooting. Removing ~/.vnc and /root/.vnc and rebooting returns to the default configuration (or you can just reinstall the entire sd card as I did a few times).

Sorry if this is documented elsewhere, but I couldn't find it. Also posting to the 'problems with bullseye' thread didn't seem like a productive option, but please share wherever this might get addressed.

Tormund1985
Posts: 4
Joined: Wed Sep 29, 2021 9:41 am

Re: libcamera apps on Bullseye running on Pi 0 - 3

Mon May 02, 2022 7:05 am

Arducam-Support wrote:
Thu Apr 28, 2022 8:07 am
Tormund1985 wrote:
AntoineLB wrote: running `libcamera-hello --qt-preview` did the job for me, more details about it here: https://github.com/raspberrypi/libcamera-apps/issues/46

- I added the `camera_auto_detect=1` according to this doc: https://www.raspberrypi.com/documentati ... ng-started
- I have legacy camera, I2C and Glamor activated from the settings. I am a noob so I don't really know if those affect in anything
exactly same problem than you... i am gonna try to contact with arducam...
Hi, Tormund

We have received your request about Arducam camera.
Actually, you can directly contact support@arducam.com for more support.

Best regards
My device is a pi zero 2W.

osmankhalid2005
Posts: 1
Joined: Sat May 14, 2022 9:08 am

Re: libcamera apps on Bullseye running on Pi 0 - 3

Sat May 14, 2022 9:12 am

I have Raspberry Pi 3 model B,
Camera version 1.3
Raspbian Bullseye OS

My camera was not working, and now it is working fine when I performed the following:

1. First I did sudo rpi-update (I am not sure whether it has any role or not)
2. Open a terminal, run "sudo raspi-config", navigate to "Advanced Options" and enable "Glamor" graphic acceleration. Then reboot your Pi

thank you for providing the solution.

Timo-8x
Posts: 3
Joined: Thu May 26, 2022 9:27 pm

Re: libcamera apps on Bullseye running on Pi 0 - 3

Thu May 26, 2022 11:25 pm

Hi,
I'm having some trouble with the libcamera apps, too.
My setup:
- RPi3B
- IMX519 Camera Module from Arducam
- installed the apps and drivers from the Arducam script: https://arducam.com/downloads/arducam-i ... -guide.pdf
- Linux rpi3 5.15.41-v7+ #1557 SMP Mon May 23 16:46:23 BST 2022 armv7l GNU/Linux
- Raspbian bullseye (updated from buster)
- full KMS driver is activated
- glamor is activated (checked via Xorg.0.log)
- system is running headless and exclusively accessed via ssh - currently set to gui autologin to have an Xorg.0.log generated

So when I run libcamera-hello this is the output:

Code: Select all

me@rpi3:~ $ libcamera-hello
Made X/EGL preview window
[0:01:01.482029071] [1277]  INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3431-c4602118
[0:01:01.496761815] [1291]  WARN CameraSensorProperties camera_sensor_properties.cpp:141 No static properties available for 'imx519'
[0:01:01.496872964] [1291]  WARN CameraSensorProperties camera_sensor_properties.cpp:143 Please consider updating the camera sensor properties database
[0:01:01.496960519] [1291] ERROR CameraSensor camera_sensor.cpp:551 'imx519 10-001a': Camera sensor does not support test pattern modes.
[0:01:01.571886519] [1291]  WARN RPI raspberrypi.cpp:1233 Mismatch between Unicam and CamHelper for embedded data usage!
[0:01:01.573046141] [1291] ERROR DelayedControls delayed_controls.cpp:87 Delay request for control id 0x009a090a but control is not exposed by device /dev/v4l-subdev0
[0:01:01.573852107] [1291]  INFO RPI raspberrypi.cpp:1356 Registered camera /base/soc/i2c0mux/i2c@1/imx519@1a to Unicam device /dev/media3 and ISP device /dev/media0
[0:01:01.575217101] [1277]  INFO Camera camera.cpp:1028 configuring streams: (0) 2328x1748-YUV420
[0:01:01.575868842] [1291]  INFO RPI raspberrypi.cpp:751 Sensor: /base/soc/i2c0mux/i2c@1/imx519@1a - Selected sensor format: 2328x1748-SRGGB10_1X10 - Selected unicam format: 2328x1748-pRAA
[0:01:01.638731512] [1296]  INFO IPARPI raspberrypi.cpp:666 Request ctrl: Saturation = 1.000000
[0:01:01.638926467] [1296]  INFO IPARPI raspberrypi.cpp:666 Request ctrl: Contrast = 1.000000
[0:01:01.638998396] [1296]  INFO IPARPI raspberrypi.cpp:666 Request ctrl: Brightness = 0.000000
[0:01:01.639066315] [1296]  INFO IPARPI raspberrypi.cpp:666 Request ctrl: AwbMode = 0
[0:01:01.639133088] [1296]  INFO IPARPI raspberrypi.cpp:666 Request ctrl: Sharpness = 1.000000
[0:01:01.639202518] [1296]  INFO IPARPI raspberrypi.cpp:666 Request ctrl: ExposureValue = 0.000000
[0:01:01.639281843] [1296]  INFO IPARPI raspberrypi.cpp:666 Request ctrl: AeExposureMode = 0
[0:01:01.639441016] [1296]  INFO IPARPI raspberrypi.cpp:666 Request ctrl: FrameDurationLimits = [ 33333, 33333 ]
[0:01:01.639525498] [1296]  INFO IPARPI raspberrypi.cpp:666 Request ctrl: AeMeteringMode = 0
[0:01:01.639590135] [1296]  INFO IPARPI raspberrypi.cpp:666 Request ctrl: NoiseReductionMode = 3
terminate called after throwing an instance of 'std::runtime_error'
  what():  failed to import fd 18
So glamor didn't help.
Is it because I'm running it headless? (I guess quite a lot of people would be doing that so they'd have the same issues. This again doesn't seem to be the case.)
Are those two errors in the upper section somehow related to the fatal error in the end?
- Even if not, is there a way to fix them? I mean, something is not working as intended, obviously...

Best regards

Arducam-Support
Posts: 59
Joined: Tue Apr 19, 2022 8:16 am

Re: libcamera apps on Bullseye running on Pi 0 - 3

Fri May 27, 2022 3:07 am

Timo-8x wrote: Hi,
I'm having some trouble with the libcamera apps, too.
My setup:
- RPi3B
- IMX519 Camera Module from Arducam
- installed the apps and drivers from the Arducam script: https://arducam.com/downloads/arducam-i ... -guide.pdf
- Linux rpi3 5.15.41-v7+ #1557 SMP Mon May 23 16:46:23 BST 2022 armv7l GNU/Linux
- Raspbian bullseye (updated from buster)
- full KMS driver is activated
- glamor is activated (checked via Xorg.0.log)
- system is running headless and exclusively accessed via ssh - currently set to gui autologin to have an Xorg.0.log generated

So when I run libcamera-hello this is the output:

Code: Select all

me@rpi3:~ $ libcamera-hello
Made X/EGL preview window
[0:01:01.482029071] [1277]  INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3431-c4602118
[0:01:01.496761815] [1291]  WARN CameraSensorProperties camera_sensor_properties.cpp:141 No static properties available for 'imx519'
[0:01:01.496872964] [1291]  WARN CameraSensorProperties camera_sensor_properties.cpp:143 Please consider updating the camera sensor properties database
[0:01:01.496960519] [1291] ERROR CameraSensor camera_sensor.cpp:551 'imx519 10-001a': Camera sensor does not support test pattern modes.
[0:01:01.571886519] [1291]  WARN RPI raspberrypi.cpp:1233 Mismatch between Unicam and CamHelper for embedded data usage!
[0:01:01.573046141] [1291] ERROR DelayedControls delayed_controls.cpp:87 Delay request for control id 0x009a090a but control is not exposed by device /dev/v4l-subdev0
[0:01:01.573852107] [1291]  INFO RPI raspberrypi.cpp:1356 Registered camera /base/soc/i2c0mux/i2c@1/imx519@1a to Unicam device /dev/media3 and ISP device /dev/media0
[0:01:01.575217101] [1277]  INFO Camera camera.cpp:1028 configuring streams: (0) 2328x1748-YUV420
[0:01:01.575868842] [1291]  INFO RPI raspberrypi.cpp:751 Sensor: /base/soc/i2c0mux/i2c@1/imx519@1a - Selected sensor format: 2328x1748-SRGGB10_1X10 - Selected unicam format: 2328x1748-pRAA
[0:01:01.638731512] [1296]  INFO IPARPI raspberrypi.cpp:666 Request ctrl: Saturation = 1.000000
[0:01:01.638926467] [1296]  INFO IPARPI raspberrypi.cpp:666 Request ctrl: Contrast = 1.000000
[0:01:01.638998396] [1296]  INFO IPARPI raspberrypi.cpp:666 Request ctrl: Brightness = 0.000000
[0:01:01.639066315] [1296]  INFO IPARPI raspberrypi.cpp:666 Request ctrl: AwbMode = 0
[0:01:01.639133088] [1296]  INFO IPARPI raspberrypi.cpp:666 Request ctrl: Sharpness = 1.000000
[0:01:01.639202518] [1296]  INFO IPARPI raspberrypi.cpp:666 Request ctrl: ExposureValue = 0.000000
[0:01:01.639281843] [1296]  INFO IPARPI raspberrypi.cpp:666 Request ctrl: AeExposureMode = 0
[0:01:01.639441016] [1296]  INFO IPARPI raspberrypi.cpp:666 Request ctrl: FrameDurationLimits = [ 33333, 33333 ]
[0:01:01.639525498] [1296]  INFO IPARPI raspberrypi.cpp:666 Request ctrl: AeMeteringMode = 0
[0:01:01.639590135] [1296]  INFO IPARPI raspberrypi.cpp:666 Request ctrl: NoiseReductionMode = 3
terminate called after throwing an instance of 'std::runtime_error'
  what():  failed to import fd 18
So glamor didn't help.
Is it because I'm running it headless? (I guess quite a lot of people would be doing that so they'd have the same issues. This again doesn't seem to be the case.)
Are those two errors in the upper section somehow related to the fatal error in the end?
- Even if not, is there a way to fix them? I mean, something is not working as intended, obviously...

Best regards
Dear Timo-8x,

Thanks for your information about the error when using the camera. They are very helpful for us to diagnose the exact problem.
Considering that you are using the camera on Pi 3B, you can try to run sudo raspi-config to make some modification. Please refer to the following steps:
After enabling glamor, you need to execute the following steps also:
1. Open a terminal
2. Run sudo raspi-config
3. Navigate to Advanced Options
4. Navigate to GL Driver
5. Select GL (Full KMS)
6. Reboot your Pi

Hope that will help you.

Best regards,
Arducam Support Team
Alternative ways to get support from Arducam:

The Arducam forum: https://forum.arducam.com/
The Support Email: support at arducam.com
The Support Phone: +1(319)471-7640

Timo-8x
Posts: 3
Joined: Thu May 26, 2022 9:27 pm

Re: libcamera apps on Bullseye running on Pi 0 - 3

Fri May 27, 2022 11:10 am

Hi Arducam Support Team, thank you for your quick response!
The GL driver is already activated, I also tried disabling and re-enabling it.
Here are some additional information, maybe they help to diagnose the problem:

Non-commented lines in /boot/config.txt:

Code: Select all

hdmi_force_hotplug=1
dtparam=spi=on
dtparam=audio=on
start_x=1
gpu_mem=256
[all]
dtoverlay=vc4-kms-v3d
dtoverlay=imx519
Loaded Modules:

Code: Select all

me@rpi3:~ $ lsmod
Module                  Size  Used by
rpcsec_gss_krb5        28672  0
md5                    16384  4
nls_utf8               16384  12
cifs                  786432  8
cifs_arc4              16384  1 cifs
cifs_md4               16384  1 cifs
cmac                   16384  7
algif_hash             16384  1
aes_arm_bs             24576  2
crypto_simd            16384  1 aes_arm_bs
cryptd                 24576  2 crypto_simd
algif_skcipher         16384  1
af_alg                 28672  6 algif_hash,algif_skcipher
bnep                   20480  2
hci_uart               40960  1
btbcm                  20480  1 hci_uart
bluetooth             405504  26 hci_uart,bnep,btbcm
ecdh_generic           16384  2 bluetooth
ecc                    40960  1 ecdh_generic
8021q                  32768  0
garp                   16384  1 8021q
stp                    16384  1 garp
llc                    16384  2 garp,stp
imx519                 24576  1
snd_soc_hdmi_codec     20480  1
spidev                 20480  0
brcmfmac              335872  0
sg                     28672  0
vc4                   282624  4
brcmutil               20480  1 brcmfmac
sha256_generic         16384  4
cfg80211              765952  1 brcmfmac
cec                    49152  1 vc4
uas                    24576  0
drm_kms_helper        274432  2 vc4
rfkill                 32768  6 bluetooth,cfg80211
snd_soc_core          233472  2 vc4,snd_soc_hdmi_codec
raspberrypi_hwmon      16384  0
snd_compress           20480  1 snd_soc_core
snd_pcm_dmaengine      16384  1 snd_soc_core
bcm2835_unicam         45056  0
syscopyarea            16384  1 drm_kms_helper
sysfillrect            16384  1 drm_kms_helper
sysimgblt              16384  1 drm_kms_helper
fb_sys_fops            16384  1 drm_kms_helper
i2c_mux_pinctrl        16384  0
v4l2_dv_timings        36864  1 bcm2835_unicam
i2c_mux                16384  1 i2c_mux_pinctrl
v4l2_fwnode            24576  2 bcm2835_unicam,imx519
v4l2_async             24576  3 bcm2835_unicam,v4l2_fwnode,imx519
i2c_bcm2835            16384  0
bcm2835_codec          45056  0
snd_bcm2835            24576  2
snd_pcm               114688  5 snd_compress,snd_pcm_dmaengine,snd_soc_hdmi_codec,snd_bcm2835,snd_soc_core
spi_bcm2835            20480  0
v4l2_mem2mem           36864  1 bcm2835_codec
snd_timer              32768  1 snd_pcm
snd                    81920  10 snd_compress,snd_soc_hdmi_codec,snd_timer,snd_bcm2835,snd_soc_core,snd_pcm
bcm2835_isp            32768  0
videobuf2_dma_contig    20480  3 bcm2835_unicam,bcm2835_isp,bcm2835_codec
fixed                  16384  3
uio_pdrv_genirq        16384  0
uio                    20480  1 uio_pdrv_genirq
bcm2835_v4l2           45056  0
bcm2835_mmal_vchiq     32768  3 bcm2835_isp,bcm2835_codec,bcm2835_v4l2
vc_sm_cma              32768  2 bcm2835_isp,bcm2835_mmal_vchiq
videobuf2_vmalloc      16384  1 bcm2835_v4l2
videobuf2_memops       16384  2 videobuf2_dma_contig,videobuf2_vmalloc
videobuf2_v4l2         32768  5 bcm2835_unicam,bcm2835_isp,bcm2835_codec,bcm2835_v4l2,v4l2_mem2mem
videobuf2_common       65536  9 bcm2835_unicam,bcm2835_isp,bcm2835_codec,videobuf2_dma_contig,videobuf2_vmalloc,videobuf2_memops,bcm2835_v4l2,v4l2_mem2mem,videobuf2_v4l2
videodev              245760  9 bcm2835_unicam,bcm2835_isp,imx519,bcm2835_codec,videobuf2_common,bcm2835_v4l2,v4l2_mem2mem,videobuf2_v4l2,v4l2_async
mc                     45056  9 bcm2835_unicam,bcm2835_isp,imx519,bcm2835_codec,videobuf2_common,videodev,v4l2_mem2mem,videobuf2_v4l2,v4l2_async
drm                   536576  5 vc4,drm_kms_helper
fuse                  131072  1
drm_panel_orientation_quirks    16384  1 drm
backlight              20480  2 drm_kms_helper,drm
ip_tables              28672  0
x_tables               32768  1 ip_tables
Extract of Xorg.0.log

Code: Select all

me@rpi3:~ $ cat /var/log/Xorg.0.log | grep glamor
[    22.892] (II) Loading sub module "glamoregl"
[    22.892] (II) LoadModule: "glamoregl"
[    22.892] (II) Loading /usr/lib/xorg/modules/libglamoregl.so
[    23.064] (II) Module glamoregl: vendor="X.Org Foundation"
[    25.694] (II) modeset(0): glamor X acceleration enabled on VC4 V3D 2.1
[    25.694] (II) modeset(0): glamor initialized

Timo-8x
Posts: 3
Joined: Thu May 26, 2022 9:27 pm

Re: libcamera apps on Bullseye running on Pi 0 - 3

Sun May 29, 2022 8:30 pm

I tested some more and these are the results:

- #1: Freshly installed 64bit RPi OS, camera driver installation as described in the arducam guide: "failed to import fd ..." error on SSH access
- #2: Freshly installed 32bit RPi full-blown OS, camera driver installation as described in the arducam guide: "failed to import fd ..." error on SSH access
- #3: Connected a screen and kb/mouse to system #2 and accessed it locally: Everything seems to work! Autofocus also works.
- #4: SSH'd into this system while also being logged in locally: still the fd error...
- #5: Booted my old setup again and accessed it locally: libcamera-hello and the other apps work! But as soon as I add the autofocus option, it crashes with a segmentation fault.

So the first result is that I cannot use the libcamera apps via SSH (X-forwarding is activated) and since this also happened on a virgin OS I'm really curious how (if?) others are able to do it.

Second result is that there's something wrong with my old system. I tried to run the manual focus tool but this also wouldn't work. The python error message reveals some information though:

Code: Select all

Traceback (most recent call last):
  File "/home/me/arducam/Arducam-Pivariety-V4L2-Driver/focus/FocuserExample.py", line 157, in <module>
    main()
  File "/home/me/arducam/Arducam-Pivariety-V4L2-Driver/focus/FocuserExample.py", line 152, in main
    focuser = Focuser(args.device)
  File "/home/me/arducam/Arducam-Pivariety-V4L2-Driver/focus/Focuser.py", line 39, in __init__
    self.fd = open(self.dev, 'r')
FileNotFoundError: [Errno 2] No such file or directory: '/dev/v4l-subdev1'
Exception ignored in: <function Focuser.__del__ at 0x764c42b0>
Traceback (most recent call last):
  File "/home/me/arducam/Arducam-Pivariety-V4L2-Driver/focus/Focuser.py", line 94, in __del__
    self.fd.close()
AttributeError: 'Focuser' object has no attribute 'fd'
So v4l-subdev1 is missing!
I also tried to run the script on v4l-subdev0, but this raises a runtime error, saying this device has no focus_absolute control.

Is there a way to detect why it is missing?

Return to “Camera board”