[v4,12/15] config: Allow enabling software ISP in runtime
diff mbox series

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

Commit Message

Milan Zamazal Sept. 25, 2024, 9:58 a.m. UTC
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:
        supported_devices:
        - driver: DRIVER-NAME
          software_isp: BOOLEAN
        - ...

For example:

  configuration:
    pipelines:
      simple:
        supported_devices:
        - driver: mxc-isi
          software_isp: 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@redhat.com>
---
 src/libcamera/pipeline/simple/simple.cpp | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Barnabás Pőcze Sept. 26, 2024, 7:44 p.m. UTC | #1
Hi


2024. szeptember 25., szerda 11:58 keltezéssel, Milan Zamazal <mzamazal@redhat.com> írta:

> [...]
>  	swIspEnabled_ = info->swIspEnabled;
> +	for (GlobalConfiguration::Configuration entry :
> +	     GlobalConfiguration::configuration()
> +		     ["pipelines"]["simple"]["supported_devices"]
> +			     .asList()) {
> +		auto name = entry["driver"].get<std::string>();
> +		if (name.has_value() and !name.value().compare(info->driver)) {

I think

  if (name == info->driver)

should work.


Regards,
Barnabás Pőcze


> +			swIspEnabled_ = entry["software_isp"].get<bool>().value_or(swIspEnabled_);
> +			LOG(SimplePipeline, Debug) << "Overriding software ISP to " << swIspEnabled_;
> +			break;
> +		}
> +	}
> 
>  	/* Locate the sensors. */
>  	std::vector<MediaEntity *> sensors = locateSensors(media);
> --
> 2.44.1
Milan Zamazal Sept. 27, 2024, 1:29 p.m. UTC | #2
Hi Barnabás,

Barnabás Pőcze <pobrn@protonmail.com> writes:

> Hi
>
>
> 2024. szeptember 25., szerda 11:58 keltezéssel, Milan Zamazal <mzamazal@redhat.com> írta:
>
>> [...]
>>  	swIspEnabled_ = info->swIspEnabled;
>> +	for (GlobalConfiguration::Configuration entry :
>> +	     GlobalConfiguration::configuration()
>> +		     ["pipelines"]["simple"]["supported_devices"]
>> +			     .asList()) {
>> +		auto name = entry["driver"].get<std::string>();
>> +		if (name.has_value() and !name.value().compare(info->driver)) {
>
> I think
>
>   if (name == info->driver)
>
> should work.

OK, thank you, I'll fix it in v5.

> Regards,
> Barnabás Pőcze
>
>
>> +			swIspEnabled_ = entry["software_isp"].get<bool>().value_or(swIspEnabled_);
>> +			LOG(SimplePipeline, Debug) << "Overriding software ISP to " << swIspEnabled_;
>> +			break;
>> +		}
>> +	}
>> 
>>  	/* Locate the sensors. */
>>  	std::vector<MediaEntity *> sensors = locateSensors(media);
>> --
>> 2.44.1

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp
index 81915573b..78f446fb6 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"
@@ -1541,6 +1542,17 @@  bool SimplePipelineHandler::match(DeviceEnumerator *enumerator)
 	}
 
 	swIspEnabled_ = info->swIspEnabled;
+	for (GlobalConfiguration::Configuration entry :
+	     GlobalConfiguration::configuration()
+		     ["pipelines"]["simple"]["supported_devices"]
+			     .asList()) {
+		auto name = entry["driver"].get<std::string>();
+		if (name.has_value() and !name.value().compare(info->driver)) {
+			swIspEnabled_ = entry["software_isp"].get<bool>().value_or(swIspEnabled_);
+			LOG(SimplePipeline, Debug) << "Overriding software ISP to " << swIspEnabled_;
+			break;
+		}
+	}
 
 	/* Locate the sensors. */
 	std::vector<MediaEntity *> sensors = locateSensors(media);