[libcamera-devel] [PATCH 0/7] libcamera: Map multiple V4L2 formats to a single libcamera::format

Jacopo Mondi jacopo at jmondi.org
Sat Jul 23 12:21:02 CEST 2022


Hi Pavel,

On Sat, Jul 16, 2022 at 12:15:20PM +0200, Pavel Machek wrote:
> Hi!
>
> > This series addresses the requirement of mapping multiple V4L2 pixel formats
> > to a single libcamera format. Specifically, it allows to map V4L2_PIX_FMT_JPEG
> > and V4L2_PIX_FMT_MJPEG to libcamera::formats::MJPEG.
> >
> > The series starts by allowing to associate mulitple V4L2 FourCC in
> > PixelFormatInfo and re-introduces toV4L2PixelFormat() in V4L2VideoDevice in
> > order to select among from the list of V4L2 formats the first one supported
> > from the video device.
> >
> > Patch [7/8] adds a multiplanar flag to V4L2VideoDevice::toV4L2PixelFormat() to
> > allow selection of the contiguous or non-contiguous format versions.
> >
> > Finally, the last patch associates V4L2_PIX_FMT_JPEG to formats::MJPEG.
> >
> > Tested with a UVC camera.
> >
> > Pavel, could you please test on the pinephone please ?
>
> I tried to do quick testing, but it is not trivial as I have to patch
> libcamera to get it work on PinePhone at all. I could not get it to
> work so far.
>

Thanks for testing!

Turns out I have a pinephone as well, and I spent the last days trying
to set it up to test libcamera there.

The result is that I have sent a v2 of this series with one additional
patch on top and had to massage the video driver a bit to make it
slightly more compliant with libcamera requirements.

With these two branches:

- postmarket os patches + ov5640 backport + sun6i-csi
https://git.sr.ht/~jmondi_/linux/log/pinephone/orange-pi-5.17-20220429-1618/postmarketos
- JPEG/MJPEG mapping
https://git.sr.ht/~jmondi_/libcamera/log/jmondi/pinephone

I'm able to capture from ov5640 in YUYV and JPEG formats in different
resolutions:
$ cam -c2 -C --stream pixelformat=YUYV,width=640,height=480
$ cam -c2 -C --stream pixelformat=MJPEG,width=1920,height=1080 -F

I've been able to inspect the YUYV image and they're ok, the JPEG one
can't be opened with my viewer and I've not investigated why. I recall
I tested JPEG with the ov5640 driver in a CSI-2 setup and it worked.
Not sure if the sun6i csi receiver plays a role here ?

Anyway, I tried NV12 and it fails because of a wrong plane mapping.
Haven't investigated yet but I presume it's because we map NV12 to the
contiguous planar format version. The JPEG/MJPEG series would help
mapping formats::NV12 to the right V4L2 format version, but I haven't
done that it yet.

Capturing in full resolution doesn't work. The sensor hangs and I
presume it is because of the sensor driver. The long list of changes
now upstreamed for the ov5640 sensor modes only apply to CSI-2 setups,
as I haven't got a parallel setup to test with at the time. The series
has been tested on a parallel setup by other media developers and no
breakages were reported, but the fact the sensor hangs makes me think
it's driver's fault.

Hope this serves as a base for further investigations!

Thanks
   j

> Best regards,
> 								Pavel
> --
> People of Russia, stop Putin before his war on Ukraine escalates.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.libcamera.org/pipermail/libcamera-devel/attachments/20220723/9d8a794e/attachment.sig>


More information about the libcamera-devel mailing list