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;