From patchwork Wed May 22 21:02:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 1257 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8655660C1D for ; Wed, 22 May 2019 23:02:40 +0200 (CEST) Received: from localhost.localdomain (unknown [96.44.9.117]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id DC9D3443; Wed, 22 May 2019 23:02:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1558558960; bh=taQlwj66wEEKf2K8OTshHMR1u1IONV+5vLaFO3OWXTM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jBGY0JluxIQkkdbRIo2cHmYl8qOkO/f5yAzpgQt642RmLtcG5Gk2rVmLPLXycRR3O HMY9NEcJJGB/DLQhF5Ff3ZCSsbq1wIABzzknVAciyJ9aDKBQOGxijUoX2KR4V3dYh2 84KzBUeo6i8+jo3VzVL2IxMF+UWdWm9i+Osc+kig= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Wed, 22 May 2019 17:02:17 -0400 Message-Id: <20190522210220.1631-3-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190522210220.1631-1-paul.elder@ideasonboard.com> References: <20190522210220.1631-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [RFC PATCH 2/5] libcamera: ipa_module: add aquired attribute 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: Wed, 22 May 2019 21:02:41 -0000 The IPAManager will be designed like an enumerator, and IPA modules cannot be used by multiple pipelines at once. Add an aquired attribute to IPAModule, and corresponding getter and setters. Signed-off-by: Paul Elder --- src/libcamera/include/ipa_module.h | 5 +++++ src/libcamera/ipa_module.cpp | 21 ++++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/libcamera/include/ipa_module.h b/src/libcamera/include/ipa_module.h index a4c6dbd..dc26037 100644 --- a/src/libcamera/include/ipa_module.h +++ b/src/libcamera/include/ipa_module.h @@ -22,11 +22,16 @@ public: const struct IPAModuleInfo &info() const; + bool acquired(); + bool acquire(); + void release(); + private: struct IPAModuleInfo info_; std::string libPath_; bool valid_; + bool acquired_; int loadIPAModuleInfo(); }; diff --git a/src/libcamera/ipa_module.cpp b/src/libcamera/ipa_module.cpp index 86cbe71..fb294e6 100644 --- a/src/libcamera/ipa_module.cpp +++ b/src/libcamera/ipa_module.cpp @@ -212,7 +212,7 @@ int elfLoadSymbol(void *dst, size_t size, void *map, size_t soSize, * IPAModule instance to verify the validity of the IPAModule. */ IPAModule::IPAModule(const std::string &libPath) - : libPath_(libPath), valid_(false) + : libPath_(libPath), valid_(false), acquired_(false) { if (loadIPAModuleInfo() < 0) return; @@ -289,4 +289,23 @@ const struct IPAModuleInfo &IPAModule::info() const return info_; } +bool IPAModule::acquired() +{ + return acquired_; +} + +bool IPAModule::acquire() +{ + if (acquired_) + return false; + + acquired_ = true; + return true; +} + +void IPAModule::release() +{ + acquired_ = false; +} + } /* namespace libcamera */