[libcamera-devel,4/7] ipa: raspberrypi: Move the controller initialise to ipa::init()
diff mbox series

Message ID 20210317100211.1067585-5-naush@raspberrypi.com
State Changes Requested
Headers show
Series
  • Raspberry Pi: ipa::init() restructuring
Related show

Commit Message

Naushir Patuck March 17, 2021, 10:02 a.m. UTC
The controller initialise is a one-off operation, so move it from
ipa::configure() to ipa::init().

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
---
 src/ipa/raspberrypi/raspberrypi.cpp | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

Comments

Laurent Pinchart March 22, 2021, 9:17 p.m. UTC | #1
Hi Naush,

Thank you for the patch.

On Wed, Mar 17, 2021 at 10:02:08AM +0000, Naushir Patuck wrote:
> The controller initialise is a one-off operation, so move it from
> ipa::configure() to ipa::init().
> 
> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>

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

> ---
>  src/ipa/raspberrypi/raspberrypi.cpp | 16 +++++-----------
>  1 file changed, 5 insertions(+), 11 deletions(-)
> 
> diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp
> index 8a9eb92b39ec..e2db0716b84b 100644
> --- a/src/ipa/raspberrypi/raspberrypi.cpp
> +++ b/src/ipa/raspberrypi/raspberrypi.cpp
> @@ -127,9 +127,6 @@ private:
>  	ControlInfoMap ispCtrls_;
>  	ControlList libcameraMetadata_;
>  
> -	/* IPA configuration. */
> -	std::string tuningFile_;
> -
>  	/* Camera sensor params. */
>  	CameraMode mode_;
>  	CameraMode lastMode_;
> @@ -166,8 +163,6 @@ private:
>  
>  int IPARPi::init(const IPASettings &settings, ipa::RPi::SensorConfig *sensorConfig)
>  {
> -	tuningFile_ = settings.configurationFile;
> -
>  	/*
>  	 * Load the "helper" for this sensor. This tells us all the device specific stuff
>  	 * that the kernel driver doesn't. We only do this the first time; we don't need
> @@ -193,6 +188,10 @@ int IPARPi::init(const IPASettings &settings, ipa::RPi::SensorConfig *sensorConf
>  	sensorConfig->vblankDelay = vblankDelay;
>  	sensorConfig->sensorMetadata = sensorMetadata;
>  
> +	/* Load the tuning file for this sensor. */
> +	controller_.Read(settings.configurationFile.c_str());
> +	controller_.Initialise();
> +
>  	return 0;
>  }
>  
> @@ -374,12 +373,7 @@ int IPARPi::configure(const CameraSensorInfo &sensorInfo,
>  	/* Pass the camera mode to the CamHelper to setup algorithms. */
>  	helper_->SetCameraMode(mode_);
>  
> -	if (!controllerInit_) {
> -		/* Load the tuning file for this sensor. */
> -		controller_.Read(tuningFile_.c_str());
> -		controller_.Initialise();
> -		controllerInit_ = true;
> -
> +	if (firstStart_) {
>  		/* Supply initial values for frame durations. */
>  		applyFrameDurations(defaultMinFrameDuration, defaultMaxFrameDuration);
>

Patch
diff mbox series

diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp
index 8a9eb92b39ec..e2db0716b84b 100644
--- a/src/ipa/raspberrypi/raspberrypi.cpp
+++ b/src/ipa/raspberrypi/raspberrypi.cpp
@@ -127,9 +127,6 @@  private:
 	ControlInfoMap ispCtrls_;
 	ControlList libcameraMetadata_;
 
-	/* IPA configuration. */
-	std::string tuningFile_;
-
 	/* Camera sensor params. */
 	CameraMode mode_;
 	CameraMode lastMode_;
@@ -166,8 +163,6 @@  private:
 
 int IPARPi::init(const IPASettings &settings, ipa::RPi::SensorConfig *sensorConfig)
 {
-	tuningFile_ = settings.configurationFile;
-
 	/*
 	 * Load the "helper" for this sensor. This tells us all the device specific stuff
 	 * that the kernel driver doesn't. We only do this the first time; we don't need
@@ -193,6 +188,10 @@  int IPARPi::init(const IPASettings &settings, ipa::RPi::SensorConfig *sensorConf
 	sensorConfig->vblankDelay = vblankDelay;
 	sensorConfig->sensorMetadata = sensorMetadata;
 
+	/* Load the tuning file for this sensor. */
+	controller_.Read(settings.configurationFile.c_str());
+	controller_.Initialise();
+
 	return 0;
 }
 
@@ -374,12 +373,7 @@  int IPARPi::configure(const CameraSensorInfo &sensorInfo,
 	/* Pass the camera mode to the CamHelper to setup algorithms. */
 	helper_->SetCameraMode(mode_);
 
-	if (!controllerInit_) {
-		/* Load the tuning file for this sensor. */
-		controller_.Read(tuningFile_.c_str());
-		controller_.Initialise();
-		controllerInit_ = true;
-
+	if (firstStart_) {
 		/* Supply initial values for frame durations. */
 		applyFrameDurations(defaultMinFrameDuration, defaultMaxFrameDuration);