[libcamera-devel] [PATCH v4 09/11] ipa: rkisp1: agc: Introduce HW revision in IPAContext

Jean-Michel Hautbois jeanmichel.hautbois at ideasonboard.com
Wed Nov 24 14:40:17 CET 2021


The ISP can use 25 or 81 cells depending on its revision. Remove the
cached value in IPARkISP1 and use IPASessionConfiguration to store it
and pass it to AGC later.

Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois at ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham at ideasonboard.com>

---
v4:
	- Only store HW revision, and use it in next patch
---
 src/ipa/rkisp1/ipa_context.cpp | 8 ++++++++
 src/ipa/rkisp1/ipa_context.h   | 5 +++++
 src/ipa/rkisp1/rkisp1.cpp      | 7 +++++++
 3 files changed, 20 insertions(+)

diff --git a/src/ipa/rkisp1/ipa_context.cpp b/src/ipa/rkisp1/ipa_context.cpp
index 819b2c73..6b53dfdf 100644
--- a/src/ipa/rkisp1/ipa_context.cpp
+++ b/src/ipa/rkisp1/ipa_context.cpp
@@ -55,4 +55,12 @@ namespace libcamera::ipa::rkisp1 {
  * are run. This needs to be turned into real per-frame data storage.
  */
 
+/**
+ * \var IPASessionConfiguration::hw
+ * \brief RkISP1-specific hardware information
+ *
+ * \var IPASessionConfiguration::hw.revision
+ * \brief Hardware revision of the ISP
+ */
+
 } /* namespace libcamera::ipa::rkisp1 */
diff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h
index a02b7667..f9ac6833 100644
--- a/src/ipa/rkisp1/ipa_context.h
+++ b/src/ipa/rkisp1/ipa_context.h
@@ -7,11 +7,16 @@
  */
 #pragma once
 
+#include <linux/rkisp1-config.h>
+
 namespace libcamera {
 
 namespace ipa::rkisp1 {
 
 struct IPASessionConfiguration {
+	struct {
+		rkisp1_cif_isp_version revision;
+	} hw;
 };
 
 struct IPAFrameContext {
diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
index 2b073258..59676a70 100644
--- a/src/ipa/rkisp1/rkisp1.cpp
+++ b/src/ipa/rkisp1/rkisp1.cpp
@@ -74,6 +74,7 @@ private:
 	uint32_t maxGain_;
 
 	/* revision-specific data */
+	rkisp1_cif_isp_version hwRevision_;
 	unsigned int hwAeMeanMax_;
 	unsigned int hwHistBinNMax_;
 	unsigned int hwGammaOutMaxSamples_;
@@ -114,6 +115,9 @@ int IPARkISP1::init(const IPASettings &settings, unsigned int hwRevision)
 
 	LOG(IPARkISP1, Debug) << "Hardware revision is " << hwRevision;
 
+	/* Cache the value to set it in configure. */
+	hwRevision_ = static_cast<rkisp1_cif_isp_version>(hwRevision);
+
 	camHelper_ = CameraSensorHelperFactory::create(settings.sensorModel);
 	if (!camHelper_) {
 		LOG(IPARkISP1, Error)
@@ -176,6 +180,9 @@ int IPARkISP1::configure([[maybe_unused]] const IPACameraSensorInfo &info,
 	/* Clean context at configuration */
 	context_ = {};
 
+	/* Set the hardware revision for the algorithms. */
+	context_.configuration.hw.revision = hwRevision_;
+
 	return 0;
 }
 
-- 
2.32.0



More information about the libcamera-devel mailing list