[libcamera-devel] [PATCH] libcamera: v4l2_videodevice: Explain multiplanar bytesused reasoning

Kieran Bingham kieran.bingham at ideasonboard.com
Thu Oct 14 10:54:05 CEST 2021


The ternary operation used to get the total bytesused of a V4L2 single
planar format which is stored in a multiplanar buffer can easily be
mis-read to think it's a bug, and appears to be reading the value of the
first of N planes as the total.

Directly explain the reasoning for why it looks like the condition is
inverted, as it is correct that the total bytes used is stored in only
the first plane of the multiplanar buffer.

Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
---
 src/libcamera/v4l2_videodevice.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp
index ba5f88cd41ed..f4752f8bb23f 100644
--- a/src/libcamera/v4l2_videodevice.cpp
+++ b/src/libcamera/v4l2_videodevice.cpp
@@ -1711,6 +1711,7 @@ FrameBuffer *V4L2VideoDevice::dequeueBuffer()
 			return buffer;
 		}
 
+		/* Single planar format stored in a multiplanar buffer */
 		unsigned int bytesused = multiPlanar ? planes[0].bytesused
 				       : buf.bytesused;
 
-- 
2.30.2



More information about the libcamera-devel mailing list