[PATCH v6 09/16] config: Look up RkISP1 tuning file in configuration file

Milan Zamazal mzamazal at redhat.com
Fri Dec 6 18:11:40 CET 2024


The configuration snippet:

  configuration:
    pipeline:
      rkisp1:
        tuning_file: FILE

This environment variable has not been documented.

Signed-off-by: Milan Zamazal <mzamazal at redhat.com>
---
 src/libcamera/pipeline/rkisp1/rkisp1.cpp | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
index 908724e2..92f6addd 100644
--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
@@ -39,6 +39,7 @@
 #include "libcamera/internal/delayed_controls.h"
 #include "libcamera/internal/device_enumerator.h"
 #include "libcamera/internal/framebuffer.h"
+#include "libcamera/internal/global_configuration.h"
 #include "libcamera/internal/ipa_manager.h"
 #include "libcamera/internal/media_device.h"
 #include "libcamera/internal/pipeline_handler.h"
@@ -376,13 +377,16 @@ int RkISP1CameraData::loadIPA(unsigned int hwRevision)
 	 * environment variable overrides it.
 	 */
 	std::string ipaTuningFile;
-	char const *configFromEnv = utils::secure_getenv("LIBCAMERA_RKISP1_TUNING_FILE");
-	if (!configFromEnv || *configFromEnv == '\0') {
-		ipaTuningFile =
-			ipa_->configurationFile(sensor_->model() + ".yaml", "uncalibrated.yaml");
-	} else {
-		ipaTuningFile = std::string(configFromEnv);
-	}
+	const std::string confPath =
+		std::string("pipelines.rkisp1.cameras.") + sensor_->id() + ".tuning_file";
+	const auto confTuningFile =
+		GlobalConfiguration::envOption(
+			"LIBCAMERA_RKISP1_TUNING_FILE", confPath.c_str());
+	if (!confTuningFile.has_value() || confTuningFile.value() == "")
+		ipaTuningFile = ipa_->configurationFile(sensor_->model() + ".yaml",
+							"uncalibrated.yaml");
+	else
+		ipaTuningFile = confTuningFile.value();
 
 	IPACameraSensorInfo sensorInfo{};
 	int ret = sensor_->sensorInfo(&sensorInfo);
-- 
2.44.2



More information about the libcamera-devel mailing list