raspberrypi / picamera2

New libcamera based python library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[OTHER] Failed to queue buffer 0: Invalid argument

IncredibleRichie opened this issue · comments

I want to leave a info for all users facing:

ERROR V4L2 v4l2_videodevice.cpp:1697 /dev/video13[27:out]: Failed to queue buffer 0: Invalid argument
ERROR RPISTREAM rpi_stream.cpp:276 Failed to queue buffer for ISP Input

After an apt upgrade i got this error.

Downgrading everything that got updated before resolves the issue.

I´ve used sudo apt install $(sudo find /var/cache/apt/archives/ -name *deb |grep -v partial |tr "\n" " ") to downgrade.

IDK if I missed something but it seems others having the issue too:

https://www.reddit.com/r/klippers/comments/1ay9k74/picam_stopped_working/

I don't know the solution but I'm also having the same problem running the example programs in this library. I'm using Debian GNU/Linux 12 (bookworm). Downgrading worked for me too. Thanks for posting that.

I can confirm the issue: a process stopped behaving properly after a regular upgrade end of Feb (via apt, bookworm repos).

# Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux
# Type "help", "copyright", "credits" or "license" for more information.
>>> import time
>>> 
>>> from picamera2 import Picamera2, Preview
>>> 
>>> picam2 = Picamera2()
[2:12:45.675787478] [3534]  INFO Camera camera_manager.cpp:284 libcamera v0.2.0+46-075b54d5
[2:12:45.701201595] [3543]  WARN RPiSdn sdn.cpp:39 Using legacy SDN tuning - please consider moving SDN inside rpi.denoise
[2:12:45.703381983] [3543]  INFO RPI vc4.cpp:447 Registered camera /base/soc/i2c0mux/i2c@1/imx477@1a to Unicam device /dev/media4 and ISP device /dev/media1
[2:12:45.703495685] [3543]  INFO RPI pipeline_base.cpp:1144 Using configuration file '/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml'
[2:12:45.705586834] [3534]  INFO Camera camera_manager.cpp:284 libcamera v0.2.0+46-075b54d5
[2:12:45.730492627] [3546]  WARN RPiSdn sdn.cpp:39 Using legacy SDN tuning - please consider moving SDN inside rpi.denoise
[2:12:45.732999269] [3546]  INFO RPI vc4.cpp:447 Registered camera /base/soc/i2c0mux/i2c@1/imx477@1a to Unicam device /dev/media4 and ISP device /dev/media1
[2:12:45.733069749] [3546]  INFO RPI pipeline_base.cpp:1144 Using configuration file '/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml'
>>> 
>>> config = picam2.create_video_configuration()
>>> picam2.configure(config)
[2:12:45.740140386] [3534]  INFO Camera camera.cpp:1183 configuring streams: (0) 1280x720-XBGR8888 (1) 2028x1080-SBGGR12_CSI2P
[2:12:45.740601415] [3546]  INFO RPI vc4.cpp:611 Sensor: /base/soc/i2c0mux/i2c@1/imx477@1a - Selected sensor format: 2028x1080-SBGGR12_1X12 - Selected unicam format: 2028x1080-pBCC
>>> 
>>> picam2.start()
>>> time.sleep(2)
[2:12:46.306499225] [3546] ERROR V4L2 v4l2_videodevice.cpp:1697 /dev/video13[29:out]: Failed to queue buffer 0: Invalid argument
[2:12:46.306559353] [3546] ERROR RPISTREAM rpi_stream.cpp:276 Failed to queue buffer for ISP Input
>>> 

Strangely enough, another similar installation (same version apparently) does still seem to behave properly.

@davidplowman do you have any ideas about this issue?

Hi, would you be able to:

  • Say what kind of Pi you are using.
  • Say what camera you are using (looks like imx477).
  • Install a fresh copy of the latest OS. Let it perform all its updates (sudo apt update and sudo apt full-upgrade).
  • Confirm your kernel version (output of uname -a) and OS version (cat /etc/os-release).
  • Confirm your libcamera version (output of libcamera-hello --version).
  • Don't install or touch anything else, just try the camera with libcamera-hello -t 0. Does it work?
  • If that works, try Picamera2. If that fails, please provide the shortest script that you can which fails and the console output. Also please check dmesg to see if there are any errors at the end.

Thanks!

Hi,

I likely found the culprit working on the matter: As @davidplowman requested, I reinstalled a new pi from the raspbian image of late December, upgraded it and tried to reproduce the issue, but without success.

I then looked closer at the failing device: it appears the software was running in a venv. While using the system-wide dist-packages (required for libcamera), there was also a local version of picamera2 (installed by mistake apparently). This was working without issue as long as everything was aligned, but end of Feb, libcamera was upgraded to 0.2, along with the system picamera2 package but the local version stayed behind.

Removing the version in the venv did solve the issue.