summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-09-03 11:52:20 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-09-07 19:18:16 +0300
commit17b9db376ccef2097018c40e17da884e619dd360 (patch)
treea934812115f08abd607209fbc509381a21f25788
parent6d98fe5b683a38748d708c810d52d5f96e312bda (diff)
libcamera: v4l2_videodevice: Document plane handling in createBuffer()
The V4L2VideoDevice::createBuffer() calculates offsets manually when using a multi-planar pixel format and a single-planar V4L2 format. The process isn't trivial, document it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
-rw-r--r--src/libcamera/v4l2_videodevice.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp
index 1483181a..88535f5a 100644
--- a/src/libcamera/v4l2_videodevice.cpp
+++ b/src/libcamera/v4l2_videodevice.cpp
@@ -1334,10 +1334,19 @@ std::unique_ptr<FrameBuffer> V4L2VideoDevice::createBuffer(unsigned int index)
}
/*
+ * If we have a multi-planar format with a V4L2 single-planar buffer,
+ * split the single V4L2 plane into multiple FrameBuffer planes by
+ * computing the offsets manually.
+ *
* The format info is not guaranteed to be valid, as there are no
* PixelFormatInfo for metadata formats, so check it first.
*/
if (formatInfo_->isValid() && formatInfo_->numPlanes() != numPlanes) {
+ /*
+ * There's no valid situation where the number of colour planes
+ * differs from the number of V4L2 planes and the V4L2 buffer
+ * has more than one plane.
+ */
ASSERT(numPlanes == 1u);
planes.resize(formatInfo_->numPlanes());