[PATCH v1 2/3] libcamera: virtual: Query number of planes correctly

Laurent Pinchart laurent.pinchart at ideasonboard.com
Wed Dec 11 17:47:03 CET 2024


Hi Barnabás,

Thank you for the patch.

On Wed, Dec 11, 2024 at 03:25:50PM +0000, Barnabás Pőcze wrote:
> `PixelFormatInfo::planes.size()` always returns 3 since `planes` is
> an array, but that is not the number of planes of the pixel format.
> Use the `numPlanes()` getter instead.
> 
> Signed-off-by: Barnabás Pőcze <pobrn at protonmail.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

> ---
>  src/libcamera/pipeline/virtual/virtual.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/libcamera/pipeline/virtual/virtual.cpp b/src/libcamera/pipeline/virtual/virtual.cpp
> index 3126bdd7d..aae94efee 100644
> --- a/src/libcamera/pipeline/virtual/virtual.cpp
> +++ b/src/libcamera/pipeline/virtual/virtual.cpp
> @@ -278,7 +278,7 @@ int PipelineHandlerVirtual::exportFrameBuffers([[maybe_unused]] Camera *camera,
>  	const PixelFormatInfo &info = PixelFormatInfo::info(config.pixelFormat);
>  
>  	std::vector<unsigned int> planeSizes;
> -	for (size_t i = 0; i < info.planes.size(); ++i)
> +	for (size_t i = 0; i < info.numPlanes(); ++i)
>  		planeSizes.push_back(info.planeSize(config.size, i));
>  
>  	return dmaBufAllocator_.exportBuffers(config.bufferCount, planeSizes, buffers);

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list