From patchwork Thu Feb 20 16:57:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 2861 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2DEE0625C1 for ; Thu, 20 Feb 2020 17:57:08 +0100 (CET) Received: from localhost.localdomain (cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id C7F3913C2; Thu, 20 Feb 2020 17:57:07 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1582217827; bh=4Vg9DJG9pZMz6SzWLMBp0i6D9Yk+BQOQBUkHlR1u4JI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qHcAMPW3AE4nHLgG76Lz9Zz2ZR+ON9wXjBum734kSwMh4bdbEZfqhAEuQOKXIw7Pr vmS7JQtWeaVqZNZO5k9hQVMzFb211AaKG6rS+lpv7CuUmAp5g5NEAKi5YgqZj8e4ev 1BjZ5UjSLNNbsK3+/iw5TulU9xrhLruIjoE2ngJk= From: Kieran Bingham To: libcamera devel Date: Thu, 20 Feb 2020 16:57:00 +0000 Message-Id: <20200220165704.23600-3-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200220165704.23600-1-kieran.bingham@ideasonboard.com> References: <20200220165704.23600-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 2/6] libcamera: ipa_manager: Split path handling 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: , X-List-Received-Date: Thu, 20 Feb 2020 16:57:08 -0000 Move the iteration of a colon-separated path to its own function. This prepares for parsing extra path variables. Signed-off-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- src/libcamera/include/ipa_manager.h | 1 + src/libcamera/ipa_manager.cpp | 35 ++++++++++++++++++++++------- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/src/libcamera/include/ipa_manager.h b/src/libcamera/include/ipa_manager.h index 126f8babbc8f..94d35d9062e4 100644 --- a/src/libcamera/include/ipa_manager.h +++ b/src/libcamera/include/ipa_manager.h @@ -33,6 +33,7 @@ private: ~IPAManager(); int addDir(const char *libDir); + int addPath(const char *path); }; } /* namespace libcamera */ diff --git a/src/libcamera/ipa_manager.cpp b/src/libcamera/ipa_manager.cpp index 4ffbdd712ac2..d87f2221b00b 100644 --- a/src/libcamera/ipa_manager.cpp +++ b/src/libcamera/ipa_manager.cpp @@ -110,14 +110,7 @@ IPAManager::IPAManager() return; } - for (const auto &dir : utils::split(modulePaths, ":")) { - if (dir.empty()) - continue; - - int ret = addDir(dir.c_str()); - if (ret > 0) - ipaCount += ret; - } + ipaCount += addPath(modulePaths); if (!ipaCount) LOG(IPAManager, Warning) @@ -197,6 +190,32 @@ int IPAManager::addDir(const char *libDir) return count; } +/** + * \brief Load IPA modules from a search path + * \param[in] path The colon-separated list of directories to load IPA modules from + * + * This method tries to create an IPAModule instance for every shared object + * found in the directories listed in \a path. + * + * \return Number of modules loaded by this call, or a negative error code + * otherwise + */ +int IPAManager::addPath(const char *path) +{ + int ipaCount = 0; + + for (const auto &dir : utils::split(path, ":")) { + if (dir.empty()) + continue; + + int ret = addDir(dir.c_str()); + if (ret > 0) + ipaCount += ret; + } + + return ipaCount; +} + /** * \brief Create an IPA interface that matches a given pipeline handler * \param[in] pipe The pipeline handler that wants a matching IPA interface