[libcamera-devel] libcamera on pinephone

Laurent Pinchart laurent.pinchart at ideasonboard.com
Mon Jul 4 20:23:16 CEST 2022


Hi Rafael,

On Mon, Jul 04, 2022 at 09:18:07AM +0300, Rafael Diniz wrote:
> I sorry for the noise too.
> : )
> 
> So, raw capture with "cam" app is working, but "qcam" produces images 
> with artifacts which come from downsizing / color space conversion 
> problems. Not really sure where the bug is.

I half recall that the RAW8 debayering shader implementation in qcam
still had issues, it may not have been fully debugged. Patches would be
welcome :-)

> On 7/3/22 17:09, Kieran Bingham wrote:
> > Quoting Kieran Bingham (2022-07-03 21:06:58)
> >> Quoting Rafael Diniz via libcamera-devel (2022-07-03 14:18:03)
> >>> With stock libcamera I can not get qcam working here. I get:
> >>>
> >>> (some sensors warnings...)
> >>>
> >>> [0:39:35.513864964] [5059]  WARN V4L2 v4l2_pixelformat.cpp:295
> >>> Unsupported V4L2 pixel format JPEG
> >>> [0:39:35.514260589] [5059]  WARN V4L2 v4l2_pixelformat.cpp:295
> >>> Unsupported V4L2 pixel format JPEG
> >>> [0:39:35.514607297] [5059]  WARN V4L2 v4l2_pixelformat.cpp:295
> >>> Unsupported V4L2 pixel format JPEG
> >>> [0:39:35.514932172] [5059]  WARN V4L2 v4l2_pixelformat.cpp:295
> >>> Unsupported V4L2 pixel format JPEG
> >>> [0:39:35.515247422] [5059]  WARN V4L2 v4l2_pixelformat.cpp:295
> >>> Unsupported V4L2 pixel format JPEG
> >>> [0:39:35.515553922] [5059]  WARN V4L2 v4l2_pixelformat.cpp:295
> >>> Unsupported V4L2 pixel format JPEG
> >>> [0:39:35.515863172] [5059]  WARN V4L2 v4l2_pixelformat.cpp:295
> >>> Unsupported V4L2 pixel format JPEG
> >>> [0:39:35.516295714] [5059]  WARN V4L2 v4l2_pixelformat.cpp:295
> >>> Unsupported V4L2 pixel format JPEG
> >>> [0:39:35.516623505] [5059]  WARN V4L2 v4l2_pixelformat.cpp:295
> >>> Unsupported V4L2 pixel format JPEG
> >>> [0:39:35.516936630] [5059]  WARN V4L2 v4l2_pixelformat.cpp:295
> >>> Unsupported V4L2 pixel format JPEG
> >>> [0:39:44.010041343] [5051]  INFO Camera camera.cpp:1029 configuring
> >>> streams: (0) 1600x1200-SBGGR8
> >>> Failed to set viewfinder format
> >>> [0:39:52.372775513] [5051]  INFO Camera camera.cpp:1029 configuring
> >>> streams: (0) 1600x1200-SBGGR8
> >>> Failed to set viewfinder format
> >>>
> >>> And then I get no image in qcam window, after selecting the camera.
> >>>
> >>
> >> Can you try with 'qcam -r gles' ?
> >>
> >> That should at least enable the opengl debayering implementation we have
> >> if it's really trying to use SBGGR8.
> > 
> > Sorry for the noise, I just saw the rest of the thread ;-)
> > 
> >>> On 7/1/22 18:11, Pavel Machek via libcamera-devel wrote:
> >>>> Hi!
> >>>>
> >>>>> Basic testing with cam utility
> >>>>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >>>>>
> >>>>> The ``cam`` utility can be used for basic testing. You can list the cameras
> >>>>> detected on the system with ``cam -l``, and capture ten frames from the first
> >>>>> camera and save them to disk with ``cam -c 1 --capture=10 --file``. See
> >>>>> ``cam -h`` for more information about the ``cam`` tool.
> >>>>
> >>>> Ok, so I have cam and qcam working, for example:
> >>>>
> >>>> [41:27:19.115361498] [79897]  INFO Camera camera.cpp:1029 configuring streams: (0) 1280x720-SBGGR8
> >>>>
> >>>> I even have YUYV8 working, at lower resolutions. Full resolution is
> >>>> not working for some reason. Anyway...
> >>>>
> >>>> +         formats.push_back(V4L2PixelFormat(V4L2_PIX_FMT_SBGGR8)); // Has problems at resolutions < 1280x720
> >>>> +       if (code == MEDIA_BUS_FMT_YUYV8_2X8)
> >>>> +         formats.push_back(V4L2PixelFormat(V4L2_PIX_FMT_YUYV)); // Has problems at resolutions > 1280x720
> >>>> +       if (code == MEDIA_BUS_FMT_UYVY8_2X8)
> >>>> +         formats.push_back(V4L2PixelFormat(V4L2_PIX_FMT_YUV420)); // Causes assertion
> >>>> +       if (code == MEDIA_BUS_FMT_RGB565_2X8_LE)
> >>>> +         formats.push_back(V4L2PixelFormat(V4L2_PIX_FMT_RGB565)); // no viewfinder available
> >>>> +       if (code == MEDIA_BUS_FMT_JPEG_1X8)
> >>>> +         formats.push_back(V4L2PixelFormat(V4L2_PIX_FMT_JPEG));  // No luck
> >>>>           return formats;
> >>>>
> >>>> I guess going with gstreamer framework is the next step.
> >>>>
> >>>> $ gst-launch-1.0 libcamerasrc  ! video/x-bayer,width=1280,height=720 !
> >>>> filesink location=/tmp/delme.unk ; ls -al /tmp/delme.unk
> >>>> WARNING: erroneous pipeline: could not link libcamerasrc0 to filesink0, libcamerasrc0 can't handle caps video/x-bayer, width=(int)1280, height=(int)720
> >>>>
> >>>> What's the problem with bayer? Camera supplies it, so libcamera should
> >>>> be able to supply it, too...?
> >>>>
> >>>> I tried to do:
> >>>>
> >>>> export GST_DEBUG=libcamera*:7
> >>>> export GST_PLUGIN_PATH=$(pwd)/build/src/gstreamer
> >>>>
> >>>> gst-launch-1.0 libcamerasrc camera-name=/base/i2c-csi/rear-camera at 4c ! video/x-raw,width=12\
> >>>> 80,height=720,format=YUYV,colorimetry=bt709,framerate=30/1 ! filesink location=/tmp/delme.u\
> >>>> nk ; ls -al /tmp/delme.unk
> >>>>
> >>>> I get: And I'm not sure how this is supposed to work.
> >>>> gstlibcamerasrc.cpp does not seem to pass requested
> >>>> width/height/pixelformat from gstreamer parameters to libcamera.
> >>>>
> >>>> [41:57:46.409580451] [80813]  WARN V4L2 v4l2_pixelformat.cpp:295 Unsupported V4L2 pixel format JPEG
> >>>> [41:57:46.409804919] [80813] ERROR V4L2 v4l2_subdevice.cpp:466 'ov5640 3-004c': Unable to set format on pad 0: Invalid argument 2592x1944 code 16385 colorspace 0
> >>>> [41:57:46.410829628] [80813] ERROR SimplePipeline simple.cpp:1268 Searching for device
> >>>> 0:00:07.442555063 80812   0x559321f600 INFO            libcamerasrc gstlibcamerasrc.cpp:240:gst_libcamera_src_open:<libcamerasrc0> Using camera '/base/i2c-csi/rear-camera at 4c'
> >>>> Pipeline is live and does not need PREROLL ...
> >>>> 0:00:07.444400306 80812   0x5593390c00 DEBUG           libcamerasrc gstlibcamerasrc.cpp:358:gst_libcamera_src_task_enter:<libcamerasrc0> Streaming thread has started
> >>>> Pipeline is PREROLLED ...
> >>>> Setting pipeline to PLAYING ...
> >>>> New clock: GstSystemClock
> >>>> 0:00:07.447466808 80812   0x5593390c00 WARN            libcamerasrc gstlibcamerasrc.cpp:474:gst_libcamera_src_task_enter:<libcamerasrc0> error: Internal data stream error.
> >>>> 0:00:07.447573438 80812   0x5593390c00 WARN            libcamerasrc gstlibcamerasrc.cpp:474:gst_libcamera_src_task_enter:<libcamerasrc0> error: streaming stopped, reason not-negotiated (-4)
> >>>> ERROR: from element /GstPipeline:pipeline0/GstLibcameraSrc:libcamerasrc0: Internal data stream error.
> >>>> Additional debug info:
> >>>> ../src/gstreamer/gstlibcamerasrc.cpp(474): gst_libcamera_src_task_enter (): /GstPipeline:pipeline0/GstLibcameraSrc:libcamerasrc0:
> >>>> streaming stopped, reason not-negotiated (-4)
> >>>> Execution ended after 0:00:00.003048210
> >>>> Setting pipeline to NULL ...
> >>>> 0:00:07.448231257 80812   0x5593390c00 DEBUG           libcamerasrc gstlibcamerasrc.cpp:490:gst_libcamera_src_task_leave:<libcamerasrc0> Streaming thread is about to stop
> >>>> 0:00:07.448946661 80812   0x559321f600 DEBUG           libcamerasrc gstlibcamerasrc.cpp:508:gst_libcamera_src_close:<libcamerasrc0> Releasing resources
> >>>> Freeing pipeline ...
> >>>> -rw-r--r-- 1 mobian mobian 0 Jul  1 23:04 /tmp/delme.unk
> >>>> mobian at mobian:~/g/libcamera$

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list