[libcamera-devel] [RFC PATCH v1 00/12] libcamera: Handle fallout of FrameBuffer offset support

Laurent Pinchart laurent.pinchart at ideasonboard.com
Thu Sep 2 06:22:51 CEST 2021


Hello everybody,

This patch series started as an investigation of a qcam failure with
IPU3 after the merge of the FrameBuffer offset support. While a hack in
qcam would be possible, I decided to instead address the core issue and
fix it in V4L2VideoDevice.

The series only covers the changes needed in the libcamera core. qcam is
still broken, and this actually introduces a breakage with cam as well.
I wouldn't be surprised if the adaptation layers (Android, GStreamer and
V4L2) were also broken somehow by this series when the camera produces
multi-planar formats. I will address that as a next step, but I'd like
feedback on the changes in the core first as they will have an impact on
the applications and adaptation layers.

The most important change is in patches 10/12 and 11/12, which translate
between V4L2 buffers and libcamera FrameBuffer to handle the case where
a multi-planar frame buffer is used with the V4L2 single-planar API.
It's working more or less by chance at the moment (except in qcam where
it's broken, and possibly in other places I haven't tested). Patches
01/12 to 09/12 are cleanups and additions to prepare for the work in
V4L2VideoDevice, and patch 12/12 is a small cleanup on top.

This series doesn't break any unit test, as vimc doesn't support NV12.
Addition of NV12 support to the vimc kernel driver would be very nice,
in order to test multi-planar support in our unit tests. Volunteers are
welcome ;-)

Laurent Pinchart (12):
  libcamera: base: utils: Use size_t for index in utils::enumerate()
  libcamera: file_descriptor: Add a function to retrieve the inode
  libcamera: formats: Add planeSize() helpers to PixelFormatInfo
  libcamera: formats: Support V4L2 non-contiguous formats
  libcamera: framebuffer: Move planes check to constructor
  libcamera: framebuffer: Add a function to check if planes are
    contiguous
  libcamera: framebuffer: Allocate metadata planes at construction time
  libcamera: framebuffer: Prevent modifying the number of metadata
    planes
  libcamera: v4l2_videodevice: Cache PixelFormatInfo
  libcamera: v4l2_videodevice: Coalesce planes when queuing buffer
  libcamera: v4l2_videodevice: Split planes when dequeuing buffer
  libcamera: v4l2_videodevice: Use utils::enumerate()

 include/libcamera/base/utils.h                |   4 +-
 include/libcamera/file_descriptor.h           |   3 +
 include/libcamera/framebuffer.h               |  19 +-
 include/libcamera/internal/formats.h          |   6 +-
 include/libcamera/internal/framebuffer.h      |   2 +
 include/libcamera/internal/v4l2_videodevice.h |   1 +
 src/android/mm/generic_camera_buffer.cpp      |  11 +-
 src/android/yuv/post_processor_yuv.cpp        |  10 +-
 src/cam/camera_session.cpp                    |   4 +-
 src/cam/file_sink.cpp                         |   2 +-
 src/libcamera/file_descriptor.cpp             |  22 ++
 src/libcamera/formats.cpp                     | 223 ++++++++++++------
 src/libcamera/framebuffer.cpp                 |  60 ++++-
 src/libcamera/pipeline/ipu3/cio2.cpp          |   2 +-
 src/libcamera/v4l2_pixelformat.cpp            |  11 +-
 src/libcamera/v4l2_videodevice.cpp            | 148 +++++++++---
 src/qcam/main_window.cpp                      |   2 +-
 src/qcam/viewfinder_gl.cpp                    |   2 +-
 src/qcam/viewfinder_qt.cpp                    |   2 +-
 src/v4l2/v4l2_camera_proxy.cpp                |   8 +-
 test/utils.cpp                                |  10 +-
 21 files changed, 402 insertions(+), 150 deletions(-)

-- 
Regards,

Laurent Pinchart



More information about the libcamera-devel mailing list