[RFC PATCH 10/11] config: Allow enabling software ISP in runtime

Milan Zamazal mzamazal at redhat.com
Tue Mar 26 12:24:13 CET 2024


This patch allows enabling or disabling software ISP in runtime in addition to
compile time.  This can be useful for software ISP testing on various platforms
as well as for overriding the defaults in case the defaults don't work
well (e.g. hardware ISP may or may not work on i.MX8MP depending on the kernel
and libcamera patches present in the given system).

The configuration is specified as follows:

  configuration:
    pipelines:
      simple:
        supportedDevices:
        - driver: DRIVER-NAME
          softwareIsp: BOOLEAN
        - ...

For example:

  configuration:
    pipelines:
      simple:
        supportedDevices:
        - driver: mxc-isi
          softwareIsp: true

The overall configuration of enabling or disabling software ISP may get dropped
in future but this patch is still useful in the meantime.

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

diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp
index 22639407..23e3f9da 100644
--- a/src/libcamera/pipeline/simple/simple.cpp
+++ b/src/libcamera/pipeline/simple/simple.cpp
@@ -32,6 +32,7 @@
 #include "libcamera/internal/camera_sensor.h"
 #include "libcamera/internal/converter.h"
 #include "libcamera/internal/device_enumerator.h"
+#include "libcamera/internal/global_configuration.h"
 #include "libcamera/internal/media_device.h"
 #include "libcamera/internal/pipeline_handler.h"
 #include "libcamera/internal/software_isp/software_isp.h"
@@ -1532,6 +1533,15 @@ bool SimplePipelineHandler::match(DeviceEnumerator *enumerator)
 	}
 
 	swIspEnabled_ = info->swIspEnabled;
+	for (GlobalConfiguration::Configuration entry :
+	     GlobalConfiguration::configuration()["pipelines"]["simple"]["supportedDevices"].asList()) {
+		auto name = entry["driver"].get<std::string>();
+		if (name.has_value() and !name.value().compare(info->driver)) {
+			swIspEnabled_ = entry["softwareIsp"].get<bool>().value_or(swIspEnabled_);
+			LOG(SimplePipeline, Debug) << "Overriding software ISP to " << swIspEnabled_;
+			break;
+		}
+	}
 
 	/* Locate the sensors. */
 	std::vector<MediaEntity *> sensors = locateSensors();
-- 
2.42.0



More information about the libcamera-devel mailing list