From patchwork Fri Feb 21 16:31:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 2868 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5C3A96262D for ; Fri, 21 Feb 2020 17:31:35 +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 D755CB23; Fri, 21 Feb 2020 17:31:34 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1582302695; bh=XxkNMJZmSBRgdZ0qfVdOTG9gKZv3YStnYPFUWkZaM8g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A/EyeKwLSmF+l6OD4aQKcmLoKfPW6mJHiyH8LtnlIUnWwLpHVh90cojzapStPVRMI FXzI+YZiuK3CHaUVKQcJAKUZEa+B6D3+HKMRGD3bk9ZUfMTWItS1hiuDDeZNvFTkjo cZl9Ql0Bw/HPJs6gfzFQCC2fAHG/sUQ6nbhdx+us= From: Kieran Bingham To: libcamera devel Date: Fri, 21 Feb 2020 16:31:26 +0000 Message-Id: <20200221163130.4791-3-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200221163130.4791-1-kieran.bingham@ideasonboard.com> References: <20200221163130.4791-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 2/6] libcamera: ipa_manager: Re-arrange IPA precedence 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: Fri, 21 Feb 2020 16:31:35 -0000 Setting a user environment path in LIBCAMERA_IPA_MODULE_PATH should take precedence over the system loading locations. Adjust the IPA search orders accordingly. Signed-off-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- src/libcamera/ipa_manager.cpp | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/libcamera/ipa_manager.cpp b/src/libcamera/ipa_manager.cpp index 4ffbdd712ac2..7f0a5d58749b 100644 --- a/src/libcamera/ipa_manager.cpp +++ b/src/libcamera/ipa_manager.cpp @@ -98,31 +98,31 @@ IPAManager::IPAManager() unsigned int ipaCount = 0; int ret; - ret = addDir(IPA_MODULE_DIR); - if (ret > 0) - ipaCount += ret; - + /* User-specified paths take precedence. */ const char *modulePaths = utils::secure_getenv("LIBCAMERA_IPA_MODULE_PATH"); - if (!modulePaths) { + if (modulePaths) { + for (const auto &dir : utils::split(modulePaths, ":")) { + if (dir.empty()) + continue; + + int ret = addDir(dir.c_str()); + if (ret > 0) + ipaCount += ret; + } + if (!ipaCount) LOG(IPAManager, Warning) - << "No IPA found in '" IPA_MODULE_DIR "'"; - return; + << "No IPA found in '" << modulePaths << "'"; } - for (const auto &dir : utils::split(modulePaths, ":")) { - if (dir.empty()) - continue; - - int ret = addDir(dir.c_str()); - if (ret > 0) - ipaCount += ret; - } + /* Load IPAs from the installed system path. */ + ret = addDir(IPA_MODULE_DIR); + if (ret > 0) + ipaCount += ret; if (!ipaCount) LOG(IPAManager, Warning) - << "No IPA found in '" IPA_MODULE_DIR "' and '" - << modulePaths << "'"; + << "No IPA found in '" IPA_MODULE_DIR "'"; } IPAManager::~IPAManager()