[libcamera-devel,v1,1/8] ipa: rkisp1: Pass IPASettings at init call
diff mbox series

Message ID 20211119111654.68445-2-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 IPA will be initialized, it will need to know the sensor model
used in order to properly call CameraSensorHelper for the analogue gain.
Modify the init definition in the pipeline handler and in the IPA as
well as the mojo interface to pass a IPASettings.

Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
---
 include/libcamera/ipa/rkisp1.mojom       | 4 +++-
 src/ipa/rkisp1/rkisp1.cpp                | 5 +++--
 src/libcamera/pipeline/rkisp1/rkisp1.cpp | 9 +++++----
 3 files changed, 11 insertions(+), 7 deletions(-)

Comments

Kieran Bingham Nov. 19, 2021, 11:43 a.m. UTC | #1
Quoting Jean-Michel Hautbois (2021-11-19 11:16:47)
> When the IPA will be initialized, it will need to know the sensor model

/will be/is/

> used in order to properly call CameraSensorHelper for the analogue gain.
> Modify the init definition in the pipeline handler and in the IPA as
> well as the mojo interface to pass a IPASettings.

/a /the /

> 
> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
> ---
>  include/libcamera/ipa/rkisp1.mojom       | 4 +++-
>  src/ipa/rkisp1/rkisp1.cpp                | 5 +++--
>  src/libcamera/pipeline/rkisp1/rkisp1.cpp | 9 +++++----
>  3 files changed, 11 insertions(+), 7 deletions(-)
> 
> diff --git a/include/libcamera/ipa/rkisp1.mojom b/include/libcamera/ipa/rkisp1.mojom
> index cae757ea..a6991d4f 100644
> --- a/include/libcamera/ipa/rkisp1.mojom
> +++ b/include/libcamera/ipa/rkisp1.mojom
> @@ -29,7 +29,9 @@ struct RkISP1Action {
>  };
>  
>  interface IPARkISP1Interface {
> -       init(uint32 hwRevision) => (int32 ret);
> +       init(libcamera.IPASettings settings,
> +            uint32 hwRevision)
> +               => (int32 ret);
>         start() => (int32 ret);
>         stop();
>  
> diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
> index bf2c13b6..7ecbf8ae 100644
> --- a/src/ipa/rkisp1/rkisp1.cpp
> +++ b/src/ipa/rkisp1/rkisp1.cpp
> @@ -34,7 +34,7 @@ namespace ipa::rkisp1 {
>  class IPARkISP1 : public IPARkISP1Interface
>  {
>  public:
> -       int init(unsigned int hwRevision) override;
> +       int init(const IPASettings &settings, unsigned int hwRevision) override;
>         int start() override;
>         void stop() override {}
>  
> @@ -75,7 +75,8 @@ private:
>         unsigned int hwHistogramWeightGridsSize_;
>  };
>  
> -int IPARkISP1::init(unsigned int hwRevision)
> +int IPARkISP1::init([[maybe_unused]] const IPASettings &settings,
> +                   unsigned int hwRevision)
>  {
>         /* \todo Add support for other revisions */
>         switch (hwRevision) {
> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> index 98008862..db8856d3 100644
> --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> @@ -88,7 +88,7 @@ public:
>         }
>  
>         PipelineHandlerRkISP1 *pipe();
> -       int loadIPA(unsigned int hwRevision);
> +       int loadIPA(const IPASettings &settings, unsigned int hwRevision);
>  
>         Stream mainPathStream_;
>         Stream selfPathStream_;
> @@ -310,7 +310,7 @@ PipelineHandlerRkISP1 *RkISP1CameraData::pipe()
>         return static_cast<PipelineHandlerRkISP1 *>(Camera::Private::pipe());
>  }
>  
> -int RkISP1CameraData::loadIPA(unsigned int hwRevision)
> +int RkISP1CameraData::loadIPA(const IPASettings &settings, unsigned int hwRevision)
>  {
>         ipa_ = IPAManager::createIPA<ipa::rkisp1::IPAProxyRkISP1>(pipe(), 1, 1);
>         if (!ipa_)
> @@ -319,7 +319,7 @@ int RkISP1CameraData::loadIPA(unsigned int hwRevision)
>         ipa_->queueFrameAction.connect(this,
>                                        &RkISP1CameraData::queueFrameAction);
>  
> -       int ret = ipa_->init(hwRevision);
> +       int ret = ipa_->init(settings, hwRevision);
>         if (ret < 0) {
>                 LOG(RkISP1, Error) << "IPA initialization failure";
>                 return ret;
> @@ -965,7 +965,8 @@ int PipelineHandlerRkISP1::createCamera(MediaEntity *sensor)
>         isp_->frameStart.connect(data->delayedCtrls_.get(),
>                                  &DelayedControls::applyControls);
>  
> -       ret = data->loadIPA(media_->hwRevision());
> +       ret = data->loadIPA(IPASettings{ "", data->sensor_->model() },
> +                           media_->hwRevision());

This passes the data->sensor_ into a call inside data which already has
it... (You're giving the sensor info to the camera data, which is where
you retrieved the sensor info from....)


You could keep this line the same, and just provide the
IPASettings during RkISP1CameraData::loadIPA() on the ipa_->init() call
like the IPU3 does.



>         if (ret)
>                 return ret;
>  
> -- 
> 2.32.0
>

Patch
diff mbox series

diff --git a/include/libcamera/ipa/rkisp1.mojom b/include/libcamera/ipa/rkisp1.mojom
index cae757ea..a6991d4f 100644
--- a/include/libcamera/ipa/rkisp1.mojom
+++ b/include/libcamera/ipa/rkisp1.mojom
@@ -29,7 +29,9 @@  struct RkISP1Action {
 };
 
 interface IPARkISP1Interface {
-	init(uint32 hwRevision) => (int32 ret);
+	init(libcamera.IPASettings settings,
+	     uint32 hwRevision)
+		=> (int32 ret);
 	start() => (int32 ret);
 	stop();
 
diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
index bf2c13b6..7ecbf8ae 100644
--- a/src/ipa/rkisp1/rkisp1.cpp
+++ b/src/ipa/rkisp1/rkisp1.cpp
@@ -34,7 +34,7 @@  namespace ipa::rkisp1 {
 class IPARkISP1 : public IPARkISP1Interface
 {
 public:
-	int init(unsigned int hwRevision) override;
+	int init(const IPASettings &settings, unsigned int hwRevision) override;
 	int start() override;
 	void stop() override {}
 
@@ -75,7 +75,8 @@  private:
 	unsigned int hwHistogramWeightGridsSize_;
 };
 
-int IPARkISP1::init(unsigned int hwRevision)
+int IPARkISP1::init([[maybe_unused]] const IPASettings &settings,
+		    unsigned int hwRevision)
 {
 	/* \todo Add support for other revisions */
 	switch (hwRevision) {
diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
index 98008862..db8856d3 100644
--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
@@ -88,7 +88,7 @@  public:
 	}
 
 	PipelineHandlerRkISP1 *pipe();
-	int loadIPA(unsigned int hwRevision);
+	int loadIPA(const IPASettings &settings, unsigned int hwRevision);
 
 	Stream mainPathStream_;
 	Stream selfPathStream_;
@@ -310,7 +310,7 @@  PipelineHandlerRkISP1 *RkISP1CameraData::pipe()
 	return static_cast<PipelineHandlerRkISP1 *>(Camera::Private::pipe());
 }
 
-int RkISP1CameraData::loadIPA(unsigned int hwRevision)
+int RkISP1CameraData::loadIPA(const IPASettings &settings, unsigned int hwRevision)
 {
 	ipa_ = IPAManager::createIPA<ipa::rkisp1::IPAProxyRkISP1>(pipe(), 1, 1);
 	if (!ipa_)
@@ -319,7 +319,7 @@  int RkISP1CameraData::loadIPA(unsigned int hwRevision)
 	ipa_->queueFrameAction.connect(this,
 				       &RkISP1CameraData::queueFrameAction);
 
-	int ret = ipa_->init(hwRevision);
+	int ret = ipa_->init(settings, hwRevision);
 	if (ret < 0) {
 		LOG(RkISP1, Error) << "IPA initialization failure";
 		return ret;
@@ -965,7 +965,8 @@  int PipelineHandlerRkISP1::createCamera(MediaEntity *sensor)
 	isp_->frameStart.connect(data->delayedCtrls_.get(),
 				 &DelayedControls::applyControls);
 
-	ret = data->loadIPA(media_->hwRevision());
+	ret = data->loadIPA(IPASettings{ "", data->sensor_->model() },
+			    media_->hwRevision());
 	if (ret)
 		return ret;