From patchwork Mon May 27 22:35:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 1319 Return-Path: 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 60F59618F9 for ; Tue, 28 May 2019 00:35:48 +0200 (CEST) Received: from localhost.localdomain (unknown [96.44.9.117]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 969FBE3A; Tue, 28 May 2019 00:35:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1558996548; bh=2ljHS3N0Hjvdp0oGmhX+DJMavB2ai6e9d3as424ggbA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cu7Cz57lY9J6enz/iLUQXfMjE8RFdiBxV69EpwNwoum0tJvJFzzn0mynsraMjBhDN EqJsLVp/RYbPPEypTCe3urslyu3+fcMsQsMi4aPK9GFxVZlWZef1d0lp5e5gtam4nZ CHzOjP9FR5EECrHURJNqxALCA5FtEJA+K53G3imA= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Mon, 27 May 2019 18:35:33 -0400 Message-Id: <20190527223540.21855-2-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190527223540.21855-1-paul.elder@ideasonboard.com> References: <20190527223540.21855-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 1/8] libcamera: ipa_interface: add header X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 May 2019 22:35:48 -0000 Define an IPAInterface class which will contain an IPA implementation. The methods that the IPAInterface exposes form the interface to the IPA implementation, hence the name. IPA module shared objects will implement this class. This also means that IPA module shared objects must be implemented in C++, so remove the C test IPA module. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- include/libcamera/ipa/ipa_interface.h | 22 ++++++++++++++++++++++ include/libcamera/meson.build | 1 + src/libcamera/ipa_interface.cpp | 27 +++++++++++++++++++++++++++ src/libcamera/meson.build | 1 + test/ipa/ipa_test.cpp | 2 -- test/ipa/meson.build | 1 - test/ipa/shared_test.c | 6 ------ 7 files changed, 51 insertions(+), 9 deletions(-) create mode 100644 include/libcamera/ipa/ipa_interface.h create mode 100644 src/libcamera/ipa_interface.cpp delete mode 100644 test/ipa/shared_test.c diff --git a/include/libcamera/ipa/ipa_interface.h b/include/libcamera/ipa/ipa_interface.h new file mode 100644 index 0000000..2c5eb1f --- /dev/null +++ b/include/libcamera/ipa/ipa_interface.h @@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2019, Google Inc. + * + * ipa_interface.h - Image Processing Algorithm interface + */ +#ifndef __LIBCAMERA_IPA_INTERFACE_H__ +#define __LIBCAMERA_IPA_INTERFACE_H__ + +namespace libcamera { + +class IPAInterface +{ +public: + virtual ~IPAInterface() {} + + virtual int init() = 0; +}; + +} /* namespace libcamera */ + +#endif /* __LIBCAMERA_IPA_INTERFACE_H__ */ diff --git a/include/libcamera/meson.build b/include/libcamera/meson.build index 1fcf6b5..1b86fdc 100644 --- a/include/libcamera/meson.build +++ b/include/libcamera/meson.build @@ -5,6 +5,7 @@ libcamera_api = files([ 'event_dispatcher.h', 'event_notifier.h', 'geometry.h', + 'ipa/ipa_interface.h', 'ipa/ipa_module_info.h', 'object.h', 'request.h', diff --git a/src/libcamera/ipa_interface.cpp b/src/libcamera/ipa_interface.cpp new file mode 100644 index 0000000..9d30da2 --- /dev/null +++ b/src/libcamera/ipa_interface.cpp @@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2019, Google Inc. + * + * ipa_interface.cpp - Image Processing Algorithm interface + */ + +#include + +/** + * \file ipa_interface.h + * \brief Image Processing Algorithm interface + */ + +namespace libcamera { + +/** + * \class IPAInterface + * \brief Interface for IPA implementation + */ + +/** + * \fn IPAInterface::init() + * \brief Initialise the IPAInterface + */ + +} /* namespace libcamera */ diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build index 6a73580..07335e5 100644 --- a/src/libcamera/meson.build +++ b/src/libcamera/meson.build @@ -10,6 +10,7 @@ libcamera_sources = files([ 'event_notifier.cpp', 'formats.cpp', 'geometry.cpp', + 'ipa_interface.cpp', 'ipa_module.cpp', 'log.cpp', 'media_device.cpp', diff --git a/test/ipa/ipa_test.cpp b/test/ipa/ipa_test.cpp index 9861ee2..2dbc702 100644 --- a/test/ipa/ipa_test.cpp +++ b/test/ipa/ipa_test.cpp @@ -60,8 +60,6 @@ protected: 9001, }; - count += runTest("test/ipa/ipa-dummy-c.so", testInfo); - count += runTest("test/ipa/ipa-dummy-cpp.so", testInfo); if (count < 0) diff --git a/test/ipa/meson.build b/test/ipa/meson.build index ecde313..08ee95c 100644 --- a/test/ipa/meson.build +++ b/test/ipa/meson.build @@ -1,5 +1,4 @@ ipa_modules_sources = [ - ['ipa-dummy-c', 'shared_test.c'], ['ipa-dummy-cpp', 'shared_test.cpp'], ] diff --git a/test/ipa/shared_test.c b/test/ipa/shared_test.c deleted file mode 100644 index 87d182b..0000000 --- a/test/ipa/shared_test.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -const struct IPAModuleInfo ipaModuleInfo = { - .name = "It's over nine thousand!", - .version = 9001, -}; From patchwork Mon May 27 22:35:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 1320 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0D25A60E47 for ; Tue, 28 May 2019 00:35:49 +0200 (CEST) Received: from localhost.localdomain (unknown [96.44.9.117]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 596F5D85; Tue, 28 May 2019 00:35:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1558996548; bh=u6oPlq3xg+eYiuGUReIHLLWPjGZ0xy7YeOBDiBWA/l0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LX/34vf+BWiIjfEZzCx+Yul9JNBvVLRytEEZsqikLI4g+HP/R6EDZziXYDuw5Q1sL THf9vBcadScF/MK2XcnKDuOVZO+5qIeOQ8kwnxqWBUlqaB5++a2/X0S9gh5nqCxcHu ZzPULcUlcLohK5pQG53NPIfbGykwT7QXLGN43a5k= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Mon, 27 May 2019 18:35:34 -0400 Message-Id: <20190527223540.21855-3-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190527223540.21855-1-paul.elder@ideasonboard.com> References: <20190527223540.21855-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 2/8] libcamera: pipeline: add name, major version, and minor version X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 May 2019 22:35:49 -0000 In order to match an IPA module with a pipeline handler, the pipeline handler must have a name and a major and minor version. Add these to PipelineHandler as functions, so that they can be automatically defined by REGISTER_PIPELINE_HANDLER. Also update documentation accordingly. Signed-off-by: Paul Elder --- src/libcamera/include/pipeline_handler.h | 20 ++++++++++++++++++-- src/libcamera/pipeline/ipu3/ipu3.cpp | 6 +++++- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 6 +++++- src/libcamera/pipeline/uvcvideo.cpp | 6 +++++- src/libcamera/pipeline/vimc.cpp | 6 +++++- src/libcamera/pipeline_handler.cpp | 20 ++++++++++++++++++++ 6 files changed, 58 insertions(+), 6 deletions(-) diff --git a/src/libcamera/include/pipeline_handler.h b/src/libcamera/include/pipeline_handler.h index 7da6df1..7963e7a 100644 --- a/src/libcamera/include/pipeline_handler.h +++ b/src/libcamera/include/pipeline_handler.h @@ -77,6 +77,10 @@ public: bool completeBuffer(Camera *camera, Request *request, Buffer *buffer); void completeRequest(Camera *camera, Request *request); + virtual const char *name() = 0; + virtual int majorVersion() = 0; + virtual int minorVersion() = 0; + protected: void registerCamera(std::shared_ptr camera, std::unique_ptr data); @@ -112,7 +116,7 @@ private: std::string name_; }; -#define REGISTER_PIPELINE_HANDLER(handler) \ +#define REGISTER_PIPELINE_HANDLER(handler, majorV, minorV) \ class handler##Factory final : public PipelineHandlerFactory \ { \ public: \ @@ -122,7 +126,19 @@ public: \ return std::make_shared(manager); \ } \ }; \ -static handler##Factory global_##handler##Factory; +static handler##Factory global_##handler##Factory; \ +const char *handler::name() \ +{ \ + return #handler; \ +} \ +int handler::majorVersion() \ +{ \ + return majorV; \ +} \ +int handler::minorVersion() \ +{ \ + return minorV; \ +} } /* namespace libcamera */ diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 05005c4..a1b06fe 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -212,6 +212,10 @@ public: bool match(DeviceEnumerator *enumerator) override; + const char *name() override; + int majorVersion() override; + int minorVersion() override; + private: IPU3CameraData *cameraData(const Camera *camera) { @@ -1452,6 +1456,6 @@ int CIO2Device::mediaBusToFormat(unsigned int code) } } -REGISTER_PIPELINE_HANDLER(PipelineHandlerIPU3); +REGISTER_PIPELINE_HANDLER(PipelineHandlerIPU3, 0, 1); } /* namespace libcamera */ diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index 9b3eea2..7042e7f 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -92,6 +92,10 @@ public: bool match(DeviceEnumerator *enumerator) override; + const char *name() override; + int majorVersion() override; + int minorVersion() override; + private: RkISP1CameraData *cameraData(const Camera *camera) { @@ -499,6 +503,6 @@ void PipelineHandlerRkISP1::bufferReady(Buffer *buffer) completeRequest(activeCamera_, request); } -REGISTER_PIPELINE_HANDLER(PipelineHandlerRkISP1); +REGISTER_PIPELINE_HANDLER(PipelineHandlerRkISP1, 0, 1); } /* namespace libcamera */ diff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp index 45260f3..27c731e 100644 --- a/src/libcamera/pipeline/uvcvideo.cpp +++ b/src/libcamera/pipeline/uvcvideo.cpp @@ -68,6 +68,10 @@ public: bool match(DeviceEnumerator *enumerator) override; + const char *name() override; + int majorVersion() override; + int minorVersion() override; + private: UVCCameraData *cameraData(const Camera *camera) { @@ -263,6 +267,6 @@ void UVCCameraData::bufferReady(Buffer *buffer) pipe_->completeRequest(camera_, request); } -REGISTER_PIPELINE_HANDLER(PipelineHandlerUVC); +REGISTER_PIPELINE_HANDLER(PipelineHandlerUVC, 0, 1); } /* namespace libcamera */ diff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp index 0e4eede..d3ff527 100644 --- a/src/libcamera/pipeline/vimc.cpp +++ b/src/libcamera/pipeline/vimc.cpp @@ -71,6 +71,10 @@ public: bool match(DeviceEnumerator *enumerator) override; + const char *name() override; + int majorVersion() override; + int minorVersion() override; + private: VimcCameraData *cameraData(const Camera *camera) { @@ -274,6 +278,6 @@ void VimcCameraData::bufferReady(Buffer *buffer) pipe_->completeRequest(camera_, request); } -REGISTER_PIPELINE_HANDLER(PipelineHandlerVimc); +REGISTER_PIPELINE_HANDLER(PipelineHandlerVimc, 0, 1); } /* namespace libcamera */ diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp index dd56907..8f83307 100644 --- a/src/libcamera/pipeline_handler.cpp +++ b/src/libcamera/pipeline_handler.cpp @@ -505,6 +505,24 @@ CameraData *PipelineHandler::cameraData(const Camera *camera) * constant for the whole lifetime of the pipeline handler. */ +/** + * \fn PipelineHandler::name() + * \brief Retrieve the pipeline handler name + * \return The pipeline handler name + */ + +/** + * \fn PipelineHandler::majorVersion() + * \brief Retrieve the pipeline handler major version + * \return The pipeline handler major version + */ + +/** + * \fn PipelineHandler::minorVersion() + * \brief Retrieve the pipeline handler minor version + * \return The pipeline handler minor version + */ + /** * \class PipelineHandlerFactory * \brief Registration of PipelineHandler classes and creation of instances @@ -586,6 +604,8 @@ std::vector &PipelineHandlerFactory::factories() * \def REGISTER_PIPELINE_HANDLER * \brief Register a pipeline handler with the pipeline handler factory * \param[in] handler Class name of PipelineHandler derived class to register + * \param[in] majorV Major version of the PipelineHandler + * \param[in] minorV Minor version of the PipelineHandler * * Register a PipelineHandler subclass with the factory and make it available to * try and match devices. From patchwork Mon May 27 22:35:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 1321 Return-Path: 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 C849261900 for ; Tue, 28 May 2019 00:35:49 +0200 (CEST) Received: from localhost.localdomain (unknown [96.44.9.117]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 1BDAFE3A; Tue, 28 May 2019 00:35:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1558996549; bh=3Eu9etsIboKB6nzpduE0D+OcfjXtT9Fg2CDoIPgbnjM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NNjghaz8Yxb8JLEfxYQlWYTTpbW4WPVhGVwHyABLB2mn2yihx+1+gk6xjQKUGAApG rxbV3I8pbxGeq0E+aG0lbKKk+HF2dtCkhVAsSUf2vmo3ZPdZmei1O4TuGw366d5Vv9 PfYy4/BDPjSB0Rzb/2a0ublp1BRSWtk1h4/ehURY= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Mon, 27 May 2019 18:35:35 -0400 Message-Id: <20190527223540.21855-4-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190527223540.21855-1-paul.elder@ideasonboard.com> References: <20190527223540.21855-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 3/8] libcamera: ipa_module_info: update struct to allow IPA matching X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 May 2019 22:35:51 -0000 We need a way to match pipelines with IPA modules, so add fields in IPAModuleInfo to hold the IPA API version number, the pipeline name, and the pipeline major and minor version. Also update IPA module tests and Doxygen accordingly. Doxygen needs to be updated to accomodate __attribute__((packed)). Signed-off-by: Paul Elder --- Documentation/Doxyfile.in | 7 ++-- include/libcamera/ipa/ipa_module_info.h | 11 ++++-- src/libcamera/ipa_module.cpp | 48 +++++++++++++++++++++---- test/ipa/ipa_test.cpp | 45 ++++++++++++++++++----- test/ipa/shared_test.cpp | 4 ++- 5 files changed, 94 insertions(+), 21 deletions(-) diff --git a/Documentation/Doxyfile.in b/Documentation/Doxyfile.in index 67eaded..ac70efb 100644 --- a/Documentation/Doxyfile.in +++ b/Documentation/Doxyfile.in @@ -2016,7 +2016,7 @@ ENABLE_PREPROCESSING = YES # The default value is: NO. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -MACRO_EXPANSION = NO +MACRO_EXPANSION = YES # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then # the macro expansion is limited to the macros specified with the PREDEFINED and @@ -2024,7 +2024,7 @@ MACRO_EXPANSION = NO # The default value is: NO. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -EXPAND_ONLY_PREDEF = NO +EXPAND_ONLY_PREDEF = YES # If the SEARCH_INCLUDES tag is set to YES, the include files in the # INCLUDE_PATH will be searched if a #include is found. @@ -2057,7 +2057,8 @@ INCLUDE_FILE_PATTERNS = *.h # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. PREDEFINED = __DOXYGEN__ \ - __cplusplus + __cplusplus \ + __attribute__(x)= # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this # tag can be used to specify a list of macro names that should be expanded. The diff --git a/include/libcamera/ipa/ipa_module_info.h b/include/libcamera/ipa/ipa_module_info.h index 4e0d668..84492ed 100644 --- a/include/libcamera/ipa/ipa_module_info.h +++ b/include/libcamera/ipa/ipa_module_info.h @@ -7,14 +7,21 @@ #ifndef __LIBCAMERA_IPA_MODULE_INFO_H__ #define __LIBCAMERA_IPA_MODULE_INFO_H__ +#include + +#define IPA_MODULE_API_VERSION 1 + #ifdef __cplusplus namespace libcamera { #endif struct IPAModuleInfo { + int moduleAPIVersion; + int pipelineVersionMajor; + int pipelineVersionMinor; + char pipelineName[256]; char name[256]; - unsigned int version; -}; +} __attribute__((packed)); #ifdef __cplusplus extern "C" { diff --git a/src/libcamera/ipa_module.cpp b/src/libcamera/ipa_module.cpp index 86cbe71..6e68934 100644 --- a/src/libcamera/ipa_module.cpp +++ b/src/libcamera/ipa_module.cpp @@ -169,6 +169,17 @@ int elfLoadSymbol(void *dst, size_t size, void *map, size_t soSize, } /* namespace */ +/** + * \def IPA_MODULE_API_VERSION + * \brief The IPA API version + * + * This version number specifies the version for the layout of + * struct IPAModuleInfo, and the API between pipeline handlers and the IPA. + * The IPA module should use this macro to define its moduleAPIVersion field. + * + * \sa libcamera::IPAModuleInfo::moduleAPIVersion + */ + /** * \struct IPAModuleInfo * \brief Information of an IPA module @@ -176,14 +187,39 @@ int elfLoadSymbol(void *dst, size_t size, void *map, size_t soSize, * This structure contains the information of an IPA module. It is loaded, * read, and validated before anything else is loaded from the shared object. * - * \var IPAModuleInfo::name - * \brief The name of the IPA module + * \var IPAModuleInfo::moduleAPIVersion + * \brief The IPA API version that the IPA module was made with + * + * This version number specifies the version for the layout of + * struct IPAModuleInfo, and the API between pipeline handlers and the IPA. + * The IPA module shall report here the version that it was built for, + * using the macro IPA_MODULE_API_VERSION. * - * \var IPAModuleInfo::version - * \brief The version of the IPA module + * \sa IPA_MODULE_API_VERSION * - * \todo abi compatability version - * \todo pipeline compatability matcher + * \var IPAModuleInfo::pipelineVersionMajor + * \brief The pipeline handler version (major) that the IPA module is for + * \todo actually match the pipeline handler against this + * + * The major version of the module and pipeline handler must be equal in + * order for the pipeline handler and the module to be matched. + * + * \var IPAModuleInfo::pipelineVersionMinor + * \brief The pipeline handler version (minor) that the IPA module is for + * + * The minor version of the module must be equal to or greater than + * the pipeline handler minor version in order for the pipeline handler + * and the module to be matched. + * + * \var IPAModuleInfo::pipelineName + * \brief The name of the pipeline handler that the IPA module is for + * + * This name is used to match a pipeline handler with the module. + * The name of the pipeline handler is declared in the pipeline handler + * with the macro REGISTER_PIPELINE_HANDLER. + * + * \var IPAModuleInfo::name + * \brief The name of the IPA module */ /** diff --git a/test/ipa/ipa_test.cpp b/test/ipa/ipa_test.cpp index 2dbc702..f50880e 100644 --- a/test/ipa/ipa_test.cpp +++ b/test/ipa/ipa_test.cpp @@ -33,20 +33,45 @@ protected: const struct IPAModuleInfo &info = ll->info(); - if (strcmp(info.name, testInfo.name)) { - cerr << "test IPA module has incorrect name" << endl; - cerr << "expected \"" << testInfo.name << "\", got \"" - << info.name << "\"" << endl; + stringstream errString; + + if (info.moduleAPIVersion != testInfo.moduleAPIVersion) { + errString << "incorrect name: expected \"" + << testInfo.moduleAPIVersion << "\", got \"" + << info.moduleAPIVersion << "\"" << endl; ret = -1; } - if (info.version != testInfo.version) { - cerr << "test IPA module has incorrect version" << endl; - cerr << "expected \"" << testInfo.version << "\", got \"" - << info.version << "\"" << endl; + if (info.pipelineVersionMajor != testInfo.pipelineVersionMajor) { + errString << "incorrect name: expected \"" + << testInfo.pipelineVersionMajor << "\", got \"" + << info.pipelineVersionMajor << "\"" << endl; ret = -1; } + if (info.pipelineVersionMinor != testInfo.pipelineVersionMinor) { + errString << "incorrect name: expected \"" + << testInfo.pipelineVersionMinor << "\", got \"" + << info.pipelineVersionMinor << "\"" << endl; + ret = -1; + } + + if (strcmp(info.pipelineName, testInfo.pipelineName)) { + errString << "incorrect name: expected \"" + << testInfo.pipelineName << "\", got \"" + << info.pipelineName << "\"" << endl; + ret = -1; + } + + if (strcmp(info.name, testInfo.name)) { + errString << "incorrect name: expected \"" + << testInfo.name << "\", got \"" + << info.name << "\"" << endl; + ret = -1; + } + + cerr << errString.str(); + delete ll; return ret; } @@ -56,8 +81,10 @@ protected: int count = 0; const struct IPAModuleInfo testInfo = { + 1, + 0, 9001, + "bleep", "It's over nine thousand!", - 9001, }; count += runTest("test/ipa/ipa-dummy-cpp.so", testInfo); diff --git a/test/ipa/shared_test.cpp b/test/ipa/shared_test.cpp index 4e5c976..d932a9b 100644 --- a/test/ipa/shared_test.cpp +++ b/test/ipa/shared_test.cpp @@ -4,8 +4,10 @@ namespace libcamera { extern "C" { const struct libcamera::IPAModuleInfo ipaModuleInfo = { + 1, + 0, 9001, + "bleep", "It's over nine thousand!", - 9001, }; }; From patchwork Mon May 27 22:35:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 1322 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9427C618F8 for ; Tue, 28 May 2019 00:35:50 +0200 (CEST) Received: from localhost.localdomain (unknown [96.44.9.117]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id D01E3D85; Tue, 28 May 2019 00:35:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1558996550; bh=7czLoM6h4CXiFdcVKIGsV6OgYRIV/mBVwKekKrgqENQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oHmMQOw3k0UT4HXoCUlPQoOWhbamLdcIGE7bS6/hL6H2c5rFtqbFe4U9rjIj82Cu+ ycbG0S4KFaJTVJxqn+eRzr57knB/9dhCfWjozqtG+BQm6eWhkBJzhDteGT4tc9ydjY H36IsSYOP/manM86hp9Rl7vunFcjmJkTMM8pvLMw= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Mon, 27 May 2019 18:35:36 -0400 Message-Id: <20190527223540.21855-5-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190527223540.21855-1-paul.elder@ideasonboard.com> References: <20190527223540.21855-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 4/8] libcamera: ipa_module: allow instantiation of IPAInterface X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 May 2019 22:35:51 -0000 Add functions for loading the IPAInterface factory function from an IPA module shared object, and for creating an instance of an IPAInterface. These functions will be used by IPAManager, from which a PipelineHandler will request an IPAInterface. Also update meson to add the "-ldl" linker argument, to allow loading of the factory function from a shared object. Signed-off-by: Paul Elder --- src/libcamera/include/ipa_module.h | 15 +++++- src/libcamera/ipa_module.cpp | 80 ++++++++++++++++++++++++++++-- src/libcamera/meson.build | 3 +- 3 files changed, 92 insertions(+), 6 deletions(-) diff --git a/src/libcamera/include/ipa_module.h b/src/libcamera/include/ipa_module.h index a4c6dbd..bb03407 100644 --- a/src/libcamera/include/ipa_module.h +++ b/src/libcamera/include/ipa_module.h @@ -7,9 +7,10 @@ #ifndef __LIBCAMERA_IPA_MODULE_H__ #define __LIBCAMERA_IPA_MODULE_H__ -#include - +#include #include +#include +#include namespace libcamera { @@ -17,16 +18,26 @@ class IPAModule { public: explicit IPAModule(const std::string &libPath); + ~IPAModule(); bool isValid() const; const struct IPAModuleInfo &info() const; + bool load(); + + std::unique_ptr createInstance(); + private: struct IPAModuleInfo info_; std::string libPath_; bool valid_; + bool loaded_; + + void *dlhandle_; + typedef IPAInterface *(*ipaiFactory)(void); + ipaiFactory ipaCreate_; int loadIPAModuleInfo(); }; diff --git a/src/libcamera/ipa_module.cpp b/src/libcamera/ipa_module.cpp index 6e68934..9bb0594 100644 --- a/src/libcamera/ipa_module.cpp +++ b/src/libcamera/ipa_module.cpp @@ -7,6 +7,7 @@ #include "ipa_module.h" +#include #include #include #include @@ -242,13 +243,11 @@ int elfLoadSymbol(void *dst, size_t size, void *map, size_t soSize, * The IPA module shared object file must be of the same endianness and * bitness as libcamera. * - * \todo load funtions from the IPA to be used by pipelines - * * The caller shall call the isValid() method after constructing an * IPAModule instance to verify the validity of the IPAModule. */ IPAModule::IPAModule(const std::string &libPath) - : libPath_(libPath), valid_(false) + : libPath_(libPath), valid_(false), loaded_(false) { if (loadIPAModuleInfo() < 0) return; @@ -256,6 +255,12 @@ IPAModule::IPAModule(const std::string &libPath) valid_ = true; } +IPAModule::~IPAModule() +{ + if (dlhandle_) + dlclose(dlhandle_); +} + int IPAModule::loadIPAModuleInfo() { int fd = open(libPath_.c_str(), O_RDONLY); @@ -325,4 +330,73 @@ const struct IPAModuleInfo &IPAModule::info() const return info_; } +/** + * \brief Load the IPA implementation factory from the shared object + * + * The IPA module shared object implements an IPAInterface class to be used + * by pipeline handlers. This function loads the factory function from the + * shared object. Later, createInstance() can be called to instantiate the + * IPAInterface. + * + * This function only needs to be called successfully once, after which + * createInstance can be called as many times as IPAInterface instances are + * needed. + * + * Calling this function on an invalid module (as returned by isValid()) is + * an error. + * + * \return true if load was successful, or already loaded, and false otherwise + */ +bool IPAModule::load() +{ + if (!valid_) + return false; + + if (loaded_) + return true; + + dlhandle_ = dlopen(libPath_.c_str(), RTLD_LAZY); + if (!dlhandle_) { + LOG(IPAModule, Error) << "Failed to open IPA module shared object" + << dlerror(); + return false; + } + + void *symbol = dlsym(dlhandle_, "ipaCreate"); + if (!symbol) { + LOG(IPAModule, Error) << "Failed to load ipaCreate() from IPA module shared object" + << dlerror(); + dlclose(dlhandle_); + return false; + } + + ipaCreate_ = (ipaiFactory)symbol; + + loaded_ = true; + + return true; +} + +/** + * \brief Instantiate an IPAInterface + * + * After the IPAInterface implementation factory has been loaded (with load()), + * an instance can be created with this function. + * + * Calling this function on a module that has not yet been loaded, or an + * invalid module (as returned by load() and isValid(), respectively) is + * an error. + * + * \return the IPA implementation as a new IPAInterface instance + */ +std::unique_ptr IPAModule::createInstance() +{ + if (!valid_ || !loaded_) + return nullptr; + + std::unique_ptr ipai(ipaCreate_()); + + return ipai; +} + } /* namespace libcamera */ diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build index 07335e5..32f7da4 100644 --- a/src/libcamera/meson.build +++ b/src/libcamera/meson.build @@ -65,7 +65,8 @@ libcamera = shared_library('camera', libcamera_sources, install : true, include_directories : includes, - dependencies : libudev) + dependencies : libudev, + link_args : '-ldl') libcamera_dep = declare_dependency(sources : [libcamera_api, libcamera_h], include_directories : libcamera_includes, From patchwork Mon May 27 22:35:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 1323 Return-Path: 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 55FB0618F8 for ; Tue, 28 May 2019 00:35:51 +0200 (CEST) Received: from localhost.localdomain (unknown [96.44.9.117]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 8AC7AE4D; Tue, 28 May 2019 00:35:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1558996551; bh=ejkr2Gr046lR6nsQ+6poVvE2QydUKLMjBuvLNG0wGiU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JY7Y+iNVz4NcPv15L6chZWEEgLNs6EB16mdCMfL6bwOCwJ/8tiQvOKWt5cnNZa63d 7Mg7SLW/oGb0MmvXAAI3d0YkoX8IDJWacnlphlMuZpf4tmgG87CxhZYFuDapWhqFyN iZ5kNKoC1b4TX1mYoguB9KMaGkPjmLD0bNSL1KYc= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Mon, 27 May 2019 18:35:37 -0400 Message-Id: <20190527223540.21855-6-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190527223540.21855-1-paul.elder@ideasonboard.com> References: <20190527223540.21855-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 5/8] libcamera: ipa_manager: implement class for managing IPA modules X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 May 2019 22:35:51 -0000 IPAManager is a class that will search in given directories for IPA modules, and will load them into a list. It also provides an interface for pipeline handlers to aquire an IPA. Signed-off-by: Paul Elder --- src/libcamera/include/ipa_manager.h | 40 +++++++++ src/libcamera/ipa_manager.cpp | 129 ++++++++++++++++++++++++++++ src/libcamera/meson.build | 2 + 3 files changed, 171 insertions(+) create mode 100644 src/libcamera/include/ipa_manager.h create mode 100644 src/libcamera/ipa_manager.cpp diff --git a/src/libcamera/include/ipa_manager.h b/src/libcamera/include/ipa_manager.h new file mode 100644 index 0000000..fafafad --- /dev/null +++ b/src/libcamera/include/ipa_manager.h @@ -0,0 +1,40 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2019, Google Inc. + * + * ipa_manager.h - Image Processing Algorithm module manager + */ +#ifndef __LIBCAMERA_IPA_MANAGER_H__ +#define __LIBCAMERA_IPA_MANAGER_H__ + +#include +#include +#include +#include + +#include "ipa_module.h" +#include "pipeline_handler.h" + +namespace libcamera { + +class IPAManager +{ +public: + static IPAManager *instance(); + + int addDir(const std::string &libDir); + + std::unique_ptr createIPA(PipelineHandler *pipe) const; + +private: + std::list modules_; + + IPAManager(); + ~IPAManager(); + + bool match(const IPAModule *ipam, PipelineHandler *pipe) const; +}; + +} /* namespace libcamera */ + +#endif /* __LIBCAMERA_IPA_MANAGER_H__ */ diff --git a/src/libcamera/ipa_manager.cpp b/src/libcamera/ipa_manager.cpp new file mode 100644 index 0000000..3b3c1a6 --- /dev/null +++ b/src/libcamera/ipa_manager.cpp @@ -0,0 +1,129 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2019, Google Inc. + * + * ipa_manager.cpp - Image Processing Algorithm module manager + */ + +#include "ipa_manager.h" +#include "ipa_module.h" +#include "pipeline_handler.h" +#include "utils.h" + +#include +#include +#include +#include + +#include "log.h" + +/** + * \file ipa_manager.h + * \brief Image Processing Algorithm module manager + */ + +namespace libcamera { + +LOG_DEFINE_CATEGORY(IPAManager) + +/** + * \class IPAManager + * \brief Manager for IPA modules + */ + +IPAManager::IPAManager() +{ +} + +IPAManager::~IPAManager() +{ + for (IPAModule *module : modules_) + delete module; +} + +/** + * \brief Retrieve the IPA manager instance + * + * The IPAManager is a singleton and can't be constructed manually. This + * function shall instead be used to retrieve the single global instance of the + * manager. + * + * \return The IPA manager instance + */ +IPAManager *IPAManager::instance() +{ + static IPAManager ipaManager; + return &ipaManager; +} + +/** + * \brief Load IPA modules from a directory + * \param[in] libDir directory to search for IPA modules + * + * Goes through \a libDir and tries to create an IPAModule instance for every + * found shared object. Skips invalid IPA modules. + * + * \return total number of modules loaded (including modules loaded in + * previous calls of this function), or negative error code + */ +int IPAManager::addDir(const std::string &libDir) +{ + struct dirent *ent; + DIR *dir; + + dir = opendir(libDir.c_str()); + if (!dir) { + int ret = -errno; + LOG(IPAManager, Error) << "Invalid path for IPA modules: " + << strerror(ret); + return ret; + } + + while ((ent = readdir(dir)) != nullptr) { + int offset = strlen(ent->d_name) - 3; + if (strncmp(&ent->d_name[offset], ".so", 3)) + continue; + + IPAModule *ipaModule = new IPAModule(libDir + "/" + ent->d_name); + if (ipaModule->isValid()) + modules_.push_back(ipaModule); + } + + closedir(dir); + return modules_.size(); +} + +/** + * \brief Create an IPA interface that matches a given pipeline handler + * \param[in] pipe the pipeline handler that wants a matching IPA interface + * + * \return IPA interface, or nullptr if no matching IPA module is found + */ +std::unique_ptr IPAManager::createIPA(PipelineHandler *pipe) const +{ + IPAModule *m = nullptr; + + for (IPAModule *module : modules_) { + if (match(module, pipe)) { + m = module; + break; + } + } + + if (!m || !m->load()) + return nullptr; + + return m->createInstance(); +} + +bool IPAManager::match(const IPAModule *ipam, PipelineHandler *pipe) const +{ + const struct IPAModuleInfo *info = &ipam->info(); + + return !strcmp(info->pipelineName, pipe->name()) && + info->pipelineVersionMajor == pipe->majorVersion() && + info->pipelineVersionMinor >= pipe->minorVersion() && + info->moduleAPIVersion == IPA_MODULE_API_VERSION; +} + +} /* namespace libcamera */ diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build index 32f7da4..0889b0d 100644 --- a/src/libcamera/meson.build +++ b/src/libcamera/meson.build @@ -11,6 +11,7 @@ libcamera_sources = files([ 'formats.cpp', 'geometry.cpp', 'ipa_interface.cpp', + 'ipa_manager.cpp', 'ipa_module.cpp', 'log.cpp', 'media_device.cpp', @@ -33,6 +34,7 @@ libcamera_headers = files([ 'include/device_enumerator_udev.h', 'include/event_dispatcher_poll.h', 'include/formats.h', + 'include/ipa_manager.h', 'include/ipa_module.h', 'include/log.h', 'include/media_device.h', From patchwork Mon May 27 22:35:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 1324 Return-Path: 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 F038E6190A for ; Tue, 28 May 2019 00:35:51 +0200 (CEST) Received: from localhost.localdomain (unknown [96.44.9.117]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 47EF51519; Tue, 28 May 2019 00:35:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1558996551; bh=n+kRchl3jel5l5hc5M6W1aPPX8t76hlOITSbPV7kDlI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ld55MfqWCd6JnzokpslPUKVgBbcZ1oEnnt9gaH9RIUFP0MmJPdRRC/na3iDXOHuYX TewTQqs6JIBWjpd4NH4D+6xivYNMO7xt0vtd9oUrwn0GRNbLhFr0ynbQnsWsX2mF/j 2l5oFN73n8oomS4J1ioX+csDnOSX/3ZEydqYB9L8= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Mon, 27 May 2019 18:35:38 -0400 Message-Id: <20190527223540.21855-7-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190527223540.21855-1-paul.elder@ideasonboard.com> References: <20190527223540.21855-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 6/8] libcamera: ipa: add dummy IPA implementation X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 May 2019 22:35:52 -0000 Add a dummy IPA module. Signed-off-by: Paul Elder --- src/ipa/ipa_dummy.cpp | 38 ++++++++++++++++++++++++++++++++++++++ src/ipa/meson.build | 10 ++++++++++ src/meson.build | 1 + 3 files changed, 49 insertions(+) create mode 100644 src/ipa/ipa_dummy.cpp create mode 100644 src/ipa/meson.build diff --git a/src/ipa/ipa_dummy.cpp b/src/ipa/ipa_dummy.cpp new file mode 100644 index 0000000..e246b58 --- /dev/null +++ b/src/ipa/ipa_dummy.cpp @@ -0,0 +1,38 @@ +#include +#include + +#include + +namespace libcamera { + +class IPADummy : public IPAInterface +{ +public: + int init(); +}; + +int IPADummy::init() +{ + std::cout << "initializing dummy IPA!" << std::endl; + return 0; +} + +/* + * External IPA module interface + */ + +extern "C" { +const struct libcamera::IPAModuleInfo ipaModuleInfo = { + 1, + 0, 1, + "PipelineHandlerVimc", + "Dummy IPA for Vimc", +}; + +IPAInterface *ipaCreate() +{ + return new IPADummy(); +} +}; + +}; /* namespace libcamera */ diff --git a/src/ipa/meson.build b/src/ipa/meson.build new file mode 100644 index 0000000..1ed29eb --- /dev/null +++ b/src/ipa/meson.build @@ -0,0 +1,10 @@ +ipa_dummy_sources = files([ + 'ipa_dummy.cpp', +]) + +ipa_dummy = shared_library('ipa_dummy', + ipa_dummy_sources, + name_prefix : '', + include_directories : libcamera_includes, + install : true, + install_dir : join_paths(get_option('libdir'), 'libcamera')) diff --git a/src/meson.build b/src/meson.build index 4e41fd3..628e7a7 100644 --- a/src/meson.build +++ b/src/meson.build @@ -1,3 +1,4 @@ subdir('libcamera') +subdir('ipa') subdir('cam') subdir('qcam') From patchwork Mon May 27 22:35:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 1325 Return-Path: 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 A06DA6190A for ; Tue, 28 May 2019 00:35:52 +0200 (CEST) Received: from localhost.localdomain (unknown [96.44.9.117]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 135141517; Tue, 28 May 2019 00:35:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1558996552; bh=wC+DJMMUWp1y91p2TiR0UieguOeFfqEjMH0pscavpM4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N1bImudFKYmWryUziSetSkJH5+EkXnBrY8J8MF6jFUVGVEC/2ANia5hd00g5YG20V kronQuNc5JyZSMdLVbvx9/sgCKTUOk5beBJ7NhRPGmdxsCIpaACDcqxeRMNSokKauV bQYhFkLzPxGuoaARKZX/oDaA5kLzHjt0WdhpJDS4= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Mon, 27 May 2019 18:35:39 -0400 Message-Id: <20190527223540.21855-8-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190527223540.21855-1-paul.elder@ideasonboard.com> References: <20190527223540.21855-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 7/8] libcamera: test: remove test IPA and use dummy IPA instead X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 May 2019 22:35:52 -0000 Use the dummy IPA for testing/sample IPA instead of the earlier test IPA. Remove the test IPA, and update tests and meson accordingly. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- test/ipa/ipa_test.cpp | 8 ++++---- test/ipa/meson.build | 10 ---------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/test/ipa/ipa_test.cpp b/test/ipa/ipa_test.cpp index f50880e..53e3a6e 100644 --- a/test/ipa/ipa_test.cpp +++ b/test/ipa/ipa_test.cpp @@ -82,12 +82,12 @@ protected: const struct IPAModuleInfo testInfo = { 1, - 0, 9001, - "bleep", - "It's over nine thousand!", + 0, 1, + "PipelineHandlerVimc", + "Dummy IPA for Vimc", }; - count += runTest("test/ipa/ipa-dummy-cpp.so", testInfo); + count += runTest("src/ipa/ipa_dummy.so", testInfo); if (count < 0) return TestFail; diff --git a/test/ipa/meson.build b/test/ipa/meson.build index 08ee95c..bca39fa 100644 --- a/test/ipa/meson.build +++ b/test/ipa/meson.build @@ -1,13 +1,3 @@ -ipa_modules_sources = [ - ['ipa-dummy-cpp', 'shared_test.cpp'], -] - -foreach m : ipa_modules_sources - shared_library(m, name_prefix : '', - dependencies : libcamera_dep, - include_directories : test_includes_public) -endforeach - ipa_test = [ ['ipa_test', 'ipa_test.cpp'], ] From patchwork Mon May 27 22:35:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 1326 Return-Path: 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 5C02D61908 for ; Tue, 28 May 2019 00:35:53 +0200 (CEST) Received: from localhost.localdomain (unknown [96.44.9.117]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A631AD85; Tue, 28 May 2019 00:35:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1558996553; bh=sbtYDBvv8TNHx3Xz8YtLPRboM979wclK7p3+mnnOifs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JFBEalsIpOvOx4oAaEbTBnRmYvq9eZSrfEVnA30RzNUXlfnjR/p55fC6KrOH7EFg4 Ju50yFxUlSxhl1AL+zWoby4alVCjtBymZMdwUiwWguDg3CQnhu9srS4T11Kb2nB8oV UYsYW3sXFIKv4GiNxx3nT6la/j+f6keyd0TjIZbw= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Mon, 27 May 2019 18:35:40 -0400 Message-Id: <20190527223540.21855-9-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190527223540.21855-1-paul.elder@ideasonboard.com> References: <20190527223540.21855-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 8/8] libcamera: pipeline: vimc: add dummy IPA X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 May 2019 22:35:53 -0000 Make the vimc pipeline handler get the dummy IPA, to show how an IPA can be acquired by a pipeline handler. Signed-off-by: Paul Elder --- src/libcamera/pipeline/vimc.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp index d3ff527..1df5e5a 100644 --- a/src/libcamera/pipeline/vimc.cpp +++ b/src/libcamera/pipeline/vimc.cpp @@ -9,10 +9,12 @@ #include #include +#include #include #include #include "device_enumerator.h" +#include "ipa_manager.h" #include "log.h" #include "media_device.h" #include "pipeline_handler.h" @@ -252,6 +254,14 @@ bool PipelineHandlerVimc::match(DeviceEnumerator *enumerator) if (!media) return false; + IPAManager *ipaManager = IPAManager::instance(); + ipaManager->addDir("src/ipa"); + std::unique_ptr ipa = ipaManager->createIPA(this); + if (ipa == nullptr) + LOG(VIMC, Error) << "no matching IPA found"; + else + ipa->init(); + std::unique_ptr data = utils::make_unique(this); /* Locate and open the capture video node. */