[RFC,09/11] config: Look up RkISP1 tuning file in configuration file
diff mbox series

Message ID 20240326112419.503286-10-mzamazal@redhat.com
State Superseded
Headers show
Series
  • Add global configuration file
Related show

Commit Message

Milan Zamazal March 26, 2024, 11:24 a.m. UTC
The configuration snippet:

  configuration:
    pipeline:
      rkisp1:
        tuning_file: FILE

This environment variable has not been documented.

Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
---
 src/libcamera/pipeline/rkisp1/rkisp1.cpp | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
index abb21968..5be25698 100644
--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
@@ -36,6 +36,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"
@@ -349,8 +350,10 @@  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') {
+	const auto confTuningFile =
+		GlobalConfiguration::envOption(
+			"LIBCAMERA_RKISP1_TUNING_FILE", "pipeline.rkisp1.tuning_file");
+	if (!confTuningFile.has_value() || confTuningFile.value() == "") {
 		ipaTuningFile = ipa_->configurationFile(sensor_->model() + ".yaml");
 		/*
 		 * If the tuning file isn't found, fall back to the
@@ -359,7 +362,7 @@  int RkISP1CameraData::loadIPA(unsigned int hwRevision)
 		if (ipaTuningFile.empty())
 			ipaTuningFile = ipa_->configurationFile("uncalibrated.yaml");
 	} else {
-		ipaTuningFile = std::string(configFromEnv);
+		ipaTuningFile = confTuningFile.value();
 	}
 
 	IPACameraSensorInfo sensorInfo{};