[libcamera-devel,v1,2/8] ipa: rkisp1: Instantiate CameraSensorHelper
diff mbox series

Message ID 20211119111654.68445-3-jeanmichel.hautbois@ideasonboard.com
State Superseded
Headers show
Series
  • Introduce AGC for RkISP1
Related show

Commit Message

Jean-Michel Hautbois Nov. 19, 2021, 11:16 a.m. UTC
When the AGC will run, it will use analogue gains as double values. We
will need those values to be converted to apply the control. Introduce
CameraSensorHelper and call it at init().

Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
---
 src/ipa/rkisp1/rkisp1.cpp | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Kieran Bingham Nov. 19, 2021, 11:45 a.m. UTC | #1
Quoting Jean-Michel Hautbois (2021-11-19 11:16:48)
> When the AGC will run, it will use analogue gains as double values. We
> will need those values to be converted to apply the control. Introduce
> CameraSensorHelper and call it at init().
> 
> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>


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

> ---
>  src/ipa/rkisp1/rkisp1.cpp | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
> index 7ecbf8ae..ff8d8712 100644
> --- a/src/ipa/rkisp1/rkisp1.cpp
> +++ b/src/ipa/rkisp1/rkisp1.cpp
> @@ -25,6 +25,8 @@
>  
>  #include <libcamera/internal/mapped_framebuffer.h>
>  
> +#include "libipa/camera_sensor_helper.h"
> +
>  namespace libcamera {
>  
>  LOG_DEFINE_CATEGORY(IPARkISP1)
> @@ -73,6 +75,9 @@ private:
>         unsigned int hwHistBinNMax_;
>         unsigned int hwGammaOutMaxSamples_;
>         unsigned int hwHistogramWeightGridsSize_;
> +
> +       /* Interface to the Camera Helper */
> +       std::unique_ptr<CameraSensorHelper> camHelper_;
>  };
>  
>  int IPARkISP1::init([[maybe_unused]] const IPASettings &settings,
> @@ -100,6 +105,15 @@ int IPARkISP1::init([[maybe_unused]] const IPASettings &settings,
>         }
>  
>         LOG(IPARkISP1, Debug) << "Hardware revision is " << hwRevision;
> +
> +       camHelper_ = CameraSensorHelperFactory::create(settings.sensorModel);
> +       if (camHelper_ == nullptr) {
> +               LOG(IPARkISP1, Error)
> +                       << "Failed to create camera sensor helper for "
> +                       << settings.sensorModel;
> +               return -ENODEV;
> +       }
> +
>         return 0;
>  }
>  
> -- 
> 2.32.0
>
Laurent Pinchart Nov. 19, 2021, 1:13 p.m. UTC | #2
Hi Jean-Michel,

Thank you for the patch.

On Fri, Nov 19, 2021 at 12:16:48PM +0100, Jean-Michel Hautbois wrote:
> When the AGC will run, it will use analogue gains as double values. We
> will need those values to be converted to apply the control. Introduce
> CameraSensorHelper and call it at init().
> 
> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
> ---
>  src/ipa/rkisp1/rkisp1.cpp | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
> index 7ecbf8ae..ff8d8712 100644
> --- a/src/ipa/rkisp1/rkisp1.cpp
> +++ b/src/ipa/rkisp1/rkisp1.cpp
> @@ -25,6 +25,8 @@
>  
>  #include <libcamera/internal/mapped_framebuffer.h>
>  
> +#include "libipa/camera_sensor_helper.h"
> +
>  namespace libcamera {
>  
>  LOG_DEFINE_CATEGORY(IPARkISP1)
> @@ -73,6 +75,9 @@ private:
>  	unsigned int hwHistBinNMax_;
>  	unsigned int hwGammaOutMaxSamples_;
>  	unsigned int hwHistogramWeightGridsSize_;
> +
> +	/* Interface to the Camera Helper */
> +	std::unique_ptr<CameraSensorHelper> camHelper_;
>  };
>  
>  int IPARkISP1::init([[maybe_unused]] const IPASettings &settings,
> @@ -100,6 +105,15 @@ int IPARkISP1::init([[maybe_unused]] const IPASettings &settings,

You should drop the [[maybe_unused]].

>  	}
>  
>  	LOG(IPARkISP1, Debug) << "Hardware revision is " << hwRevision;
> +
> +	camHelper_ = CameraSensorHelperFactory::create(settings.sensorModel);
> +	if (camHelper_ == nullptr) {

	if (!camHelper_) {

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

> +		LOG(IPARkISP1, Error)
> +			<< "Failed to create camera sensor helper for "
> +			<< settings.sensorModel;
> +		return -ENODEV;
> +	}
> +
>  	return 0;
>  }
>

Patch
diff mbox series

diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
index 7ecbf8ae..ff8d8712 100644
--- a/src/ipa/rkisp1/rkisp1.cpp
+++ b/src/ipa/rkisp1/rkisp1.cpp
@@ -25,6 +25,8 @@ 
 
 #include <libcamera/internal/mapped_framebuffer.h>
 
+#include "libipa/camera_sensor_helper.h"
+
 namespace libcamera {
 
 LOG_DEFINE_CATEGORY(IPARkISP1)
@@ -73,6 +75,9 @@  private:
 	unsigned int hwHistBinNMax_;
 	unsigned int hwGammaOutMaxSamples_;
 	unsigned int hwHistogramWeightGridsSize_;
+
+	/* Interface to the Camera Helper */
+	std::unique_ptr<CameraSensorHelper> camHelper_;
 };
 
 int IPARkISP1::init([[maybe_unused]] const IPASettings &settings,
@@ -100,6 +105,15 @@  int IPARkISP1::init([[maybe_unused]] const IPASettings &settings,
 	}
 
 	LOG(IPARkISP1, Debug) << "Hardware revision is " << hwRevision;
+
+	camHelper_ = CameraSensorHelperFactory::create(settings.sensorModel);
+	if (camHelper_ == nullptr) {
+		LOG(IPARkISP1, Error)
+			<< "Failed to create camera sensor helper for "
+			<< settings.sensorModel;
+		return -ENODEV;
+	}
+
 	return 0;
 }