[libcamera-devel] [PATCH v1 03/14] pipeline: ipa: raspberrypi: Replace entityControls

Naushir Patuck naush at raspberrypi.com
Thu Jan 19 11:45:33 CET 2023


Replace the legacy entityControls map passed into ipa::configure() with explicit
fields for sensor and ISP controls. This removes any ambiguity over which set of
controls corresponds with specific integer keys.

Signed-off-by: Naushir Patuck <naush at raspberrypi.com>
Reviewed-by: Nick Hollinghurst <nick.hollinghurst at raspberrypi.com>
Reviewed-by: David Plowman <david.plowman at raspberrypi.com>
---
 include/libcamera/ipa/raspberrypi.mojom         |  4 ++--
 src/ipa/raspberrypi/raspberrypi.cpp             | 17 ++++-------------
 .../pipeline/raspberrypi/raspberrypi.cpp        |  7 +++----
 3 files changed, 9 insertions(+), 19 deletions(-)

diff --git a/include/libcamera/ipa/raspberrypi.mojom b/include/libcamera/ipa/raspberrypi.mojom
index 0732496968ed..2a4821fbc0ef 100644
--- a/include/libcamera/ipa/raspberrypi.mojom
+++ b/include/libcamera/ipa/raspberrypi.mojom
@@ -36,6 +36,8 @@ struct ISPConfig {
 struct IPAConfig {
 	uint32 transform;
 	libcamera.SharedFD lsTableHandle;
+	libcamera.ControlInfoMap sensorControls;
+	libcamera.ControlInfoMap ispControls;
 };
 
 struct IPAConfigResult {
@@ -59,7 +61,6 @@ interface IPARPiInterface {
 	 * \fn configure()
 	 * \brief Configure the IPA stream and sensor settings
 	 * \param[in] sensorInfo Camera sensor information
-	 * \param[in] entityControls Controls provided by the pipeline entities
 	 * \param[in] ipaConfig Pipeline-handler-specific configuration data
 	 * \param[out] controls Controls to apply by the pipeline entity
 	 * \param[out] result Other results that the pipeline handler may require
@@ -74,7 +75,6 @@ interface IPARPiInterface {
 	 * pipeline handler to the IPA and back.
 	 */
 	configure(libcamera.IPACameraSensorInfo sensorInfo,
-		  map<uint32, libcamera.ControlInfoMap> entityControls,
 		  IPAConfig ipaConfig)
 		=> (int32 ret, libcamera.ControlList controls, IPAConfigResult result);
 
diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp
index f748b6e2dac7..aa18ed750370 100644
--- a/src/ipa/raspberrypi/raspberrypi.cpp
+++ b/src/ipa/raspberrypi/raspberrypi.cpp
@@ -119,9 +119,7 @@ public:
 	void start(const ControlList &controls, StartConfig *startConfig) override;
 	void stop() override {}
 
-	int configure(const IPACameraSensorInfo &sensorInfo,
-		      const std::map<unsigned int, ControlInfoMap> &entityControls,
-		      const IPAConfig &data,
+	int configure(const IPACameraSensorInfo &sensorInfo, const IPAConfig &data,
 		      ControlList *controls, IPAConfigResult *result) override;
 	void mapBuffers(const std::vector<IPABuffer> &buffers) override;
 	void unmapBuffers(const std::vector<unsigned int> &ids) override;
@@ -380,18 +378,11 @@ void IPARPi::setMode(const IPACameraSensorInfo &sensorInfo)
 	mode_.sensitivity = helper_->getModeSensitivity(mode_);
 }
 
-int IPARPi::configure(const IPACameraSensorInfo &sensorInfo,
-		      const std::map<unsigned int, ControlInfoMap> &entityControls,
-		      const IPAConfig &ipaConfig,
+int IPARPi::configure(const IPACameraSensorInfo &sensorInfo, const IPAConfig &ipaConfig,
 		      ControlList *controls, IPAConfigResult *result)
 {
-	if (entityControls.size() != 2) {
-		LOG(IPARPI, Error) << "No ISP or sensor controls found.";
-		return -1;
-	}
-
-	sensorCtrls_ = entityControls.at(0);
-	ispCtrls_ = entityControls.at(1);
+	sensorCtrls_ = ipaConfig.sensorControls;
+	ispCtrls_ = ipaConfig.ispControls;
 
 	if (!validateSensorControls()) {
 		LOG(IPARPI, Error) << "Sensor control validation failed.";
diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index 272767b5263b..9dd36cbaea78 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -1615,8 +1615,8 @@ int RPiCameraData::configureIPA(const CameraConfiguration *config, ipa::RPi::IPA
 	std::map<unsigned int, ControlInfoMap> entityControls;
 	ipa::RPi::IPAConfig ipaConfig;
 
-	entityControls.emplace(0, sensor_->controls());
-	entityControls.emplace(1, isp_[Isp::Input].dev()->controls());
+	ipaConfig.sensorControls = sensor_->controls();
+	ipaConfig.ispControls = isp_[Isp::Input].dev()->controls();
 
 	/* Always send the user transform to the IPA. */
 	ipaConfig.transform = static_cast<unsigned int>(config->transform);
@@ -1644,8 +1644,7 @@ int RPiCameraData::configureIPA(const CameraConfiguration *config, ipa::RPi::IPA
 
 	/* Ready the IPA - it must know about the sensor resolution. */
 	ControlList controls;
-	ret = ipa_->configure(sensorInfo_, entityControls, ipaConfig,
-			      &controls, result);
+	ret = ipa_->configure(sensorInfo_, ipaConfig, &controls, result);
 	if (ret < 0) {
 		LOG(RPI, Error) << "IPA configuration failed!";
 		return -EPIPE;
-- 
2.25.1



More information about the libcamera-devel mailing list