[libcamera-devel] [PATCH] pipeline: rpi: Don't call toV4L2DeviceFormat() from validate()

Jacopo Mondi jacopo.mondi at ideasonboard.com
Thu Jul 27 16:21:40 CEST 2023


Hi Naush

On Thu, Jul 27, 2023 at 02:01:07PM +0100, Naushir Patuck wrote:
> Don't make an unnecessary call to toV4L2DeviceFormat() from validate()
> to get a V4L2DeviceFormat. Instead, the conversion can happen directly
> from the RAW stream PixelFormat.
>
> Signed-off-by: Naushir Patuck <naush at raspberrypi.com>
> ---
>  src/libcamera/pipeline/rpi/common/pipeline_base.cpp | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp
> index e0fbeec37fe9..97acafbbb728 100644
> --- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp
> +++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp
> @@ -226,10 +226,11 @@ CameraConfiguration::Status RPiCameraConfiguration::validate()
>  	/* Further fixups on the RAW streams. */
>  	for (auto &raw : rawStreams) {
>  		StreamConfiguration &cfg = config_.at(raw.index);
> -		V4L2DeviceFormat rawFormat;
>
> -		BayerFormat::Packing packing = BayerFormat::fromPixelFormat(cfg.pixelFormat).packing;
> -		rawFormat = PipelineHandlerBase::toV4L2DeviceFormat(raw.dev, sensorFormat_, packing);

Is the function still used ?

> +		V4L2DeviceFormat rawFormat;
> +		rawFormat.fourcc = raw.dev->toV4L2PixelFormat(cfg.pixelFormat);
> +		rawFormat.size = cfg.size;
> +		rawFormat.colorSpace = cfg.colorSpace;
>
>  		int ret = raw.dev->tryFormat(&rawFormat);
>  		if (ret)
> --
> 2.34.1
>


More information about the libcamera-devel mailing list