[libcamera-devel] [PATCH v5 18/23] libcamera: pipeline, ipa: vimc: Support the new IPC mechanism

Paul Elder paul.elder at ideasonboard.com
Sat Dec 5 11:31:01 CET 2020


Add support to vimc pipeline handler and IPA for the new IPC mechanism.

Signed-off-by: Paul Elder <paul.elder at ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

---
Changes in v5:
- use the new generated header naming scheme
- add dummy event, since event interfaces are now required to have at
  least one event

Changes in v4:
- rename Controls to controls
- rename IPAVimcCallbackInterface to IPAVimcEventInterface
- rename libcamera_generated_headers to libcamera_generated_ipa_headers
  in meson
- use the new header name, vimc_ipa_interface.h

Changes in v3:
- change namespacing of base ControlInfoMap structure

New in v2
---
 include/libcamera/ipa/meson.build    |  1 +
 include/libcamera/ipa/vimc.h         |  8 ++++++++
 include/libcamera/ipa/vimc.mojom     | 13 +++++++++++++
 src/ipa/vimc/meson.build             |  2 +-
 src/ipa/vimc/vimc.cpp                | 16 ++++------------
 src/libcamera/pipeline/vimc/vimc.cpp |  8 +++++++-
 6 files changed, 34 insertions(+), 14 deletions(-)
 create mode 100644 include/libcamera/ipa/vimc.mojom

diff --git a/include/libcamera/ipa/meson.build b/include/libcamera/ipa/meson.build
index 5c838d5c..816cf4ab 100644
--- a/include/libcamera/ipa/meson.build
+++ b/include/libcamera/ipa/meson.build
@@ -26,6 +26,7 @@ ipa_mojom_core = custom_target(core_mojom_file.split('.')[0] + '_mojom_module',
 
 ipa_mojom_files = [
     'raspberrypi.mojom',
+    'vimc.mojom',
 ]
 
 ipa_mojoms = []
diff --git a/include/libcamera/ipa/vimc.h b/include/libcamera/ipa/vimc.h
index 27a4a61d..2c5f3f8f 100644
--- a/include/libcamera/ipa/vimc.h
+++ b/include/libcamera/ipa/vimc.h
@@ -8,6 +8,8 @@
 #ifndef __LIBCAMERA_IPA_VIMC_H__
 #define __LIBCAMERA_IPA_VIMC_H__
 
+#include <libcamera/controls.h>
+
 #ifndef __DOXYGEN__
 
 namespace libcamera {
@@ -21,6 +23,12 @@ enum IPAOperationCode {
 	IPAOperationStop,
 };
 
+namespace Vimc {
+
+static ControlInfoMap controls;
+
+}
+
 } /* namespace libcamera */
 
 #endif /* __DOXYGEN__ */
diff --git a/include/libcamera/ipa/vimc.mojom b/include/libcamera/ipa/vimc.mojom
new file mode 100644
index 00000000..229659e7
--- /dev/null
+++ b/include/libcamera/ipa/vimc.mojom
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+import "include/libcamera/ipa/core.mojom";
+
+interface IPAVimcInterface {
+	init(IPASettings settings) => (int32 ret);
+	start() => (int32 ret);
+	stop();
+};
+
+interface IPAVimcEventInterface {
+	dummyEvent(uint32 val);
+};
diff --git a/src/ipa/vimc/meson.build b/src/ipa/vimc/meson.build
index 8c9df854..e982ebba 100644
--- a/src/ipa/vimc/meson.build
+++ b/src/ipa/vimc/meson.build
@@ -3,7 +3,7 @@
 ipa_name = 'ipa_vimc'
 
 mod = shared_module(ipa_name,
-                    'vimc.cpp',
+                    ['vimc.cpp', libcamera_generated_ipa_headers],
                     name_prefix : '',
                     include_directories : [ipa_includes, libipa_includes],
                     dependencies : libcamera_dep,
diff --git a/src/ipa/vimc/vimc.cpp b/src/ipa/vimc/vimc.cpp
index 483aeadd..6b088466 100644
--- a/src/ipa/vimc/vimc.cpp
+++ b/src/ipa/vimc/vimc.cpp
@@ -6,6 +6,7 @@
  */
 
 #include <libcamera/ipa/vimc.h>
+#include <libcamera/ipa/vimc_ipa_interface.h>
 
 #include <fcntl.h>
 #include <string.h>
@@ -24,7 +25,7 @@ namespace libcamera {
 
 LOG_DEFINE_CATEGORY(IPAVimc)
 
-class IPAVimc : public IPAInterface
+class IPAVimc : public IPAVimcInterface
 {
 public:
 	IPAVimc();
@@ -35,15 +36,6 @@ public:
 	int start() override;
 	void stop() override;
 
-	void configure([[maybe_unused]] const CameraSensorInfo &sensorInfo,
-		       [[maybe_unused]] const std::map<unsigned int, IPAStream> &streamConfig,
-		       [[maybe_unused]] const std::map<unsigned int, const ControlInfoMap &> &entityControls,
-		       [[maybe_unused]] const IPAOperationData &ipaConfig,
-		       [[maybe_unused]] IPAOperationData *result) override {}
-	void mapBuffers([[maybe_unused]] const std::vector<IPABuffer> &buffers) override {}
-	void unmapBuffers([[maybe_unused]] const std::vector<unsigned int> &ids) override {}
-	void processEvent([[maybe_unused]] const IPAOperationData &event) override {}
-
 private:
 	void initTrace();
 	void trace(enum IPAOperationCode operation);
@@ -139,9 +131,9 @@ const struct IPAModuleInfo ipaModuleInfo = {
 	"vimc",
 };
 
-struct ipa_context *ipaCreate()
+IPAInterface *ipaCreate()
 {
-	return new IPAInterfaceWrapper(std::make_unique<IPAVimc>());
+	return new IPAVimc();
 }
 }
 
diff --git a/src/libcamera/pipeline/vimc/vimc.cpp b/src/libcamera/pipeline/vimc/vimc.cpp
index 914b6b54..55df7192 100644
--- a/src/libcamera/pipeline/vimc/vimc.cpp
+++ b/src/libcamera/pipeline/vimc/vimc.cpp
@@ -34,6 +34,10 @@
 #include "libcamera/internal/v4l2_subdevice.h"
 #include "libcamera/internal/v4l2_videodevice.h"
 
+#include <libcamera/ipa/vimc.h>
+#include <libcamera/ipa/vimc_ipa_interface.h>
+#include <libcamera/ipa/vimc_ipa_proxy.h>
+
 namespace libcamera {
 
 LOG_DEFINE_CATEGORY(VIMC)
@@ -67,6 +71,8 @@ public:
 	V4L2VideoDevice *video_;
 	V4L2VideoDevice *raw_;
 	Stream stream_;
+
+	std::unique_ptr<IPAProxyVimc> ipa_;
 };
 
 class VimcCameraConfiguration : public CameraConfiguration
@@ -428,7 +434,7 @@ bool PipelineHandlerVimc::match(DeviceEnumerator *enumerator)
 
 	std::unique_ptr<VimcCameraData> data = std::make_unique<VimcCameraData>(this, media);
 
-	data->ipa_ = IPAManager::createIPA(this, 0, 0);
+	data->ipa_ = IPAManager::createIPA<IPAProxyVimc>(this, 0, 0);
 	if (data->ipa_ != nullptr) {
 		std::string conf = data->ipa_->configurationFile("vimc.conf");
 		data->ipa_->init(IPASettings{ conf });
-- 
2.27.0



More information about the libcamera-devel mailing list