libcamera: pipeline: simple: Set planesCount for the capture format
diff mbox series

Message ID 20261028233232.543432-1-faizel.kb@gmail.com
State Superseded
Headers show
Series
  • libcamera: pipeline: simple: Set planesCount for the capture format
Related show

Commit Message

Faizel K B Oct. 28, 2026, 11:32 p.m. UTC
The stride requested by the simple pipeline handler is ignored by
V4L2VideoDevice::trySetFormatMultiplane(), which copies bytesperline
only for planesCount planes, and planesCount is zero. Set it from the
video format.

Fixes: ff5cb4f17b0b ("software_isp: debayer_egl: Request input buffer alignment of 256 bytes")
Signed-off-by: Faizel K B <faizel.kb@gmail.com>
---
 src/libcamera/pipeline/simple/simple.cpp | 1 +
 1 file changed, 1 insertion(+)

Comments

Faizel K B Oct. 29, 2026, 7:12 p.m. UTC | #1
On Thu, Oct 29, 2026 at 09:40:53AM +0100, Robert Mader wrote:
>Hi, thanks for the patch and good catch. I assume you're working on 
>making the kernel driver accept the bytesperline value? That makes me 
>very happy :)

Hi. Yes I am working on this topic. I will post it and keep you in cc :)

>
>On 29.10.26 00:32, Faizel K B wrote:
>>The stride requested by the simple pipeline handler is ignored by
>>V4L2VideoDevice::trySetFormatMultiplane(), which copies bytesperline
>>only for planesCount planes, and planesCount is zero. Set it from the
>>video format.
>In trySetFormatMultiplane() we already assert on not setting 
>planesCount too high for the selected format - maybe we also want to 
>assert on > 0. Or even on "ASSERT(pix->num_planes == 
>std::size(pix->plane_fmt));". This would be a question for the 
>libcamera maintainers - Laurent, Kieran, Barnabás, do you have 
>opinions on that?
>>
>>Fixes: ff5cb4f17b0b ("software_isp: debayer_egl: Request input buffer alignment of 256 bytes")
>>Signed-off-by: Faizel K B <faizel.kb@gmail.com>
>>---
>>  src/libcamera/pipeline/simple/simple.cpp | 1 +
>>  1 file changed, 1 insertion(+)
>>
>>diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp
>>index 38e94a159..8910c3ae1 100644
>>--- a/src/libcamera/pipeline/simple/simple.cpp
>>+++ b/src/libcamera/pipeline/simple/simple.cpp
>>@@ -1553,6 +1553,7 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c)
>>  	V4L2DeviceFormat captureFormat;
>>  	captureFormat.fourcc = videoFormat;
>>  	captureFormat.size = pipeConfig->captureSize;
>>+	captureFormat.planesCount = PixelFormatInfo::info(videoFormat).numPlanes();
>A few lines later we check for "captureFormat.planesCount != 1" - so 
>might as well set 1 here until we add support for non-contiguous 
>formats.

I agree. Yes I can send a v2. Will wait for other comments before. 

>>  	uint32_t requested_bpl = 0;
>>  	if (data->swIsp_)
>
>-- 
>Robert Mader
>Consultant Software Developer
>
>Collabora Ltd.
>Platinum Building, St John's Innovation Park, Cambridge CB4 0DS, UK
>Registered in England & Wales, no. 5513718
>

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp
index 38e94a159..8910c3ae1 100644
--- a/src/libcamera/pipeline/simple/simple.cpp
+++ b/src/libcamera/pipeline/simple/simple.cpp
@@ -1553,6 +1553,7 @@  int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c)
 	V4L2DeviceFormat captureFormat;
 	captureFormat.fourcc = videoFormat;
 	captureFormat.size = pipeConfig->captureSize;
+	captureFormat.planesCount = PixelFormatInfo::info(videoFormat).numPlanes();
 
 	uint32_t requested_bpl = 0;
 	if (data->swIsp_)