From patchwork Wed Mar 18 15:24:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaaira Gupta X-Patchwork-Id: 3171 Return-Path: Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 44CBE60418 for ; Wed, 18 Mar 2020 16:25:29 +0100 (CET) Received: by mail-pg1-x542.google.com with SMTP id b22so7870300pgb.6 for ; Wed, 18 Mar 2020 08:25:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=es-iitr-ac-in.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xMlGiZUnX5l4eQkEGl7+Y2M2/kQ9YAni9osfJaTdfr0=; b=lQJQOsFBanfboWabMbg9NvhkhcRZdB48WUs3l+q0MY91ScCW1lufcRtfVrWH95OPsP bkBOMP64sURNaV3iy1qDvWyxbjam/gQ8y3dmtt4h9VwD2yTyEmwlMt5lgWvLXgTHpXB/ um/BsD0EfuHx78Del7FniCMvcTY7NLUL6bQ4LKNTwQk5LEqN+/mumk+elnyZXtw/7AlF XUwbr2bVGcpg8EiWcFXD2lTKxKOQM9HAHda+LsOZ4FZz+NbQQn0pBLo/LGS3t64K4dI7 xuyjYpF3VHqwvRZZDd2HM1XkH2gJAIpeXl7Sptate1dSiJeocXJ9vpISVXh5U58U7JN+ WM+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xMlGiZUnX5l4eQkEGl7+Y2M2/kQ9YAni9osfJaTdfr0=; b=YEuc3GpyJlz3Yo3Ok5Z1UCSi1s0Fr5fwpcrJ7XgWHSlVV6sMCdFPhCKS28tKi1pz/z nCfN0XnWLu9fmOtNYc9UO87TMDKIzU4mGzLpBeu2kSb4LK331brdvFfRlZPPZtn3Sx+F SxgVLr52Ef7qlVVj07fmvIVG3eQvLQfERmhX05d9Btih5Gd3O/TjDb2+P3rcic5oaccX /pRDrPxmqcUxgBxePECFJw+EnqcZYYllWUZ7bwvT+kJYiRS/fufZfOaG6MaUpfPD1+JE tV4ISd1nrbhgkx2O7XTuZAmhi1Wav3au6YJ2mUipR1CtQOTeGB7rc1EkqFVWtrkrm+Qg NWYg== X-Gm-Message-State: ANhLgQ3XT10WIMqvKR/BymT2BbAnLFQFoa3nRIykztxerDbRQdWst4Qj KvDMyae9kKJR+t4IIVctadtXHA== X-Google-Smtp-Source: ADFU+vvq2YaXJaYHA2mDc4mMbm/r3J7i2X3YSoybeDFEdk3nIrUSx77eI8/DOtDAwX3nNOZLB/reww== X-Received: by 2002:a63:be49:: with SMTP id g9mr5213402pgo.30.1584545127884; Wed, 18 Mar 2020 08:25:27 -0700 (PDT) Received: from kaaira-HP-Pavilion-Notebook ([103.113.213.153]) by smtp.gmail.com with ESMTPSA id i21sm6307560pgn.5.2020.03.18.08.25.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Mar 2020 08:25:27 -0700 (PDT) From: Kaaira Gupta To: Vaishali Thakkar , Helen Koike , kieran.bingham@ideasonboard.com, libcamera-devel@lists.libcamera.org Cc: Kaaira Gupta Date: Wed, 18 Mar 2020 20:54:23 +0530 Message-Id: <20200318152427.13126-2-kgupta@es.iitr.ac.in> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200318152427.13126-1-kgupta@es.iitr.ac.in> References: <20200318152427.13126-1-kgupta@es.iitr.ac.in> Subject: [libcamera-devel] [PATCH LIBCAMERA v4 1/5] libcamera: ipa_proxy: use utils::split() 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: Wed, 18 Mar 2020 15:25:29 -0000 Replace the manual string splitting with utils::split() Signed-off-by: Kaaira Gupta Reviewed-by: Kieran Bingham --- src/libcamera/ipa_proxy.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/libcamera/ipa_proxy.cpp b/src/libcamera/ipa_proxy.cpp index 5a3d2f1..c7347c8 100644 --- a/src/libcamera/ipa_proxy.cpp +++ b/src/libcamera/ipa_proxy.cpp @@ -83,21 +83,16 @@ std::string IPAProxy::resolvePath(const std::string &file) const /* No exec target in install directory; check env variable. */ const char *execPaths = utils::secure_getenv("LIBCAMERA_IPA_PROXY_PATH"); - while (execPaths) { - const char *delim = strchrnul(execPaths, ':'); - size_t count = delim - execPaths; + if (execPaths) { + for (const auto &dir : utils::split(execPaths, ":")) { + if (dir.empty()) + continue; - if (count) { - std::string proxyPath(execPaths, count); + std::string proxyPath = dir; proxyPath += proxyFile; if (!access(proxyPath.c_str(), X_OK)) return proxyPath; } - - if (*delim == '\0') - break; - - execPaths += count + 1; } return std::string(); From patchwork Wed Mar 18 15:24:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaaira Gupta X-Patchwork-Id: 3172 Return-Path: Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3ABEB60418 for ; Wed, 18 Mar 2020 16:25:48 +0100 (CET) Received: by mail-pg1-x544.google.com with SMTP id z72so4020116pgz.3 for ; Wed, 18 Mar 2020 08:25:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=es-iitr-ac-in.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=itDBIeaaPZusj+vur2FE0rTJTemOWFKe6rlSI4nlGL0=; b=O05Ydm1e0XEf2pbfCdqztn7i4FotYmNsLIgf9g2EBP/6Nk95sCSqFQvt9YR8igIuv3 fZ31aJMbIM2n9ClPYCXYO9cuxE9cG2Ss6/sDufoxJnifGm6IITJmsNpwQN4oVqJwTA/y xar+NLagcnXf/jcWPNthOgBCo8fhzGLZ97tAoSeZxqSCdZOXklSie58/l0tJsNRB9KqF WEwcbksNKxWYiJT2T/mHAqBjFnskjr5UMEe9e/YWtWgW1mqeoDXumGeFhrafI8v7f44h WAQ/i96s1uVfjodDNhOGdVZDq1s9pJQmW5t0fOz30SZxZIst0eCiZkOAusbCdi/7HCCJ oTEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=itDBIeaaPZusj+vur2FE0rTJTemOWFKe6rlSI4nlGL0=; b=lGspsLKaZryxGZ8z/m3rlT9AVBYh4dlLN0PZfaJdTdcSTQU1Q1DipHR6lJwC4V+quz uQtxS5PzNbKh29/szQQu5UdE1sld8K4HBMiAuDaSadwvMNp/uPxCphpC3kywERDOnzBv lSep9dieMKjlpblBeTBviPWFIdRxWhT3F1+lyxxHumH+5QZ+oTwZzMt1MNUn0bDRZDpT +jhrvsEKE+GqCRez1NZUS60ajGvR/9PR5i5ZfmyFX/uohMOA5uVQ82lrEIGlfh1h1imL 7mBqAeSG8PGhF1DfeDM2CBf3ZTFDK2epBuzaPGKaSE05CC94tHZslakffZ0ZHl6/Geyx 1ysQ== X-Gm-Message-State: ANhLgQ2gCFBuB1jtrTXOcXHp6U3rKiNKk40I0MbkGHGT9BN8fQqwUyVE uZ2i6SHOiYqn3Z/Fws6zUMbGPg== X-Google-Smtp-Source: ADFU+vsGwG+UwQv2yCXW57GsMnv8ThwonScdXv9Rlre7hv5dnwo7Qinyq4235N6f8cvCGWNKVpL2hg== X-Received: by 2002:a63:d7:: with SMTP id 206mr5015179pga.366.1584545146792; Wed, 18 Mar 2020 08:25:46 -0700 (PDT) Received: from kaaira-HP-Pavilion-Notebook ([103.113.213.153]) by smtp.gmail.com with ESMTPSA id 127sm7036864pfb.130.2020.03.18.08.25.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Mar 2020 08:25:46 -0700 (PDT) From: Kaaira Gupta To: Vaishali Thakkar , Helen Koike , kieran.bingham@ideasonboard.com, libcamera-devel@lists.libcamera.org Cc: Kaaira Gupta Date: Wed, 18 Mar 2020 20:54:24 +0530 Message-Id: <20200318152427.13126-3-kgupta@es.iitr.ac.in> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200318152427.13126-1-kgupta@es.iitr.ac.in> References: <20200318152427.13126-1-kgupta@es.iitr.ac.in> Subject: [libcamera-devel] [PATCH LIBCAMERA v4 2/5] libcamera: ipa_proxy: rearrange proxies 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: Wed, 18 Mar 2020 15:25:48 -0000 User environment path in LIBCAMERA_IPA_PROXY_PATH should take precedence over system loading locations. Change precedence accordingly Signed-off-by: Kaaira Gupta Reviewed-by: Kieran Bingham --- src/libcamera/ipa_proxy.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/libcamera/ipa_proxy.cpp b/src/libcamera/ipa_proxy.cpp index c7347c8..b409e1d 100644 --- a/src/libcamera/ipa_proxy.cpp +++ b/src/libcamera/ipa_proxy.cpp @@ -75,13 +75,9 @@ IPAProxy::~IPAProxy() */ std::string IPAProxy::resolvePath(const std::string &file) const { - /* Try finding the exec target from the install directory first */ std::string proxyFile = "/" + file; - std::string proxyPath = std::string(IPA_PROXY_DIR) + proxyFile; - if (!access(proxyPath.c_str(), X_OK)) - return proxyPath; - /* No exec target in install directory; check env variable. */ + /* Check env variable first. */ const char *execPaths = utils::secure_getenv("LIBCAMERA_IPA_PROXY_PATH"); if (execPaths) { for (const auto &dir : utils::split(execPaths, ":")) { @@ -95,6 +91,11 @@ std::string IPAProxy::resolvePath(const std::string &file) const } } + /* Try finding the exec target from the install directory. */ + std::string proxyPath = std::string(IPA_PROXY_DIR) + proxyFile; + if (!access(proxyPath.c_str(), X_OK)) + return proxyPath; + return std::string(); } From patchwork Wed Mar 18 15:24:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaaira Gupta X-Patchwork-Id: 3173 Return-Path: Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 76C6260418 for ; Wed, 18 Mar 2020 16:25:54 +0100 (CET) Received: by mail-pj1-x1035.google.com with SMTP id np9so1478178pjb.4 for ; Wed, 18 Mar 2020 08:25:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=es-iitr-ac-in.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=u86HCsBqr7w/2SZeUAv8KIRZ2eJWE3vQOxp62VxrhBE=; b=I8MucxoiNDV5yeTbLDaENx+NKBQPh4+Lm7WvTnzMpvhAJdXFJv7U3RFjwyJDxNwcUV C2SJFQHjo4uaA6foJXGFnh4elM94ZeKt3xdt4nIhoFZ5RHRmlNSh3/prj+e2uuNZ5/eD yY4Gs+YsYUX6bLXkMol33kPepCp+ohO5ZRmHY/ptpObXO6FpWBOLw0gFEIRLH+8tbLxD BXM08CaTasJhPdY3YKv/MuOzRBsWZ26QY41+QoVYmoKYQnF6fQnvfmHsfl6i3MCVDKkD jnzvmksm/RqRDsjLENWhBQQEVK0NRoT8wbCax+iNanZXU0fzX8lwSuPQB8jVSfjpSDko 6S3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=u86HCsBqr7w/2SZeUAv8KIRZ2eJWE3vQOxp62VxrhBE=; b=hpv0Yy4hnQoIxHgtsm6nuL3Lt+ZDK8m68oOWadZizEEpRXKq7cc/SVTIX8UKFym12E xWnZSzEXNQIzMfSDDkCMYvGNaRKnVYhwKqL7WGyPk0b0wcmqHUYwo4fHcOMgcj0DVWRy lqoL69OaN8w+xCLT0BdC8rQ8yTYwQhT/Rm4nFEtdYwBWQ6ISbrb0y3nZhuaCilEZxfZh vRQ30CfR4Wxp3noSqVTnse1B1IqpyA4Sc97k+Rwj2tsb7hGsFytWDY7xB0FP4A1/KFH5 3km7WDMaHBf9/lEN47/mEay9h26p0LrelLn3QlyeJiShv5VE8I+a7lND9rQ6GSnft0CA rTcA== X-Gm-Message-State: ANhLgQ1VjeKUAbWMYC1xKnPndJNN6oSFKk1LdCSxvqq0kAH2B1dXGJ4O LyoyLcsazVFm0yw0Ivs4O7/2mQ== X-Google-Smtp-Source: ADFU+vt/ok0w1co6rWn3pnLTYuKuDq+HSg1QVAPZ70F6QXaKY26WeTfviOJBLGomv73xc6Gy5yoaOA== X-Received: by 2002:a17:90a:bd96:: with SMTP id z22mr5085942pjr.172.1584545152805; Wed, 18 Mar 2020 08:25:52 -0700 (PDT) Received: from kaaira-HP-Pavilion-Notebook ([103.113.213.153]) by smtp.gmail.com with ESMTPSA id h95sm2815201pjb.46.2020.03.18.08.25.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Mar 2020 08:25:52 -0700 (PDT) From: Kaaira Gupta To: Vaishali Thakkar , Helen Koike , kieran.bingham@ideasonboard.com, libcamera-devel@lists.libcamera.org Cc: Kaaira Gupta Date: Wed, 18 Mar 2020 20:54:25 +0530 Message-Id: <20200318152427.13126-4-kgupta@es.iitr.ac.in> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200318152427.13126-1-kgupta@es.iitr.ac.in> References: <20200318152427.13126-1-kgupta@es.iitr.ac.in> Subject: [libcamera-devel] [PATCH LIBCAMERA v4 3/5] libcamera: utils: Move libcamera build path lookup to utis 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: Wed, 18 Mar 2020 15:25:54 -0000 The IPA proxy manager will need to find the libcamera build path exactly the same way as the IPA module mnager. Move the isLibcameraInstalled() and libcameraPath() functions to utils to make them reusable. Signed-off-by: Kaaira Gupta Reviewed-by: Laurent Pinchart --- src/libcamera/include/utils.h | 4 +++ src/libcamera/ipa_manager.cpp | 36 ++----------------------- src/libcamera/utils.cpp | 49 +++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 34 deletions(-) diff --git a/src/libcamera/include/utils.h b/src/libcamera/include/utils.h index 9405977..bc96e79 100644 --- a/src/libcamera/include/utils.h +++ b/src/libcamera/include/utils.h @@ -143,6 +143,10 @@ private: details::StringSplitter split(const std::string &str, const std::string &delim); +bool isLibcameraInstalled(); + +std::string libcameraPath(); + } /* namespace utils */ } /* namespace libcamera */ diff --git a/src/libcamera/ipa_manager.cpp b/src/libcamera/ipa_manager.cpp index 238433d..0bd280c 100644 --- a/src/libcamera/ipa_manager.cpp +++ b/src/libcamera/ipa_manager.cpp @@ -9,9 +9,6 @@ #include #include -#include -#include -#include #include #include @@ -27,35 +24,6 @@ * \brief Image Processing Algorithm module manager */ -static bool isLibcameraInstalled() -{ - /* musl doesn't declare _DYNAMIC in link.h, declare it manually. */ - extern ElfW(Dyn) _DYNAMIC[]; - - /* - * DT_RUNPATH (DT_RPATH when the linker uses old dtags) is removed on - * install. - */ - for (const ElfW(Dyn) *dyn = _DYNAMIC; dyn->d_tag != DT_NULL; ++dyn) { - if (dyn->d_tag == DT_RUNPATH || dyn->d_tag == DT_RPATH) - return false; - } - - return true; -} - -static std::string libcameraPath() -{ - Dl_info info; - - /* Look up our own symbol. */ - int ret = dladdr(reinterpret_cast(libcameraPath), &info); - if (ret == 0) - return nullptr; - - return info.dli_fname; -} - namespace libcamera { LOG_DEFINE_CATEGORY(IPAManager) @@ -151,8 +119,8 @@ IPAManager::IPAManager() * path for the IPA from that point. We need to recurse one level of * sub-directories to match the build tree. */ - if (!isLibcameraInstalled()) { - std::string ipaBuildPath = utils::dirname(libcameraPath()) + "/../ipa"; + if (!utils::isLibcameraInstalled()) { + std::string ipaBuildPath = utils::dirname(utils::libcameraPath()) + "/../ipa"; constexpr int maxDepth = 1; LOG(IPAManager, Info) diff --git a/src/libcamera/utils.cpp b/src/libcamera/utils.cpp index f566e88..7e118fa 100644 --- a/src/libcamera/utils.cpp +++ b/src/libcamera/utils.cpp @@ -7,7 +7,10 @@ #include "utils.h" +#include +#include #include +#include #include #include #include @@ -18,6 +21,9 @@ * \brief Miscellaneous utility functions */ +/* musl doesn't declare _DYNAMIC in link.h, declare it manually. */ +extern ElfW(Dyn) _DYNAMIC[]; + namespace libcamera { namespace utils { @@ -310,6 +316,49 @@ details::StringSplitter split(const std::string &str, const std::string &delim) return details::StringSplitter(str, delim); } +/** + * \brief Check if libcamera is installed or not + * + * Utilise the build_rpath dynamic tag which is stripped out by meson at + * install time to determine at runtime if the library currently executing + * has been installed or not. + * + * \return True if libcamera is installed, false otherwise + */ +bool isLibcameraInstalled() +{ + /* + * DT_RUNPATH (DT_RPATH when the linker uses old dtags) is removed on + * install. + */ + for (const ElfW(Dyn) *dyn = _DYNAMIC; dyn->d_tag != DT_NULL; ++dyn) { + if (dyn->d_tag == DT_RUNPATH || dyn->d_tag == DT_RPATH) + return false; + } + + return true; +} + +/** + * \brief Identify the libcamera.so path + * + * This function locates the running libcamera.so and returns its full path, + * including the file name. + * + * \return A string stating the path + */ +std::string libcameraPath() +{ + Dl_info info; + + /* Look up our own symbol. */ + int ret = dladdr(reinterpret_cast(libcameraPath), &info); + if (ret == 0) + return nullptr; + + return info.dli_fname; +} + } /* namespace utils */ } /* namespace libcamera */ From patchwork Wed Mar 18 15:24:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaaira Gupta X-Patchwork-Id: 3174 Return-Path: Received: from mail-pj1-x1041.google.com (mail-pj1-x1041.google.com [IPv6:2607:f8b0:4864:20::1041]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D239A60418 for ; Wed, 18 Mar 2020 16:26:02 +0100 (CET) Received: by mail-pj1-x1041.google.com with SMTP id q16so1218734pje.1 for ; Wed, 18 Mar 2020 08:26:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=es-iitr-ac-in.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=TPOnO1Baqw2NxGiMYoMTR+sB7IXQHbkW77ALodIj+fg=; b=YA0O2C5v5+Zx0SFeBLgNGTbM3oyIZ8+Hqg6r9y0gfw9F7APw6nC4iZTEwBH5JZ7UlX EaSMBtweGEaHon5egBKEakTinF81DtdTNg+X2wp8Z21+vv7umuY4KXnEcd2DIFGUGvnl W1VHypiIwIpiTpoY3Yki0ebkjEOuohj+/TTsjpW1UXW/coFdTohrPkjJM0rV2mAKahzl Nw4XF4FseKFclUaOlQXKyhFayDY1rd6eZfSvTnrLBXg8fj76WwuU1CGulzCCoDyuYde8 FrcZoiy8NaRKuvuVXEpWtNvlgol2RnlEQsRQqNtbGDEG15GbkNgdF0+5UQtfVmvvv5O5 0P0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=TPOnO1Baqw2NxGiMYoMTR+sB7IXQHbkW77ALodIj+fg=; b=HuiziyxAZXMmOEMOtShRLJxkpGVonPUkLilq01hCJUXZG/fa83l0khlaZbnBr5Wo4k S8MX2GT30a2LPaRldrt5bga12kdwb4PI2mkGDxKE5LKJrVtuGO1SLHED5azFvWmyJLI4 msFmdiKhwSkRFcpqyHTsQHa/sWHI/mnRsWZjt2y6H0ZdHUKb0OzPkJdaGdeVu/wAxBrK XARyBVFK5ZYmy3BS9iRFDcdC45HKe7dhCECzE6feap4raQMEgeGCagv+b6brZgC5u3XP Q/CLN/+eFJBaR/GZWPNxOYRXd+0nU8irt08DhXFezEgaoZG0pIhi3vTf2k9WDIwaJHyZ 2Gpg== X-Gm-Message-State: ANhLgQ0P2nY8lH2ucADRly7TrpowO1xlGNidfUZ2DVcXvVCOPkisKLTH ut6DYHxXMekq8vZAYzAmbK4Z2g== X-Google-Smtp-Source: ADFU+vvtkFfPnNf8KkKiDl14CTpzHgJ9l+ZJifLQFgUFWp+c1PlwvgE/z+6baelTR/ZrvTwSqzhVmQ== X-Received: by 2002:a17:90a:22a9:: with SMTP id s38mr5033980pjc.3.1584545161394; Wed, 18 Mar 2020 08:26:01 -0700 (PDT) Received: from kaaira-HP-Pavilion-Notebook ([103.113.213.153]) by smtp.gmail.com with ESMTPSA id u5sm7214223pfb.153.2020.03.18.08.26.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Mar 2020 08:26:00 -0700 (PDT) From: Kaaira Gupta To: Vaishali Thakkar , Helen Koike , kieran.bingham@ideasonboard.com, libcamera-devel@lists.libcamera.org Cc: Kaaira Gupta Date: Wed, 18 Mar 2020 20:54:26 +0530 Message-Id: <20200318152427.13126-5-kgupta@es.iitr.ac.in> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200318152427.13126-1-kgupta@es.iitr.ac.in> References: <20200318152427.13126-1-kgupta@es.iitr.ac.in> Subject: [libcamera-devel] [PATCH LIBCAMERA v4 4/5] libcamera: ipa_proxy: search for proxy in build tree 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: Wed, 18 Mar 2020 15:26:03 -0000 When libcamera is built and tested before installing, it will be unable to locate the path to proxy workers, or previously installed files in the system path may be incorrect to load. Hence, when libcamera is not installed, but is running from a build tree, identify the location of that tree by using libcameraPath(), and from that point add relative path to the proxy workers directory. Signed-off-by: Kaaira Gupta Reviewed-by: Laurent Pinchart --- src/libcamera/ipa_proxy.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/libcamera/ipa_proxy.cpp b/src/libcamera/ipa_proxy.cpp index b409e1d..2f866cc 100644 --- a/src/libcamera/ipa_proxy.cpp +++ b/src/libcamera/ipa_proxy.cpp @@ -91,7 +91,28 @@ std::string IPAProxy::resolvePath(const std::string &file) const } } - /* Try finding the exec target from the install directory. */ + /* + * When libcamera is used before it is installed, load proxy workers + * from the same build directory as the libcamera directory itself. + * This requires identifying the path of the libcamera.so, and + * referencing a relative path for the proxy workers from that point. + */ + if (!utils::isLibcameraInstalled()) { + std::string ipaProxyDir = utils::dirname(utils::libcameraPath()) + + "/proxy/worker"; + + LOG(IPAProxy, Info) + << "libcamera is not installed. Loading proxy workers from'" + << ipaProxyDir << "'"; + + std::string proxyPath = ipaProxyDir + proxyFile; + if (!access(proxyPath.c_str(), X_OK)) + return proxyPath; + + return std::string(); + } + + /* Else try finding the exec target from the install directory. */ std::string proxyPath = std::string(IPA_PROXY_DIR) + proxyFile; if (!access(proxyPath.c_str(), X_OK)) return proxyPath; From patchwork Wed Mar 18 15:24:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaaira Gupta X-Patchwork-Id: 3175 Return-Path: Received: from mail-pj1-x1041.google.com (mail-pj1-x1041.google.com [IPv6:2607:f8b0:4864:20::1041]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9DB6860418 for ; Wed, 18 Mar 2020 16:26:09 +0100 (CET) Received: by mail-pj1-x1041.google.com with SMTP id ng8so1487492pjb.2 for ; Wed, 18 Mar 2020 08:26:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=es-iitr-ac-in.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=u1ntxBuNTbbqrVg4QEXssaxxiPmpjxgpa4csxN5ekeU=; b=hfniWsPrIWeFDmjMtGLVrzTdDvLLysFXBdcyQUNW7pkfVPjad9ct6PwXEuGXOvFqnQ KchGXhv6HU37QaIYmwRlQyTtqMBarfs0g6Eged1P8JX7DqhnPe5xamQt+oO9xonSRVWo 7JmI/HyO0VWuQt88x2hKf+2B1hmiHWRPinTunJOwU98639GD8WnWqT0+5VELpebGBxCi CiPups/cdTwYjjKyP4xNtkX7yrwwPVlsq8jSS5P6O5F2U6YyuxArajNg/0o+trCPcipD lcG9LRSiaqxOCiRpfYwfPQ0wXdDzCEM0fWp5x3JslW5kFPAxZ7Tgia0LajVeApP2oRm9 UBKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=u1ntxBuNTbbqrVg4QEXssaxxiPmpjxgpa4csxN5ekeU=; b=hF527jx2FW0itWjnBkP9V0bJtd/hQ+5U4eLSohhTEApacn920IAItALVefu4MnPpXq xIpLMCmn509YM4UgFeKGP1+yHoeNOo7/SnwfvDFarWqO03CMfDFknZp0ub+yd+oEGuiW BN/CtY2534rSoBY5LbCi+Tjl7Wk5QGV6JZa+qy0zGJ81epI1lloWGln4wShxJZ7CiBPu rdwnApoPSGOCTmtvwwAzrzibcalJRE32Q6rlsQZGB1fOiMFB/pPw/irb8HCPabQ3JR/a 4c6zqJUX04p1B3ZRR/oaNOMs3STREh5DGCFYgIKEVp74bYzbAjg5JCTFlMCO4h4qL7qd 6E2g== X-Gm-Message-State: ANhLgQ2Q7g2ouweOwTgVbuikpS8TUE4mod+N7fHsKTpusHBEgCNqUozK N0lVD2VHYahmHUW8Io1HJmzTNFEIQGs= X-Google-Smtp-Source: ADFU+vs3lE7d/gNByUbbpAPZUGuC2qcQIv5KLbtQRHXdRKPZ/s37lR3c9oSEIVPfldU3tM8cMNP+XA== X-Received: by 2002:a17:90a:26e1:: with SMTP id m88mr5210355pje.60.1584545168213; Wed, 18 Mar 2020 08:26:08 -0700 (PDT) Received: from kaaira-HP-Pavilion-Notebook ([103.113.213.153]) by smtp.gmail.com with ESMTPSA id j126sm4962221pfg.60.2020.03.18.08.26.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Mar 2020 08:26:07 -0700 (PDT) From: Kaaira Gupta To: Vaishali Thakkar , Helen Koike , kieran.bingham@ideasonboard.com, libcamera-devel@lists.libcamera.org Cc: Kaaira Gupta Date: Wed, 18 Mar 2020 20:54:27 +0530 Message-Id: <20200318152427.13126-6-kgupta@es.iitr.ac.in> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200318152427.13126-1-kgupta@es.iitr.ac.in> References: <20200318152427.13126-1-kgupta@es.iitr.ac.in> Subject: [libcamera-devel] [PATCH LIBCAMERA v4 5/5] tests: remove IPA_PROXY_PATH environment variable 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: Wed, 18 Mar 2020 15:26:09 -0000 The tests declare a hard-coded LIBCAMERA_IPA_PROXY_PATH to allow tests to run from tests-suite. Now that the proxy path is determined at runtime, we can remove the redundant setting of LIBCAMERA_IPA_PROXY_PATH for tests. Signed-off-by: Kaaira Gupta Reviewed-by: Kieran Bingham --- test/libtest/test.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/test/libtest/test.cpp b/test/libtest/test.cpp index 6cd3fbe..fd9f3d7 100644 --- a/test/libtest/test.cpp +++ b/test/libtest/test.cpp @@ -21,10 +21,6 @@ int Test::execute() { int ret; - ret = setenv("LIBCAMERA_IPA_PROXY_PATH", "src/libcamera/proxy/worker", 1); - if (ret) - return errno; - ret = init(); if (ret) return ret;