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

Message ID 20261109203112.61688-1-faizel.kb@gmail.com
State New
Headers show
Series
  • [v2] libcamera: pipeline: simple: Set planesCount for the capture format
Related show

Commit Message

Faizel K B Nov. 9, 2026, 8:31 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 to 1, as
the pipeline handler only supports formats stored in a single memory
plane.

Fixes: ff5cb4f17b0b ("software_isp: debayer_egl: Request input buffer alignment of 256 bytes")
Signed-off-by: Faizel K B <faizel.kb@gmail.com>
---
Changes in v2:
- Set planesCount to 1 instead of PixelFormatInfo::numPlanes(), which
  counts colour planes rather than memory planes (Robert)
- Link to v1 - https://patchwork.libcamera.org/patch/28662/

The rkcif kernel changes needed to honour the requested stride.
https://lore.kernel.org/linux-media/20261105232310.385463-1-faizel.kb@gmail.com

 src/libcamera/pipeline/simple/simple.cpp | 1 +
 1 file changed, 1 insertion(+)

Comments

Barnabás Pőcze Nov. 10, 2026, 11:14 a.m. UTC | #1
2026. 11. 09. 21:31 keltezéssel, Faizel K B írta:
> 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 to 1, as
> the pipeline handler only supports formats stored in a single memory
> plane.
> 
> Fixes: ff5cb4f17b0b ("software_isp: debayer_egl: Request input buffer alignment of 256 bytes")
> Signed-off-by: Faizel K B <faizel.kb@gmail.com>
> ---

I suppose it's not an issue if `bytesperline == 0` is getting passed into kernel,
when `requested_bpl` is not updated (`!data->swIsp_`) (the kernel driver should
update it). So it looks ok to me.

Acked-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>


> Changes in v2:
> - Set planesCount to 1 instead of PixelFormatInfo::numPlanes(), which
>    counts colour planes rather than memory planes (Robert)
> - Link to v1 - https://patchwork.libcamera.org/patch/28662/
> 
> The rkcif kernel changes needed to honour the requested stride.
> https://lore.kernel.org/linux-media/20261105232310.385463-1-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 35e066499..8e22c90c1 100644
> --- a/src/libcamera/pipeline/simple/simple.cpp
> +++ b/src/libcamera/pipeline/simple/simple.cpp
> @@ -1588,6 +1588,7 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c)
>   	V4L2DeviceFormat captureFormat;
>   	captureFormat.fourcc = videoFormat;
>   	captureFormat.size = pipeConfig->captureSize;
> +	captureFormat.planesCount = 1;
>   
>   	uint32_t requested_bpl = 0;
>   	if (data->swIsp_)
Faizel K B Nov. 10, 2026, 5:30 p.m. UTC | #2
Hi Barnabás,

On Tue, Nov 10, 2026 at 12:14:08PM +0100, Barnabás Pőcze wrote:
>2026. 11. 09. 21:31 keltezéssel, Faizel K B írta:
>>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 to 1, as
>>the pipeline handler only supports formats stored in a single memory
>>plane.
>>
>>Fixes: ff5cb4f17b0b ("software_isp: debayer_egl: Request input buffer alignment of 256 bytes")
>>Signed-off-by: Faizel K B <faizel.kb@gmail.com>
>>---
>
>I suppose it's not an issue if `bytesperline == 0` is getting passed into kernel,
>when `requested_bpl` is not updated (`!data->swIsp_`) (the kernel driver should
>update it). So it looks ok to me.
>

Yes, in that case the driver picks its default bytesperline. The stride
only matters when the Software ISP imports the buffers into the GPU,
which is the case this patch fixes.

>Acked-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>

Thanks for the review.

Regards
Faizel

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp
index 35e066499..8e22c90c1 100644
--- a/src/libcamera/pipeline/simple/simple.cpp
+++ b/src/libcamera/pipeline/simple/simple.cpp
@@ -1588,6 +1588,7 @@  int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c)
 	V4L2DeviceFormat captureFormat;
 	captureFormat.fourcc = videoFormat;
 	captureFormat.size = pipeConfig->captureSize;
+	captureFormat.planesCount = 1;
 
 	uint32_t requested_bpl = 0;
 	if (data->swIsp_)