From patchwork Sat Dec 5 10:31:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 10581 X-Patchwork-Delegate: paul.elder@ideasonboard.com Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 69461BDB20 for ; Sat, 5 Dec 2020 10:31:58 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3635B635FC; Sat, 5 Dec 2020 11:31:58 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="EaEbxpS1"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 643C3635F6 for ; Sat, 5 Dec 2020 11:31:57 +0100 (CET) Received: from pyrite.rasen.tech (unknown [IPv6:2400:4051:61:600:2c71:1b79:d06d:5032]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 63EF699A; Sat, 5 Dec 2020 11:31:55 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1607164316; bh=Jrq89+yD3C2+O1AFtHqooDn3L8tu2F9l/TFtKMZmkv8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EaEbxpS18oCx3EaJCk7lhZfpcSftQp0IWctIm1zZaen2J7UCi7qspeYm3aszyVrwz OhZxIUkCtgQdyaJIlrNyIY9yYAMPodSCU25ajBgYqUiX6LHtGPfHduM1ZznLzadnyd Tkck4k45FRPfRHwvGBFix+PqyQXDIfcwDm9DoS6M= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Sat, 5 Dec 2020 19:31:01 +0900 Message-Id: <20201205103106.242080-19-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201205103106.242080-1-paul.elder@ideasonboard.com> References: <20201205103106.242080-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v5 18/23] libcamera: pipeline, ipa: vimc: Support the new IPC mechanism X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add support to vimc pipeline handler and IPA for the new IPC mechanism. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- 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 + #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 +#include #include #include @@ -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 &streamConfig, - [[maybe_unused]] const std::map &entityControls, - [[maybe_unused]] const IPAOperationData &ipaConfig, - [[maybe_unused]] IPAOperationData *result) override {} - void mapBuffers([[maybe_unused]] const std::vector &buffers) override {} - void unmapBuffers([[maybe_unused]] const std::vector &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()); + 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 +#include +#include + namespace libcamera { LOG_DEFINE_CATEGORY(VIMC) @@ -67,6 +71,8 @@ public: V4L2VideoDevice *video_; V4L2VideoDevice *raw_; Stream stream_; + + std::unique_ptr ipa_; }; class VimcCameraConfiguration : public CameraConfiguration @@ -428,7 +434,7 @@ bool PipelineHandlerVimc::match(DeviceEnumerator *enumerator) std::unique_ptr data = std::make_unique(this, media); - data->ipa_ = IPAManager::createIPA(this, 0, 0); + data->ipa_ = IPAManager::createIPA(this, 0, 0); if (data->ipa_ != nullptr) { std::string conf = data->ipa_->configurationFile("vimc.conf"); data->ipa_->init(IPASettings{ conf });