@@ -44,6 +44,7 @@ EXCLUDE = @TOP_SRCDIR@/include/libcamera/base/span.h \
@TOP_SRCDIR@/src/libcamera/pipeline/ \
@TOP_SRCDIR@/src/libcamera/tracepoints.cpp \
@TOP_BUILDDIR@/include/libcamera/internal/tracepoints.h \
+ @TOP_BUILDDIR@/include/libcamera/ipa/soft_ipa_interface.h \
@TOP_BUILDDIR@/src/libcamera/proxy/
EXCLUDE_PATTERNS = @TOP_BUILDDIR@/include/libcamera/ipa/*_serializer.h \
@@ -65,6 +65,7 @@ pipeline_ipa_mojom_mapping = {
'ipu3': 'ipu3.mojom',
'rkisp1': 'rkisp1.mojom',
'rpi/vc4': 'raspberrypi.mojom',
+ 'simple/simple': 'soft.mojom',
'vimc': 'vimc.mojom',
}
new file mode 100644
@@ -0,0 +1,29 @@
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+/*
+ * \todo Document the interface and remove the related EXCLUDE_PATTERNS entry.
+ * \todo Add a way to tell SoftIPA the list of params SoftISP accepts?
+ */
+
+module ipa.soft;
+
+import "include/libcamera/ipa/core.mojom";
+
+interface IPASoftInterface {
+ init(libcamera.IPASettings settings,
+ libcamera.SharedFD fdStats,
+ libcamera.SharedFD fdParams,
+ libcamera.ControlInfoMap sensorCtrlInfoMap)
+ => (int32 ret);
+ start() => (int32 ret);
+ stop();
+ configure(libcamera.ControlInfoMap sensorCtrlInfoMap)
+ => (int32 ret);
+
+ [async] processStats(libcamera.ControlList sensorControls);
+};
+
+interface IPASoftEventInterface {
+ setSensorControls(libcamera.ControlList sensorControls);
+ setIspParams(int32 dummy);
+};
new file mode 100644
@@ -0,0 +1,17 @@
+# SPDX-License-Identifier: CC0-1.0
+
+soft_ipa_common_sources = files([
+ 'soft_base.cpp',
+])
+
+soft_ipa_common_includes = [
+ include_directories('..'),
+]
+
+soft_ipa_common_deps = [
+ libcamera_private,
+]
+
+soft_ipa_common_lib = static_library('soft_ipa_common', soft_ipa_common_sources,
+ include_directories : soft_ipa_common_includes,
+ dependencies : soft_ipa_common_deps)
new file mode 100644
@@ -0,0 +1,73 @@
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+/*
+ * Copyright (C) 2023, Linaro Ltd
+ *
+ * soft-base.cpp - Software IPA base class
+ */
+
+#include "soft_base.h"
+
+#include <sys/mman.h>
+
+#include <libcamera/base/file.h>
+#include <libcamera/base/log.h>
+
+#include <libcamera/control_ids.h>
+
+namespace libcamera {
+
+LOG_DEFINE_CATEGORY(IPASoft)
+
+namespace ipa::soft {
+
+IPASoftBase::IPASoftBase()
+{
+}
+
+IPASoftBase::~IPASoftBase()
+{
+}
+
+int IPASoftBase::init([[maybe_unused]] const IPASettings &settings,
+ const SharedFD &fdStats,
+ const SharedFD &fdParams,
+ const ControlInfoMap &sensorInfoMap)
+{
+ fdStats_ = std::move(fdStats);
+ if (!fdStats_.isValid()) {
+ LOG(IPASoft, Error) << "Invalid Statistics handle";
+ return -ENODEV;
+ }
+
+ fdParams_ = std::move(fdParams);
+ if (!fdParams_.isValid()) {
+ LOG(IPASoft, Error) << "Invalid Parameters handle";
+ return -ENODEV;
+ }
+
+ return platformInit(sensorInfoMap);
+}
+
+int IPASoftBase::configure(const ControlInfoMap &sensorInfoMap)
+{
+ return platformConfigure(sensorInfoMap);
+}
+
+int IPASoftBase::start()
+{
+ return platformStart();
+}
+
+void IPASoftBase::stop()
+{
+ return platformStop();
+}
+
+void IPASoftBase::processStats(const ControlList &sensorControls)
+{
+ return platformProcessStats(sensorControls);
+}
+
+} /* namespace ipa::soft */
+
+} /* namespace libcamera */
new file mode 100644
@@ -0,0 +1,50 @@
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+/*
+ * Copyright (C) 2023, Linaro Ltd
+ *
+ * soft-base.h - Software IPA base class
+ */
+#pragma once
+
+#include <libcamera/base/shared_fd.h>
+
+#include <libcamera/controls.h>
+
+#include <libcamera/ipa/soft_ipa_interface.h>
+
+namespace libcamera {
+
+namespace ipa::soft {
+
+class IPASoftBase : public ipa::soft::IPASoftInterface
+{
+public:
+ IPASoftBase();
+ ~IPASoftBase();
+
+ int init(const IPASettings &settings,
+ const SharedFD &fdStats,
+ const SharedFD &fdParams,
+ const ControlInfoMap &sensorInfoMap) override;
+ int configure(const ControlInfoMap &sensorInfoMap) override;
+
+ int start() override;
+ void stop() override;
+
+ void processStats(const ControlList &sensorControls) override;
+
+protected:
+ SharedFD fdStats_;
+ SharedFD fdParams_;
+
+private:
+ virtual int platformInit(const ControlInfoMap &sensorInfoMap) = 0;
+ virtual int platformConfigure(const ControlInfoMap &sensorInfoMap) = 0;
+ virtual int platformStart() = 0;
+ virtual void platformStop() = 0;
+ virtual void platformProcessStats(const ControlList &sensorControls) = 0;
+};
+
+} /* namespace ipa::soft */
+
+} /* namespace libcamera */
new file mode 100644
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: CC0-1.0
+
+subdir('common')