[libcamera-devel,v3,0/6] libcamera: Map multiple V4L2 formats to a single libcamera::format
mbox series

Message ID 20220729160014.101503-1-jacopo@jmondi.org
Headers show
Series
  • libcamera: Map multiple V4L2 formats to a single libcamera::format
Related show

Message

Jacopo Mondi July 29, 2022, 4 p.m. UTC
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.

When testing on Pinephone I was able to capture JPEG (but not to inspect images)
and YUYV. As soon as I was about to run cam with SDL backend on pinephone, the
back sensor started failing consistently at boot with:

[   15.772368] ov5640 3-004c: ov5640_init_slave_id: failed with -6

Have I broke my pinephone camera ??

If anyone else would like to test:
 cam -c2 --stream pixelformat=YUYV,width=640,height=480 -C -S

(Assuming you have SDL2 installed on your system and available at build time)

Anyway, formats mapping works it seems...

I have dropped all tags, as the series is now rather different than v2.

v2->v3:
- Resorted patches as suggested by Laurent
- Remove 'multiplanar' argument in the call chain
- Cache the V4L2VideoDevice formats at open() time

v1->v2:
- Add a missing conversion using the video device in Simple converter
- Map formats::MJPEG to V4L2_PIX_FMT_JPEG in v4l2 formats enumeration

Jacopo Mondi (6):
  libcamera: formats: Merge V4L2 single and multi formats
  libcamera: formats: Search PixelFormatInfo on multiple formats
  libcamera: v4l2_videodevice: Reintroduce toV4L2PixelFormat()
  libcamera: v4l2_pixelformat: Return the list of V4L2 formats
  libcamera: v4l2_videodevice: Match formats supported by the device
  libcamera: formats: Map V4L2_PIX_FMT_JPEG to formats::MJPEG

 Documentation/guides/pipeline-handler.rst     |   7 +-
 include/libcamera/internal/formats.h          |   5 +-
 include/libcamera/internal/v4l2_pixelformat.h |   5 +-
 include/libcamera/internal/v4l2_videodevice.h |   3 +
 src/libcamera/formats.cpp                     | 320 +++++-------------
 src/libcamera/pipeline/ipu3/cio2.cpp          |   2 +-
 src/libcamera/pipeline/ipu3/imgu.cpp          |   2 +-
 .../pipeline/raspberrypi/raspberrypi.cpp      |  34 +-
 src/libcamera/pipeline/rkisp1/rkisp1_path.cpp |   6 +-
 src/libcamera/pipeline/simple/converter.cpp   |  10 +-
 src/libcamera/pipeline/simple/simple.cpp      |   4 +-
 src/libcamera/pipeline/uvcvideo/uvcvideo.cpp  |   6 +-
 src/libcamera/pipeline/vimc/vimc.cpp          |   8 +-
 src/libcamera/v4l2_pixelformat.cpp            |  23 +-
 src/libcamera/v4l2_videodevice.cpp            |  32 ++
 src/v4l2/v4l2_camera_proxy.cpp                |   6 +-
 test/libtest/buffer_source.cpp                |   2 +-
 17 files changed, 180 insertions(+), 295 deletions(-)

--
2.37.1