[libcamera-devel] [PATCH v1 2/2] DEMO: raspberrypi: Use custom parameters to init()

Paul Elder paul.elder at ideasonboard.com
Thu Mar 4 09:47:43 CET 2021


This is just a demo to show custom parameters to init() with the
raspberrypi IPA interface.

Signed-off-by: Paul Elder <paul.elder at ideasonboard.com>
---
 include/libcamera/ipa/raspberrypi.mojom            |  3 ++-
 src/ipa/raspberrypi/raspberrypi.cpp                | 12 +++++++++---
 src/libcamera/pipeline/raspberrypi/raspberrypi.cpp |  6 +++++-
 3 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/include/libcamera/ipa/raspberrypi.mojom b/include/libcamera/ipa/raspberrypi.mojom
index f733a2cd..b8944227 100644
--- a/include/libcamera/ipa/raspberrypi.mojom
+++ b/include/libcamera/ipa/raspberrypi.mojom
@@ -51,7 +51,8 @@ struct StartControls {
 };
 
 interface IPARPiInterface {
-	init(IPASettings settings) => (int32 ret);
+	init(IPASettings settings, string sensorName)
+		=> (int32 ret, bool metadataSupport);
 	start(StartControls controls) => (StartControls result);
 	stop();
 
diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp
index 6348d071..6a9aba6f 100644
--- a/src/ipa/raspberrypi/raspberrypi.cpp
+++ b/src/ipa/raspberrypi/raspberrypi.cpp
@@ -79,7 +79,8 @@ public:
 			munmap(lsTable_, ipa::RPi::MaxLsGridSize);
 	}
 
-	int init(const IPASettings &settings) override;
+	void init(const IPASettings &settings, const std::string &sensorName,
+		  int *ret, bool *metadataSupport) override;
 	void start(const ipa::RPi::StartControls &data,
 		   ipa::RPi::StartControls *result) override;
 	void stop() override {}
@@ -164,10 +165,15 @@ private:
 	double maxFrameDuration_;
 };
 
-int IPARPi::init(const IPASettings &settings)
+void IPARPi::init(const IPASettings &settings, const std::string &sensorName,
+		  int *ret, bool *metadataSupport)
 {
+	LOG(IPARPI, Debug) << "sensor name is " << sensorName;
+
 	tuningFile_ = settings.configurationFile;
-	return 0;
+
+	*metadataSupport = true;
+	*ret = 0;
 }
 
 void IPARPi::start(const ipa::RPi::StartControls &data,
diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index db91f1b5..a1c90028 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -1194,7 +1194,11 @@ int RPiCameraData::loadIPA()
 
 	IPASettings settings(ipa_->configurationFile(sensor_->model() + ".json"));
 
-	return ipa_->init(settings);
+	int ret;
+	bool metadataSupport;
+	ipa_->init(settings, "sensor name", &ret, &metadataSupport);
+	LOG(RPI, Debug) << "metadata support " << (metadataSupport ? "yes" : "no");
+	return ret;
 }
 
 int RPiCameraData::configureIPA(const CameraConfiguration *config)
-- 
2.27.0



More information about the libcamera-devel mailing list