[libcamera-devel,2/2] pipeline: raspberrypi: Always save sensor params on IPA_RESULT_SENSOR_PARAMS
diff mbox series

Message ID 20210201125633.26242-2-naush@raspberrypi.com
State Accepted
Headers show
Series
  • [libcamera-devel,1/2] pipeline: ipa: raspberrypi: Rename RPi::ConfigParameters enum values
Related show

Commit Message

Naushir Patuck Feb. 1, 2021, 12:56 p.m. UTC
Fixup logic when handling IPA_RESULT_SENSOR_PARAMS where we must always
overwrite the parameters if provided by IPA. In the current codebase,
this only happens once on startup, so there is no effective functional
difference. But this change allows the option for the IPA to request new
sensor parameters per-mode if required.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
---
 .../pipeline/raspberrypi/raspberrypi.cpp         | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

Comments

Laurent Pinchart Feb. 4, 2021, 10:04 p.m. UTC | #1
Hi Naush,

Thank you for the patch.

On Mon, Feb 01, 2021 at 12:56:33PM +0000, Naushir Patuck wrote:
> Fixup logic when handling IPA_RESULT_SENSOR_PARAMS where we must always
> overwrite the parameters if provided by IPA. In the current codebase,
> this only happens once on startup, so there is no effective functional
> difference. But this change allows the option for the IPA to request new
> sensor parameters per-mode if required.
> 
> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>

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

> ---
>  .../pipeline/raspberrypi/raspberrypi.cpp         | 16 +++++++---------
>  1 file changed, 7 insertions(+), 9 deletions(-)
> 
> diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> index 48e5943edc1a..63bdbe2b91bd 100644
> --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> @@ -1224,17 +1224,15 @@ int RPiCameraData::configureIPA(const CameraConfiguration *config)
>  		 * Setup our delayed control writer with the sensor default
>  		 * gain and exposure delays.
>  		 */
> -		if (!delayedCtrls_) {
> -			std::unordered_map<uint32_t, unsigned int> delays = {
> -				{ V4L2_CID_ANALOGUE_GAIN, result.data[resultIdx++] },
> -				{ V4L2_CID_EXPOSURE, result.data[resultIdx++] },
> -				{ V4L2_CID_VBLANK, result.data[resultIdx++] }
> -			};
> +		std::unordered_map<uint32_t, unsigned int> delays = {
> +			{ V4L2_CID_ANALOGUE_GAIN, result.data[resultIdx++] },
> +			{ V4L2_CID_EXPOSURE, result.data[resultIdx++] },
> +			{ V4L2_CID_VBLANK, result.data[resultIdx++] }
> +		};
>  
> -			delayedCtrls_ = std::make_unique<DelayedControls>(unicam_[Unicam::Image].dev(), delays);
> +		delayedCtrls_ = std::make_unique<DelayedControls>(unicam_[Unicam::Image].dev(), delays);
>  
> -			sensorMetadata_ = result.data[resultIdx++];
> -		}
> +		sensorMetadata_ = result.data[resultIdx++];
>  	}
>  
>  	if (result.operation & RPi::IPA_RESULT_SENSOR_CTRLS) {

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index 48e5943edc1a..63bdbe2b91bd 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -1224,17 +1224,15 @@  int RPiCameraData::configureIPA(const CameraConfiguration *config)
 		 * Setup our delayed control writer with the sensor default
 		 * gain and exposure delays.
 		 */
-		if (!delayedCtrls_) {
-			std::unordered_map<uint32_t, unsigned int> delays = {
-				{ V4L2_CID_ANALOGUE_GAIN, result.data[resultIdx++] },
-				{ V4L2_CID_EXPOSURE, result.data[resultIdx++] },
-				{ V4L2_CID_VBLANK, result.data[resultIdx++] }
-			};
+		std::unordered_map<uint32_t, unsigned int> delays = {
+			{ V4L2_CID_ANALOGUE_GAIN, result.data[resultIdx++] },
+			{ V4L2_CID_EXPOSURE, result.data[resultIdx++] },
+			{ V4L2_CID_VBLANK, result.data[resultIdx++] }
+		};
 
-			delayedCtrls_ = std::make_unique<DelayedControls>(unicam_[Unicam::Image].dev(), delays);
+		delayedCtrls_ = std::make_unique<DelayedControls>(unicam_[Unicam::Image].dev(), delays);
 
-			sensorMetadata_ = result.data[resultIdx++];
-		}
+		sensorMetadata_ = result.data[resultIdx++];
 	}
 
 	if (result.operation & RPi::IPA_RESULT_SENSOR_CTRLS) {