Patch Detail
Show a patch.
GET /api/patches/3194/?format=api
{ "id": 3194, "url": "https://patchwork.libcamera.org/api/patches/3194/?format=api", "web_url": "https://patchwork.libcamera.org/patch/3194/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20200319115908.GA30421@kaaira-HP-Pavilion-Notebook>", "date": "2020-03-19T11:59:08", "name": "[libcamera-devel,v2] libcamera: utils: merge isLibcamerainstalled with libcameraPath", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "4a533fcc9a33013f6e17ae5b889051b405cac807", "submitter": { "id": 39, "url": "https://patchwork.libcamera.org/api/people/39/?format=api", "name": "Kaaira Gupta", "email": "kgupta@es.iitr.ac.in" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/3194/mbox/", "series": [ { "id": 739, "url": "https://patchwork.libcamera.org/api/series/739/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=739", "date": "2020-03-19T11:59:08", "name": "[libcamera-devel,v2] libcamera: utils: merge isLibcamerainstalled with libcameraPath", "version": 2, "mbox": "https://patchwork.libcamera.org/series/739/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/3194/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/3194/checks/", "tags": {}, "headers": { "Return-Path": "<kgupta@es.iitr.ac.in>", "Received": [ "from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com\n\t[IPv6:2607:f8b0:4864:20::52c])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D9A9A60417\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 19 Mar 2020 12:59:17 +0100 (CET)", "by mail-pg1-x52c.google.com with SMTP id h8so1144657pgs.9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 19 Mar 2020 04:59:17 -0700 (PDT)", "from kaaira-HP-Pavilion-Notebook ([103.113.213.153])\n\tby smtp.gmail.com with ESMTPSA id\n\tf8sm2260943pfn.2.2020.03.19.04.59.13\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tThu, 19 Mar 2020 04:59:15 -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:subject:message-id:mime-version:content-disposition\n\t:user-agent; bh=Cj0nQQashGWYFQCNuAM9OJGr6SbMETPE0vHYU86PlYk=;\n\tb=jTR59rxk1XcTv0JWiOrnePq6hEFYzwQzIh0nmSMUEl1cKPE95fXOMkC7+Ym7sWqkyD\n\tkommy5sCok0OK3//QEjtnopwvFvm4L9qz1KxqcXPtp9ezGi6OoVxhDrsqHt4waVps0aX\n\tOmmbAVUlZxQXXo8JKnIejKnMk7i6YSuOLXN3gpd0xEClXWUruvrS3qwR4XsbvEYqmrzi\n\t82WADpJE2ZPudTjYRW9bJ7EsK0MlHDkMsM+R482VyfuSNldCGXIUY8mXYRhXDY2/nKAy\n\tXJyzsNOjV7TIwZhdd3jspACi4mRQYFhlAj1T+Jqe3nXuRg4ElB47hh+iS8jGhhYAZwih\n\tMvmQ==", "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:subject:message-id:mime-version\n\t:content-disposition:user-agent;\n\tbh=Cj0nQQashGWYFQCNuAM9OJGr6SbMETPE0vHYU86PlYk=;\n\tb=iK1/+2SEJyuKVIiYjvo2p3PTIyV1TG6BbZ5oNWkLoMzH9+MXH6JGRkYCjRaT6QWtNK\n\tIojMSW17N/q32Pn+X6MLDzEpzAIPayHIKWsFc3eq7SIrE1LuPdP/047PeTMheeYfX4WG\n\tfWBzY1t0rgt7W9wP6TH5acd6GGT0nPz5n/ZzfRJrwOU8uxjSzgYp/ne2PUoXU5/dPVkr\n\tMTaDGYPU3vzzW9J7sY3Q9fA9kBf6AF5TdOrV/+HEqBYC7fpDoTFTZ9M8e+BzlEpUkJpe\n\tr1ri4LJPRd3czb1xQ3n8BG3407c7F01ZbEhIq/f5TBkwDxXJtiOcJvFqlxmQAkkdlXkD\n\tOutw==", "X-Gm-Message-State": "ANhLgQ2Di+qbgGuWWwjSp8Hkt4sh4NwtMa6eGMVVyG4dVcWnpnv5Ju3N\n\t2gGsc0WqTAjcEAoDA3FpJAv+nQ==", "X-Google-Smtp-Source": "ADFU+vvP0/JYeNRWOKwnqodm1yAjRRpef263I1NfvZ5S/gpRPpX6xo92YMxHqoZfyO9JMtvOHvqi5g==", "X-Received": "by 2002:a62:64c9:: with SMTP id\n\ty192mr3694960pfb.26.1584619156159; \n\tThu, 19 Mar 2020 04:59:16 -0700 (PDT)", "Date": "Thu, 19 Mar 2020 17:29:08 +0530", "From": "Kaaira Gupta <kgupta@es.iitr.ac.in>", "To": "Helen Koike <helen.koike@collabora.com>,\n\tVaishali Thakkar <vthakkar@vaishalithakkar.in>,\n\tkieran.bingham@ideasonboard.com, libcamera-devel@lists.libcamera.org", "Message-ID": "<20200319115908.GA30421@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 v2] 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 11:59:18 -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 libcameraBuildPath() which\ncombines their functions and returns the root of the libcamera sources,\nthereby making call sites simpler.\n\nMake changes in the call sites accordingly.\n\nSigned-off-by: Kaaira Gupta <kgupta@es.iitr.ac.in>\n---\n\nChanges since v1:\n\t- rename function to libcameraBuildPath() instead, and return\n\t the root of libcamera source, and not the source directory\n\t root.\n\t- Return empty string instead of nullptr when ret==0\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 | 17 +++++++++--------\n 4 files changed, 16 insertions(+), 14 deletions(-)", "diff": "diff --git a/src/libcamera/include/utils.h b/src/libcamera/include/utils.h\nindex bc96e79..5dea8d2 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 libcameraBuildPath();\n \n } /* namespace utils */\n \ndiff --git a/src/libcamera/ipa_manager.cpp b/src/libcamera/ipa_manager.cpp\nindex 0bd280c..4e294c2 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 root = utils::libcameraBuildPath();\n+\tif (!root.empty()) {\n+\t\tstd::string ipaBuildPath = root + \"/src/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..5fd88a4 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 root = utils::libcameraBuildPath();\n+\tif (!root.empty()) {\n+\t\tstd::string ipaProxyDir = root + \"src/libcamera/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..eae682b 100644\n--- a/src/libcamera/utils.cpp\n+++ b/src/libcamera/utils.cpp\n@@ -347,16 +347,17 @@ bool isLibcameraInstalled()\n *\n * \\return A string stating the path\n */\n-std::string libcameraPath()\n+std::string libcameraBuildPath()\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+\tif (!isLibcameraInstalled()) {\n+\t\tDl_info info;\n+\t\t/* Look up our own symbol. */\n+\t\tint ret = dladdr(reinterpret_cast<void *>(libcameraBuildPath), &info);\n+\t\tif (ret)\n+\t\t\treturn dirname(info.dli_fname) + \"/../..\";\n+\t}\n \n-\treturn info.dli_fname;\n+\treturn std::string();\n }\n \n } /* namespace utils */\n", "prefixes": [ "libcamera-devel", "v2" ] }