From patchwork Fri Nov 6 10:36:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 10375 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 35E89BDB89 for ; Fri, 6 Nov 2020 10:38:21 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id F2CF162D3C; Fri, 6 Nov 2020 11:38:20 +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="Pv6FRDkv"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4026662D44 for ; Fri, 6 Nov 2020 11:38:19 +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 BD5BCA19; Fri, 6 Nov 2020 11:38:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1604659099; bh=n+3hbsHERxQ0IDqrHwtaxNks2ZzzydCAzrgm+OQrZPU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Pv6FRDkv4WYtNfgZcDq2WAFvIrScPAz9SqdIt4edrjWkQCZDfIagtgCa4CsmUlmGw W0V3WEa53Pzqa9/kc7uAAuphg3G8ajViqRVhxB+h82DazdimJOzQs3miiwQgmTuewk nFlPMAPh5h0MwVWXWG0tkIfKnHYTEs+8ODUn17/w= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Fri, 6 Nov 2020 19:36:57 +0900 Message-Id: <20201106103707.49660-28-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201106103707.49660-1-paul.elder@ideasonboard.com> References: <20201106103707.49660-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 27/37] 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 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 | 12 ++++++++++++ src/ipa/vimc/meson.build | 2 +- src/ipa/vimc/vimc.cpp | 16 ++++------------ src/libcamera/pipeline/vimc/vimc.cpp | 8 +++++++- 6 files changed, 33 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 d49dff7b..70f5dfc8 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..d8e9b504 --- /dev/null +++ b/include/libcamera/ipa/vimc.mojom @@ -0,0 +1,12 @@ +/* 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 { +}; 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 cf841135..fbf7325e 100644 --- a/src/ipa/vimc/vimc.cpp +++ b/src/ipa/vimc/vimc.cpp @@ -6,6 +6,7 @@ */ #include +#include #include #include @@ -26,7 +27,7 @@ namespace libcamera { LOG_DEFINE_CATEGORY(IPAVimc) -class IPAVimc : public IPAInterface +class IPAVimc : public IPAVimcInterface { public: IPAVimc(); @@ -37,15 +38,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); @@ -141,9 +133,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 7416c37c..9dddb891 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 });