{"id":3193,"url":"https://patchwork.libcamera.org/api/1.1/patches/3193/?format=json","web_url":"https://patchwork.libcamera.org/patch/3193/","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":"<20200319095406.GA26435@kaaira-HP-Pavilion-Notebook>","date":"2020-03-19T09:54:06","name":"[libcamera-devel] libcamera: utils: merge isLibcamerainstalled with libcameraPath","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"55fd93bd98df40c9f616c597e052c23cb0c1d06a","submitter":{"id":39,"url":"https://patchwork.libcamera.org/api/1.1/people/39/?format=json","name":"Kaaira Gupta","email":"kgupta@es.iitr.ac.in"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/3193/mbox/","series":[{"id":738,"url":"https://patchwork.libcamera.org/api/1.1/series/738/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=738","date":"2020-03-19T09:54:06","name":"[libcamera-devel] libcamera: utils: merge isLibcamerainstalled with libcameraPath","version":1,"mbox":"https://patchwork.libcamera.org/series/738/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/3193/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/3193/checks/","tags":{},"headers":{"Return-Path":"<kgupta@es.iitr.ac.in>","Received":["from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com\n\t[IPv6:2607:f8b0:4864:20::62e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DBFF060416\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 19 Mar 2020 10:54:16 +0100 (CET)","by mail-pl1-x62e.google.com with SMTP id h11so836369plk.7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 19 Mar 2020 02:54:16 -0700 (PDT)","from kaaira-HP-Pavilion-Notebook ([103.113.213.153])\n\tby smtp.gmail.com with ESMTPSA id\n\td1sm1743358pfc.3.2020.03.19.02.54.12\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tThu, 19 Mar 2020 02:54:14 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=es-iitr-ac-in.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:mime-version:content-disposition\n\t:user-agent; bh=x794za9KWEk0GVwZoiDw1d9qmElx4bSfEb1V9GdS25k=;\n\tb=o7RElqLEz0an2WnP6Tex/aNAn0m91QcYc14ybuhIhxeRn09aQMaz/T7w0sn6DSbcpH\n\tJz/6JS3WVzpoFqZtqN69FSsJWZBqyVWR4w1Pjbr5Y3UAdoinFhz0WIzQj7D8u8n6gSIC\n\t3mW3ZJDiMOOHD/qFJlwK7+BsERfzPjs6YGvfodMBO9wr7RWaK0vZw9iYI837aEfyrMxW\n\tph40toIaplKl8duMmeXX+OnmbkqIB2Jg8+KVIUt+mi8i5K9FfREii9h9nXg1MaDPcQdw\n\tuDm65SfeTSFKGGN/6SSSp3jhHq8HMxQBCnTxCIqSZYWQrt5+jl+E23zfwygSxFmfhnCm\n\tt01Q==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version\n\t:content-disposition:user-agent;\n\tbh=x794za9KWEk0GVwZoiDw1d9qmElx4bSfEb1V9GdS25k=;\n\tb=pHmZJZpxNCYmHxYbuQgUYZHaingHs4lcCfGyy5aYygKM6hb4FaekFP2Yat0pF/p6ke\n\tr1YndyON5zZnIQl9/6Pm+h4+lXFwEIp4c8mWmYMSUbWqBCgDtrgTQ7StWYE/eK9NePZz\n\tCsorTluHfBq+X7g/2/GonoisuQyUY8Gggs4b7sd4cqsRXbT9sWNtfTdJMhXi+cOTYeSl\n\tTmWB/Rk/ak/ARgoUygHZKSsCA0dGZWeTFBK6fZL/P47N7Uj9L02sm2tvfP5FHni4MK/e\n\tR1VBcwzr6AKXcXGN+C6Rb+VCJHYF3IgPq8DhtfGA9RH+ioc3Kni93TpHhsyi7GEsvGiG\n\tEA2w==","X-Gm-Message-State":"ANhLgQ1rK2+ulv8HXD65jvFiXq4UY8tpAiT7VBnn0wAOJftW0nJeAUhf\n\t9yAf1Vw9udPG821pEC3B2dAPkQ==","X-Google-Smtp-Source":"ADFU+vtfcKzvmoaYobbyith57tqeBpNFlGP9EIZVaores3o10gAZ37KhTxgcCxKcC2uD+gyXAtlzVA==","X-Received":"by 2002:a17:90b:4d07:: with SMTP id\n\tmw7mr3019693pjb.103.1584611654758; \n\tThu, 19 Mar 2020 02:54:14 -0700 (PDT)","Date":"Thu, 19 Mar 2020 15:24:06 +0530","From":"Kaaira Gupta <kgupta@es.iitr.ac.in>","To":"kieran.bingham@ideasonboard.com, libcamera-devel@lists.libcamera.org","Cc":"Helen Koike <helen.koike@collabora.com>,\n\tVaishali Thakkar <vthakkar@vaishalithakkar.in>","Message-ID":"<20200319095406.GA26435@kaaira-HP-Pavilion-Notebook>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","User-Agent":"Mutt/1.9.4 (2018-02-28)","Subject":"[libcamera-devel] [PATCH LIBCAMERA] libcamera: utils: merge\n\tisLibcamerainstalled with libcameraPath","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","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, 19 Mar 2020 09:54:20 -0000"},"content":"The two callers of functions libcameraPath() and isLibcameraInstalled()\nend up using the same process and finally use the path with\nlibcamera.so. Hence write a function libcameraSourcePath() which\ncombines their functions, thereby making call sites simpler.\n\nSigned-off-by: Kaaira Gupta <kgupta@es.iitr.ac.in>\n---\n src/libcamera/include/utils.h |  2 +-\n src/libcamera/ipa_manager.cpp |  5 +++--\n src/libcamera/ipa_proxy.cpp   |  6 +++---\n src/libcamera/utils.cpp       | 20 +++++++++++---------\n 4 files changed, 18 insertions(+), 15 deletions(-)","diff":"diff --git a/src/libcamera/include/utils.h b/src/libcamera/include/utils.h\nindex bc96e79..2cff15e 100644\n--- a/src/libcamera/include/utils.h\n+++ b/src/libcamera/include/utils.h\n@@ -145,7 +145,7 @@ details::StringSplitter split(const std::string &str, const std::string &delim);\n \n bool isLibcameraInstalled();\n \n-std::string libcameraPath();\n+std::string libcameraSourcePath();\n \n } /* namespace utils */\n \ndiff --git a/src/libcamera/ipa_manager.cpp b/src/libcamera/ipa_manager.cpp\nindex 0bd280c..cf9b6e7 100644\n--- a/src/libcamera/ipa_manager.cpp\n+++ b/src/libcamera/ipa_manager.cpp\n@@ -119,8 +119,9 @@ IPAManager::IPAManager()\n \t * path for the IPA from that point. We need to recurse one level of\n \t * sub-directories to match the build tree.\n \t */\n-\tif (!utils::isLibcameraInstalled()) {\n-\t\tstd::string ipaBuildPath = utils::dirname(utils::libcameraPath()) + \"/../ipa\";\n+\tstd::string libPath = utils::libcameraSourcePath();\n+\tif (!libPath.empty()) {\n+\t\tstd::string ipaBuildPath = libPath + \"/../ipa\";\n \t\tconstexpr int maxDepth = 1;\n \n \t\tLOG(IPAManager, Info)\ndiff --git a/src/libcamera/ipa_proxy.cpp b/src/libcamera/ipa_proxy.cpp\nindex 2f866cc..e9b7568 100644\n--- a/src/libcamera/ipa_proxy.cpp\n+++ b/src/libcamera/ipa_proxy.cpp\n@@ -97,9 +97,9 @@ std::string IPAProxy::resolvePath(const std::string &file) const\n \t * This requires identifying the path of the libcamera.so, and\n \t * referencing a relative path for the proxy workers from that point.\n \t */\n-\tif (!utils::isLibcameraInstalled()) {\n-\t\tstd::string ipaProxyDir = utils::dirname(utils::libcameraPath())\n-\t\t\t\t\t  + \"/proxy/worker\";\n+\tstd::string libPath = utils::libcameraSourcePath();\n+\tif (!libPath.empty()) {\n+\t\tstd::string ipaProxyDir = libPath + \"/proxy/worker\";\n \n \t\tLOG(IPAProxy, Info)\n \t\t\t<< \"libcamera is not installed. Loading proxy workers from'\"\ndiff --git a/src/libcamera/utils.cpp b/src/libcamera/utils.cpp\nindex 7e118fa..8212d3e 100644\n--- a/src/libcamera/utils.cpp\n+++ b/src/libcamera/utils.cpp\n@@ -347,16 +347,18 @@ bool isLibcameraInstalled()\n  *\n  * \\return A string stating the path\n  */\n-std::string libcameraPath()\n+std::string libcameraSourcePath()\n {\n-\tDl_info info;\n-\n-\t/* Look up our own symbol. */\n-\tint ret = dladdr(reinterpret_cast<void *>(libcameraPath), &info);\n-\tif (ret == 0)\n-\t\treturn nullptr;\n-\n-\treturn info.dli_fname;\n+\tif (!utils::isLibcameraInstalled()) {\n+\t\tDl_info info;\n+\t\t/* Look up our own symbol. */\n+\t\tint ret = dladdr(reinterpret_cast<void *>(libcameraSourcePath), &info);\n+\t\tif (ret == 0)\n+\t\t\treturn nullptr;\n+\n+\t\treturn utils::dirname(info.dli_fname);\n+\t} else\n+\t\treturn std::string();\n }\n \n } /* namespace utils */\n","prefixes":["libcamera-devel"]}