{"id":1278,"url":"https://patchwork.libcamera.org/api/1.1/patches/1278/?format=json","web_url":"https://patchwork.libcamera.org/patch/1278/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20190523164210.2105-3-paul.elder@ideasonboard.com>","date":"2019-05-23T16:42:07","name":"[libcamera-devel,RFC,v2,2/5] libcamera: ipa_module: add aquired attribute","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"e334cf819a20f9b9ddcf8c24b055fc4c9d7be2bc","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/1.1/people/17/?format=json","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/1278/mbox/","series":[{"id":324,"url":"https://patchwork.libcamera.org/api/1.1/series/324/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=324","date":"2019-05-23T16:42:05","name":"Add IPAManager","version":2,"mbox":"https://patchwork.libcamera.org/series/324/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/1278/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/1278/checks/","tags":{},"headers":{"Return-Path":"<paul.elder@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9C207618CD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 23 May 2019 18:42:25 +0200 (CEST)","from localhost.localdomain (unknown [96.44.9.117])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E638D334;\n\tThu, 23 May 2019 18:42:24 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1558629745;\n\tbh=8eP52V31XgW1dzUtthrgIyG4Di7EublzgjColo/Txwc=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=Q8BTNfP1Qo2Hd4mvLboVlvz02KSTJ3UqEv84TwNlFU6zL+m+zqK+pxVa8JgKq4E3W\n\tdv+SHqXWDcvCUsZBlWH2BcuXjoSkoTQqIy5DCwrhDl14aka7uxygsTr1eHEhk+IS5J\n\tGp47eHpZAvboiBqMlfl4QO8X0sIptoqNFx7ndcUs=","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Thu, 23 May 2019 12:42:07 -0400","Message-Id":"<20190523164210.2105-3-paul.elder@ideasonboard.com>","X-Mailer":"git-send-email 2.20.1","In-Reply-To":"<20190523164210.2105-1-paul.elder@ideasonboard.com>","References":"<20190523164210.2105-1-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [RFC PATCH v2 2/5] libcamera: ipa_module: add\n\taquired attribute","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Thu, 23 May 2019 16:42:26 -0000"},"content":"The IPAManager will be designed like an enumerator, and IPA modules\ncannot be used by multiple pipelines at once. Add an aquired attribute\nto IPAModule, and corresponding getter and setters.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n---\nChanges in v2:\n- renamed acquired() to isAcquired(), to match isValid()\n- added documentation\n\n src/libcamera/include/ipa_module.h |  5 +++\n src/libcamera/ipa_module.cpp       | 62 ++++++++++++++++++++++++++----\n 2 files changed, 60 insertions(+), 7 deletions(-)","diff":"diff --git a/src/libcamera/include/ipa_module.h b/src/libcamera/include/ipa_module.h\nindex a4c6dbd..58faeca 100644\n--- a/src/libcamera/include/ipa_module.h\n+++ b/src/libcamera/include/ipa_module.h\n@@ -22,11 +22,16 @@ public:\n \n \tconst struct IPAModuleInfo &info() const;\n \n+\tbool isAcquired() const;\n+\tbool acquire();\n+\tvoid release();\n+\n private:\n \tstruct IPAModuleInfo info_;\n \n \tstd::string libPath_;\n \tbool valid_;\n+\tbool acquired_;\n \n \tint loadIPAModuleInfo();\n };\ndiff --git a/src/libcamera/ipa_module.cpp b/src/libcamera/ipa_module.cpp\nindex 86cbe71..4922e3e 100644\n--- a/src/libcamera/ipa_module.cpp\n+++ b/src/libcamera/ipa_module.cpp\n@@ -176,14 +176,17 @@ int elfLoadSymbol(void *dst, size_t size, void *map, size_t soSize,\n  * This structure contains the information of an IPA module. It is loaded,\n  * read, and validated before anything else is loaded from the shared object.\n  *\n- * \\var IPAModuleInfo::name\n- * \\brief The name of the IPA module\n+ * \\var IPAModuleInfo::ipaAPIVersion\n+ * \\brief The IPA API version that the IPA module was made with\n  *\n- * \\var IPAModuleInfo::version\n- * \\brief The version of the IPA module\n+ * \\var IPAModuleInfo::pipelineVersion\n+ * \\brief The pipeline version that the IPA module is for\n  *\n- * \\todo abi compatability version\n- * \\todo pipeline compatability matcher\n+ * \\var IPAModuleInfo::pipelineName\n+ * \\brief The name of the pipeline that the IPA module is for\n+ *\n+ * \\var IPAModuleInfo::name\n+ * \\brief The name of the IPA module\n  */\n \n /**\n@@ -212,7 +215,7 @@ int elfLoadSymbol(void *dst, size_t size, void *map, size_t soSize,\n  * IPAModule instance to verify the validity of the IPAModule.\n  */\n IPAModule::IPAModule(const std::string &libPath)\n-\t: libPath_(libPath), valid_(false)\n+\t: libPath_(libPath), valid_(false), acquired_(false)\n {\n \tif (loadIPAModuleInfo() < 0)\n \t\treturn;\n@@ -289,4 +292,49 @@ const struct IPAModuleInfo &IPAModule::info() const\n \treturn info_;\n }\n \n+/**\n+ * \\brief Check if IPA module is in use\n+ *\n+ * \\return true if the IPA module has been claimed for exclusive use, or\n+ * false if it is available\n+ * \\sa acquire(), release()\n+ */\n+bool IPAModule::isAcquired() const\n+{\n+\treturn acquired_;\n+}\n+\n+/**\n+ * \\brief Claim an IPA module for exclusive use\n+ *\n+ * Each IPA module is meant to be used by only one pipeline handler.\n+ * IPA modules will be acquired through the IPAManager, which will\n+ * use this method to claim an IPA module before returning it, and will\n+ * skip over already claimed IPA modules.\n+ *\n+ * When the IPA module is not needed anymore, the release() method should\n+ * be called.\n+ *\n+ * \\return true if the IPA module was successfully claimed, or false if\n+ * was already claimed\n+ * \\sa isAcquired(), release()\n+ */\n+bool IPAModule::acquire()\n+{\n+\tif (acquired_)\n+\t\treturn false;\n+\n+\tacquired_ = true;\n+\treturn true;\n+}\n+\n+/**\n+ * \\brief Release an IPA module previously claimed for exclusive use\n+ * \\sa acquire(), isAcquired()\n+ */\n+void IPAModule::release()\n+{\n+\tacquired_ = false;\n+}\n+\n } /* namespace libcamera */\n","prefixes":["libcamera-devel","RFC","v2","2/5"]}