[PATCH v5 14/15] libcamera: software_isp: Make input buffer copying configurable
Milan Zamazal
mzamazal at redhat.com
Tue Oct 1 12:28:06 CEST 2024
On some platforms, working directly on the input buffer is very slow due
to disabled caching. This is why we copy the input buffer into standard
(cached) memory. This is an unnecessary overhead on platforms with
cached buffers.
Let's make input buffer copying configurable. The default is still
copying, as it's overhead is much lower than contingent operations on
non-cached memory. Ideally, we should improve this in future to set the
default to non-copying if we can be sure under observable circumstances
that we are working with cached buffers.
Completes software ISP TODO #6.
Signed-off-by: Milan Zamazal <mzamazal at redhat.com>
---
Documentation/runtime_configuration.rst | 2 ++
src/libcamera/software_isp/TODO | 11 -----------
src/libcamera/software_isp/debayer_cpu.cpp | 5 ++++-
3 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/Documentation/runtime_configuration.rst b/Documentation/runtime_configuration.rst
index 819b1c830..4babce1ab 100644
--- a/Documentation/runtime_configuration.rst
+++ b/Documentation/runtime_configuration.rst
@@ -55,6 +55,7 @@ file structure:
- CAMERA-ID:
tuning-file: # full path
simple:
+ copy_input_buffer: # true/false
supported_devices:
- driver: # driver name, e.g. `mxc-isi`
software_isp: # true/false
@@ -87,6 +88,7 @@ Configuration file example
rpi:
config_file: /usr/local/share/libcamera/pipeline/rpi/vc4/minimal_mem.yaml
simple:
+ copy_input_buffer: false
supported_devices:
- driver: mxc-isi
software_isp: true
diff --git a/src/libcamera/software_isp/TODO b/src/libcamera/software_isp/TODO
index a50db668e..2c919f442 100644
--- a/src/libcamera/software_isp/TODO
+++ b/src/libcamera/software_isp/TODO
@@ -71,17 +71,6 @@ per-frame buffers like we do for hardware ISPs.
---
-6. Input buffer copying configuration
-
-> DebayerCpu::DebayerCpu(std::unique_ptr<SwStatsCpu> stats)
-> : stats_(std::move(stats)), gammaCorrection_(1.0)
-> {
-> enableInputMemcpy_ = true;
-
-Set this appropriately and/or make it configurable.
-
----
-
7. Performance measurement configuration
> void DebayerCpu::process(FrameBuffer *input, FrameBuffer *output, DebayerParams params)
diff --git a/src/libcamera/software_isp/debayer_cpu.cpp b/src/libcamera/software_isp/debayer_cpu.cpp
index cf5ecdf7a..ca62c370b 100644
--- a/src/libcamera/software_isp/debayer_cpu.cpp
+++ b/src/libcamera/software_isp/debayer_cpu.cpp
@@ -21,6 +21,7 @@
#include "libcamera/internal/bayer_format.h"
#include "libcamera/internal/framebuffer.h"
+#include "libcamera/internal/global_configuration.h"
#include "libcamera/internal/mapped_framebuffer.h"
namespace libcamera {
@@ -47,7 +48,9 @@ DebayerCpu::DebayerCpu(std::unique_ptr<SwStatsCpu> stats)
* always set it to true as the safer choice but this should be changed in
* future.
*/
- enableInputMemcpy_ = true;
+ enableInputMemcpy_ = GlobalConfiguration::option<bool>(
+ "pipelines.simple.copy_input_buffer")
+ .value_or(true);
/* Initialize color lookup tables */
for (unsigned int i = 0; i < DebayerParams::kRGBLookupSize; i++)
--
2.44.1
More information about the libcamera-devel
mailing list