[libcamera-devel] pipeline: rpi: Account for Bayer packing when validating format
diff mbox series

Message ID 20230630134232.1295-1-naush@raspberrypi.com
State Accepted
Commit 7802471a3badb561f1e017c3ecdafc95a0a43d61
Headers show
Series
  • [libcamera-devel] pipeline: rpi: Account for Bayer packing when validating format
Related show

Commit Message

Naushir Patuck June 30, 2023, 1:42 p.m. UTC
RPiCameraConfiguration::validate() did not account for user supplied
Bayer packing when validating the RAW stream configuration. Fix this
by seeing what packing (if any) has been specified selecting the output
RAW stream format.

Fixes: 6c71ee1f1530 ("pipeline: raspberrypi: Introduce PipelineHandlerBase class")
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
---
 src/libcamera/pipeline/rpi/common/pipeline_base.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Kieran Bingham July 5, 2023, 4:52 p.m. UTC | #1
Quoting Naushir Patuck via libcamera-devel (2023-06-30 14:42:32)
> RPiCameraConfiguration::validate() did not account for user supplied
> Bayer packing when validating the RAW stream configuration. Fix this
> by seeing what packing (if any) has been specified selecting the output
> RAW stream format.
> 
> Fixes: 6c71ee1f1530 ("pipeline: raspberrypi: Introduce PipelineHandlerBase class")
> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> ---
>  src/libcamera/pipeline/rpi/common/pipeline_base.cpp | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp
> index df7482920e75..2eb71beaff55 100644
> --- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp
> +++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp
> @@ -288,8 +288,8 @@ CameraConfiguration::Status RPiCameraConfiguration::validate()
>                 unsigned int bitDepth = info.isValid() ? info.bitsPerPixel : defaultRawBitDepth;
>                 V4L2SubdeviceFormat sensorFormat = findBestFormat(data_->sensorFormats_, cfg.size, bitDepth);
>  
> -               rawFormat.size = sensorFormat.size;
> -               rawFormat.fourcc = raw.dev->toV4L2PixelFormat(cfg.pixelFormat);
> +               BayerFormat::Packing packing = BayerFormat::fromPixelFormat(cfg.pixelFormat).packing;
> +               rawFormat = PipelineHandlerBase::toV4L2DeviceFormat(raw.dev, sensorFormat, packing);
>  
>                 int ret = raw.dev->tryFormat(&rawFormat);
>                 if (ret)
> -- 
> 2.34.1
>
David Plowman July 6, 2023, 9:01 a.m. UTC | #2
Hi Naush

Thanks for the patch.

On Wed, 5 Jul 2023 at 17:52, Kieran Bingham via libcamera-devel
<libcamera-devel@lists.libcamera.org> wrote:
>
> Quoting Naushir Patuck via libcamera-devel (2023-06-30 14:42:32)
> > RPiCameraConfiguration::validate() did not account for user supplied
> > Bayer packing when validating the RAW stream configuration. Fix this
> > by seeing what packing (if any) has been specified selecting the output
> > RAW stream format.
> >
> > Fixes: 6c71ee1f1530 ("pipeline: raspberrypi: Introduce PipelineHandlerBase class")
> > Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
>
> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

Reviewed-by: David Plowman <david.plowman@raspberrypi.com>

Thanks!
David

>
> > ---
> >  src/libcamera/pipeline/rpi/common/pipeline_base.cpp | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp
> > index df7482920e75..2eb71beaff55 100644
> > --- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp
> > +++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp
> > @@ -288,8 +288,8 @@ CameraConfiguration::Status RPiCameraConfiguration::validate()
> >                 unsigned int bitDepth = info.isValid() ? info.bitsPerPixel : defaultRawBitDepth;
> >                 V4L2SubdeviceFormat sensorFormat = findBestFormat(data_->sensorFormats_, cfg.size, bitDepth);
> >
> > -               rawFormat.size = sensorFormat.size;
> > -               rawFormat.fourcc = raw.dev->toV4L2PixelFormat(cfg.pixelFormat);
> > +               BayerFormat::Packing packing = BayerFormat::fromPixelFormat(cfg.pixelFormat).packing;
> > +               rawFormat = PipelineHandlerBase::toV4L2DeviceFormat(raw.dev, sensorFormat, packing);
> >
> >                 int ret = raw.dev->tryFormat(&rawFormat);
> >                 if (ret)
> > --
> > 2.34.1
> >

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp
index df7482920e75..2eb71beaff55 100644
--- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp
+++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp
@@ -288,8 +288,8 @@  CameraConfiguration::Status RPiCameraConfiguration::validate()
 		unsigned int bitDepth = info.isValid() ? info.bitsPerPixel : defaultRawBitDepth;
 		V4L2SubdeviceFormat sensorFormat = findBestFormat(data_->sensorFormats_, cfg.size, bitDepth);
 
-		rawFormat.size = sensorFormat.size;
-		rawFormat.fourcc = raw.dev->toV4L2PixelFormat(cfg.pixelFormat);
+		BayerFormat::Packing packing = BayerFormat::fromPixelFormat(cfg.pixelFormat).packing;
+		rawFormat = PipelineHandlerBase::toV4L2DeviceFormat(raw.dev, sensorFormat, packing);
 
 		int ret = raw.dev->tryFormat(&rawFormat);
 		if (ret)