From a25533089bda04daf0243eda7e316baea0737e19 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Wed, 25 Mar 2020 09:36:35 +0200 Subject: ipa: Move vimc to a subdirectory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Give a subdirectory to all IPA modules to make the structure of the source tree more consistent. This will also simplify the implementation of IPA module selection at build time. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham Reviewed-by: Niklas Söderlund --- src/ipa/ipa_vimc.cpp | 119 ----------------------------------------------- src/ipa/meson.build | 20 +------- src/ipa/vimc/meson.build | 15 ++++++ src/ipa/vimc/vimc.cpp | 119 +++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 136 insertions(+), 137 deletions(-) delete mode 100644 src/ipa/ipa_vimc.cpp create mode 100644 src/ipa/vimc/meson.build create mode 100644 src/ipa/vimc/vimc.cpp (limited to 'src') diff --git a/src/ipa/ipa_vimc.cpp b/src/ipa/ipa_vimc.cpp deleted file mode 100644 index 4751ad91..00000000 --- a/src/ipa/ipa_vimc.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/* SPDX-License-Identifier: LGPL-2.1-or-later */ -/* - * Copyright (C) 2019, Google Inc. - * - * ipa_vimc.cpp - Vimc Image Processing Algorithm module - */ - -#include - -#include -#include -#include -#include - -#include - -#include -#include - -#include "libipa/ipa_interface_wrapper.h" - -#include "log.h" - -namespace libcamera { - -LOG_DEFINE_CATEGORY(IPAVimc) - -class IPAVimc : public IPAInterface -{ -public: - IPAVimc(); - ~IPAVimc(); - - int init() override; - void configure(const std::map &streamConfig, - const std::map &entityControls) override {} - void mapBuffers(const std::vector &buffers) override {} - void unmapBuffers(const std::vector &ids) override {} - void processEvent(const IPAOperationData &event) override {} - -private: - void initTrace(); - void trace(enum IPAOperationCode operation); - - int fd_; -}; - -IPAVimc::IPAVimc() - : fd_(-1) -{ - initTrace(); -} - -IPAVimc::~IPAVimc() -{ - if (fd_) - ::close(fd_); -} - -int IPAVimc::init() -{ - trace(IPAOperationInit); - - LOG(IPAVimc, Debug) << "initializing vimc IPA!"; - - return 0; -} - -void IPAVimc::initTrace() -{ - struct stat fifoStat; - int ret = stat(VIMC_IPA_FIFO_PATH, &fifoStat); - if (ret) - return; - - ret = ::open(VIMC_IPA_FIFO_PATH, O_WRONLY); - if (ret < 0) { - ret = errno; - LOG(IPAVimc, Error) << "Failed to open vimc IPA test FIFO: " - << strerror(ret); - return; - } - - fd_ = ret; -} - -void IPAVimc::trace(enum IPAOperationCode operation) -{ - if (fd_ < 0) - return; - - int ret = ::write(fd_, &operation, sizeof(operation)); - if (ret < 0) { - ret = errno; - LOG(IPAVimc, Error) << "Failed to write to vimc IPA test FIFO: " - << strerror(ret); - } -} - -/* - * External IPA module interface - */ - -extern "C" { -const struct IPAModuleInfo ipaModuleInfo = { - IPA_MODULE_API_VERSION, - 0, - "PipelineHandlerVimc", - "Dummy IPA for Vimc", - LICENSE, -}; - -struct ipa_context *ipaCreate() -{ - return new IPAInterfaceWrapper(std::make_unique()); -} -} - -} /* namespace libcamera */ diff --git a/src/ipa/meson.build b/src/ipa/meson.build index 42180324..9aaf9249 100644 --- a/src/ipa/meson.build +++ b/src/ipa/meson.build @@ -1,8 +1,3 @@ -ipa_vimc_sources = [ - ['ipa_vimc', 'LGPL-2.1-or-later'], - ['ipa_vimc_isolate', 'Proprietary'], -] - ipa_install_dir = join_paths(get_option('libdir'), 'libcamera') ipa_includes = [ @@ -10,20 +5,9 @@ ipa_includes = [ libcamera_internal_includes, ] -subdir('libipa') - -foreach t : ipa_vimc_sources - ipa = shared_module(t[0], 'ipa_vimc.cpp', - name_prefix : '', - include_directories : ipa_includes, - dependencies : libcamera_dep, - link_with : libipa, - install : true, - install_dir : ipa_install_dir, - cpp_args : '-DLICENSE="' + t[1] + '"') -endforeach - config_h.set('IPA_MODULE_DIR', '"' + join_paths(get_option('prefix'), ipa_install_dir) + '"') +subdir('libipa') subdir('rkisp1') +subdir('vimc') diff --git a/src/ipa/vimc/meson.build b/src/ipa/vimc/meson.build new file mode 100644 index 00000000..435c7d31 --- /dev/null +++ b/src/ipa/vimc/meson.build @@ -0,0 +1,15 @@ +ipa_vimc_sources = [ + ['ipa_vimc', 'LGPL-2.1-or-later'], + ['ipa_vimc_isolate', 'Proprietary'], +] + +foreach t : ipa_vimc_sources + ipa = shared_module(t[0], 'vimc.cpp', + name_prefix : '', + include_directories : [ipa_includes, libipa_includes], + dependencies : libcamera_dep, + link_with : libipa, + install : true, + install_dir : ipa_install_dir, + cpp_args : '-DLICENSE="' + t[1] + '"') +endforeach diff --git a/src/ipa/vimc/vimc.cpp b/src/ipa/vimc/vimc.cpp new file mode 100644 index 00000000..6e2095b5 --- /dev/null +++ b/src/ipa/vimc/vimc.cpp @@ -0,0 +1,119 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2019, Google Inc. + * + * ipa_vimc.cpp - Vimc Image Processing Algorithm module + */ + +#include + +#include +#include +#include +#include + +#include + +#include +#include + +#include + +#include "log.h" + +namespace libcamera { + +LOG_DEFINE_CATEGORY(IPAVimc) + +class IPAVimc : public IPAInterface +{ +public: + IPAVimc(); + ~IPAVimc(); + + int init() override; + void configure(const std::map &streamConfig, + const std::map &entityControls) override {} + void mapBuffers(const std::vector &buffers) override {} + void unmapBuffers(const std::vector &ids) override {} + void processEvent(const IPAOperationData &event) override {} + +private: + void initTrace(); + void trace(enum IPAOperationCode operation); + + int fd_; +}; + +IPAVimc::IPAVimc() + : fd_(-1) +{ + initTrace(); +} + +IPAVimc::~IPAVimc() +{ + if (fd_) + ::close(fd_); +} + +int IPAVimc::init() +{ + trace(IPAOperationInit); + + LOG(IPAVimc, Debug) << "initializing vimc IPA!"; + + return 0; +} + +void IPAVimc::initTrace() +{ + struct stat fifoStat; + int ret = stat(VIMC_IPA_FIFO_PATH, &fifoStat); + if (ret) + return; + + ret = ::open(VIMC_IPA_FIFO_PATH, O_WRONLY); + if (ret < 0) { + ret = errno; + LOG(IPAVimc, Error) << "Failed to open vimc IPA test FIFO: " + << strerror(ret); + return; + } + + fd_ = ret; +} + +void IPAVimc::trace(enum IPAOperationCode operation) +{ + if (fd_ < 0) + return; + + int ret = ::write(fd_, &operation, sizeof(operation)); + if (ret < 0) { + ret = errno; + LOG(IPAVimc, Error) << "Failed to write to vimc IPA test FIFO: " + << strerror(ret); + } +} + +/* + * External IPA module interface + */ + +extern "C" { +const struct IPAModuleInfo ipaModuleInfo = { + IPA_MODULE_API_VERSION, + 0, + "PipelineHandlerVimc", + "Dummy IPA for Vimc", + LICENSE, +}; + +struct ipa_context *ipaCreate() +{ + return new IPAInterfaceWrapper(std::make_unique()); +} +} + +} /* namespace libcamera */ -- cgit v1.2.1