[libcamera-devel,v2,2/2] pipeline: raspberrypi: Simplify calculation of sensor's native Bayer order
diff mbox series

Message ID 20220113141558.5805-3-david.plowman@raspberrypi.com
State Accepted
Commit b2290573c09ca3781fc0577f7785f8398a5780b2
Headers show
Series
  • Make sensor use its native Bayer order
Related show

Commit Message

David Plowman Jan. 13, 2022, 2:15 p.m. UTC
Now that the sensor is defined to list mbus codes using its native
(untransformed) Bayer order, the method of obtaining it can be
simplified. We don't have to try and reset the flips, we just use the
value directly from the sensor.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
---
 src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

Comments

Kieran Bingham Jan. 17, 2022, 11:22 a.m. UTC | #1
Quoting David Plowman (2022-01-13 14:15:58)
> Now that the sensor is defined to list mbus codes using its native
> (untransformed) Bayer order, the method of obtaining it can be
> simplified. We don't have to try and reset the flips, we just use the
> value directly from the sensor.
> 
> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>


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

> ---
>  src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> index 49d7ff23..79cb75c6 100644
> --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> @@ -1279,8 +1279,8 @@ int PipelineHandlerRPi::registerCamera(MediaDevice *unicam, MediaDevice *isp, Me
>          * Thirdly, what is the "native" Bayer order, when no transforms are
>          * applied?
>          *
> -        * As part of answering the final question, we reset the camera to
> -        * no transform at all.
> +        * We note that the sensor's cached list of supported formats is
> +        * already in the "native" order, with any flips having been undone.
>          */
>         const V4L2Subdevice *sensor = data->sensor_->device();
>         const struct v4l2_query_ext_ctrl *hflipCtrl = sensor->controlInfo(V4L2_CID_HFLIP);
> @@ -1288,11 +1288,6 @@ int PipelineHandlerRPi::registerCamera(MediaDevice *unicam, MediaDevice *isp, Me
>                 /* We assume it will support vflips too... */
>                 data->supportsFlips_ = true;
>                 data->flipsAlterBayerOrder_ = hflipCtrl->flags & V4L2_CTRL_FLAG_MODIFY_LAYOUT;
> -
> -               ControlList ctrls(data->sensor_->controls());
> -               ctrls.set(V4L2_CID_HFLIP, 0);
> -               ctrls.set(V4L2_CID_VFLIP, 0);
> -               data->setSensorControls(ctrls);
>         }
>  
>         /* Look for a valid Bayer format. */
> -- 
> 2.30.2
>
Naushir Patuck Jan. 17, 2022, 2:58 p.m. UTC | #2
Hi David,

Thank you for your patch.

On Thu, 13 Jan 2022 at 14:16, David Plowman <david.plowman@raspberrypi.com>
wrote:

> Now that the sensor is defined to list mbus codes using its native
> (untransformed) Bayer order, the method of obtaining it can be
> simplified. We don't have to try and reset the flips, we just use the
> value directly from the sensor.
>
> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
>

Reviewed-by: Naushir Patuck <naush@raspberrypi.com>


> ---
>  src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> index 49d7ff23..79cb75c6 100644
> --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> @@ -1279,8 +1279,8 @@ int PipelineHandlerRPi::registerCamera(MediaDevice
> *unicam, MediaDevice *isp, Me
>          * Thirdly, what is the "native" Bayer order, when no transforms
> are
>          * applied?
>          *
> -        * As part of answering the final question, we reset the camera to
> -        * no transform at all.
> +        * We note that the sensor's cached list of supported formats is
> +        * already in the "native" order, with any flips having been
> undone.
>          */
>         const V4L2Subdevice *sensor = data->sensor_->device();
>         const struct v4l2_query_ext_ctrl *hflipCtrl =
> sensor->controlInfo(V4L2_CID_HFLIP);
> @@ -1288,11 +1288,6 @@ int PipelineHandlerRPi::registerCamera(MediaDevice
> *unicam, MediaDevice *isp, Me
>                 /* We assume it will support vflips too... */
>                 data->supportsFlips_ = true;
>                 data->flipsAlterBayerOrder_ = hflipCtrl->flags &
> V4L2_CTRL_FLAG_MODIFY_LAYOUT;
> -
> -               ControlList ctrls(data->sensor_->controls());
> -               ctrls.set(V4L2_CID_HFLIP, 0);
> -               ctrls.set(V4L2_CID_VFLIP, 0);
> -               data->setSensorControls(ctrls);
>         }
>
>         /* Look for a valid Bayer format. */
> --
> 2.30.2
>
>

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index 49d7ff23..79cb75c6 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -1279,8 +1279,8 @@  int PipelineHandlerRPi::registerCamera(MediaDevice *unicam, MediaDevice *isp, Me
 	 * Thirdly, what is the "native" Bayer order, when no transforms are
 	 * applied?
 	 *
-	 * As part of answering the final question, we reset the camera to
-	 * no transform at all.
+	 * We note that the sensor's cached list of supported formats is
+	 * already in the "native" order, with any flips having been undone.
 	 */
 	const V4L2Subdevice *sensor = data->sensor_->device();
 	const struct v4l2_query_ext_ctrl *hflipCtrl = sensor->controlInfo(V4L2_CID_HFLIP);
@@ -1288,11 +1288,6 @@  int PipelineHandlerRPi::registerCamera(MediaDevice *unicam, MediaDevice *isp, Me
 		/* We assume it will support vflips too... */
 		data->supportsFlips_ = true;
 		data->flipsAlterBayerOrder_ = hflipCtrl->flags & V4L2_CTRL_FLAG_MODIFY_LAYOUT;
-
-		ControlList ctrls(data->sensor_->controls());
-		ctrls.set(V4L2_CID_HFLIP, 0);
-		ctrls.set(V4L2_CID_VFLIP, 0);
-		data->setSensorControls(ctrls);
 	}
 
 	/* Look for a valid Bayer format. */