Patch Detail
Show a patch.
GET /api/1.1/patches/18128/?format=api
{ "id": 18128, "url": "https://patchwork.libcamera.org/api/1.1/patches/18128/?format=api", "web_url": "https://patchwork.libcamera.org/patch/18128/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/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": "<20230118085953.7027-3-naush@raspberrypi.com>", "date": "2023-01-18T08:59:43", "name": "[libcamera-devel,v5,02/12] libcamera: pipeline: Add a platform configuration file helper", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "f257b7f3172da623fbca4630aba41b0a7ab73887", "submitter": { "id": 34, "url": "https://patchwork.libcamera.org/api/1.1/people/34/?format=api", "name": "Naushir Patuck", "email": "naush@raspberrypi.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/18128/mbox/", "series": [ { "id": 3713, "url": "https://patchwork.libcamera.org/api/1.1/series/3713/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3713", "date": "2023-01-18T08:59:41", "name": "Raspberry Pi: Platform configuration and buffer allocation improvements", "version": 5, "mbox": "https://patchwork.libcamera.org/series/3713/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/18128/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/18128/checks/", "tags": {}, "headers": { "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>", "X-Original-To": "parsemail@patchwork.libcamera.org", "Delivered-To": "parsemail@patchwork.libcamera.org", "Received": [ "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id C128FC3240\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 18 Jan 2023 09:01:20 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6435F625F1;\n\tWed, 18 Jan 2023 10:01:20 +0100 (CET)", "from mail-wr1-x432.google.com (mail-wr1-x432.google.com\n\t[IPv6:2a00:1450:4864:20::432])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 91A7B625E8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 18 Jan 2023 10:01:17 +0100 (CET)", "by mail-wr1-x432.google.com with SMTP id h16so33173492wrz.12\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 18 Jan 2023 01:01:17 -0800 (PST)", "from localhost.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\ti6-20020adfe486000000b002423dc3b1a9sm30312464wrm.52.2023.01.18.01.01.16\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 18 Jan 2023 01:01:16 -0800 (PST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1674032480;\n\tbh=aPx61EyK5426KHTbbJ5ftutp6M7sRBs01qIVaRATqP8=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=vJb0mZ1SNcAYwmrHnfXvimDs+e/aiThWgWXtUgBplaiEAh5kLkFHG3JOh7aaLhjV0\n\tf7a6CHk5vf4Jgk25qciujvq+3xePfw6QWohcOtLr/dU0fAAaa3asvDr/ZBzVWDKgv6\n\t3WgEFx9L6FwZC1fpDy5BS/PtQCDmOSH/ffgcQU5YYYx9TUuC8q4Yazg72O1p+Gt9Wb\n\txm+1OTCrxk4xKNS6qpss9jyRiFSSEhaEACE2df7B/Y+fxSKwGQv7Jp61M8HbQCRqxH\n\tqhiRLOK1arEBy/FmIaavTppAjpG7dx6XSQl6p+Zke/indaruY3E32sqirk2yEE5ooi\n\tMRXf4/tB6ZzVQ==", "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=gYE4rAs6mWLRRzePAtTOx6PsgAWDmX1Qry7rwDpq1OM=;\n\tb=miHWQt7Zsk8yHx90JiUjQ8voLApwX+n/hWexy8RIanyNhyCswyq4qcKxSL6M5+70+x\n\tzJbMYCd8dm2UvvveNonnEqMVFN3qLQg9UfimuLs8GKe5SArXCO64bryv1gkqRuwH40wN\n\tLJ8eB/7HfSR8DB84SfA5oCrXU/Gqahe4wS50svQSMPDjhI89WrA+XjvA29or7yuFevJh\n\t1yLo7pWx8mSJNlEHoi1a+MKaNgtILpUUYxCHi6rzcn5XaI9/6veG5mgsoLhQlQHjGpnq\n\t2v0bxD+tP0sSF1L1socmDnajN11LBp/Ng55EFmCiP2alSp12Zd+JoiN9oY3aV7JWBEkR\n\tp1Pg==" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"miHWQt7Z\"; dkim-atps=neutral", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=gYE4rAs6mWLRRzePAtTOx6PsgAWDmX1Qry7rwDpq1OM=;\n\tb=d6EnffcGdsBGEYCTqIeOAe/ypsu1jnY/+y9OuYXVvzoM92DffwqwZaHRS9/yk3Hwgb\n\tKJdEAj8GAPtasZ+5Yk9Oif6Z6fSou4ixoP9wt6qpaat5H4ygfHQMydi+pbIp+bBNhw4S\n\tQj9gb8AFUNsoV7ssmTrXd69Chv6sU9Gxz4hNADgnWncrNwPpBZ+4rYbmjtf9InECb3yW\n\twYyG/mROrGhgt7GEqRfsodC1yYfw2QaD9d2c6xYyT4AmnFg3KrovzqdrF/NOaF1D9RQP\n\tGWXkHKbtVcMJo52Yp+/N1c4nqPQo9GkWQVLTmJetdxWpdNnyItEltj/dg4fFZ0Cvd6gV\n\tgmtA==", "X-Gm-Message-State": "AFqh2krUDwaCinMb8Enr0G/5ikp7h8KDsHlqhjubXlNxpE4TppXk8kFf\n\tDcuKOq5SWUED5DKHyqSDhuLhCSX/ITuLywWO29s=", "X-Google-Smtp-Source": "AMrXdXvzvgs25OtnEvrUI/qNxVBnmkLZL3+64D37NALOdgrdL6+1o5WVkr34JD4DjeqwvvdsrSMLEA==", "X-Received": "by 2002:a5d:59c7:0:b0:293:1868:3a14 with SMTP id\n\tv7-20020a5d59c7000000b0029318683a14mr1943695wry.0.1674032476825; \n\tWed, 18 Jan 2023 01:01:16 -0800 (PST)", "To": "libcamera-devel@lists.libcamera.org", "Date": "Wed, 18 Jan 2023 08:59:43 +0000", "Message-Id": "<20230118085953.7027-3-naush@raspberrypi.com>", "X-Mailer": "git-send-email 2.25.1", "In-Reply-To": "<20230118085953.7027-1-naush@raspberrypi.com>", "References": "<20230118085953.7027-1-naush@raspberrypi.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v5 02/12] libcamera: pipeline: Add a\n\tplatform configuration file helper", "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>", "From": "Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>", "Reply-To": "Naushir Patuck <naush@raspberrypi.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Add a new helper function PipelineHandler::configurationFile() that returns\nthe full path of a named configuration file. This configuration file may be read\nby pipeline handlers for platform specific configuration parameters on\ninitialisation.\n\nThe mechanism for searching for the configuration file is similar to the IPA\nconfiguration file:\n\n- In the source tree if libcamera is not installed\n- Otherwise in standard system locations (etc and share directories).\n\nWhen stored in the source tree, configuration files shall be located in a 'data'\nsubdirectory of their respective pipeline handler directory.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\n---\n include/libcamera/internal/pipeline_handler.h | 3 +\n src/libcamera/pipeline_handler.cpp | 60 +++++++++++++++++++\n 2 files changed, 63 insertions(+)", "diff": "diff --git a/include/libcamera/internal/pipeline_handler.h b/include/libcamera/internal/pipeline_handler.h\nindex ec4f662d7399..4c4dfe62a680 100644\n--- a/include/libcamera/internal/pipeline_handler.h\n+++ b/include/libcamera/internal/pipeline_handler.h\n@@ -65,6 +65,9 @@ public:\n \tbool completeBuffer(Request *request, FrameBuffer *buffer);\n \tvoid completeRequest(Request *request);\n \n+\tstd::string configurationFile(const std::string &subdir,\n+\t\t\t\t const std::string &name) const;\n+\n \tconst char *name() const { return name_; }\n \n protected:\ndiff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp\nindex cfade4908118..a515ad5ecffb 100644\n--- a/src/libcamera/pipeline_handler.cpp\n+++ b/src/libcamera/pipeline_handler.cpp\n@@ -8,6 +8,7 @@\n #include \"libcamera/internal/pipeline_handler.h\"\n \n #include <chrono>\n+#include <sys/stat.h>\n #include <sys/sysmacros.h>\n \n #include <libcamera/base/log.h>\n@@ -534,6 +535,65 @@ void PipelineHandler::completeRequest(Request *request)\n \t}\n }\n \n+/**\n+ * \\brief Retrieve the absolute path to a platform configuration file\n+ * \\param[in] subdir The pipeline handler specific subdirectory name\n+ * \\param[in] name The configuration file name\n+ *\n+ * This function locates a named platform configuration file and returns\n+ * its absolute path to the pipeline handler. It searches the following\n+ * directories, in order:\n+ *\n+ * - If libcamera is not installed, the src/libcamera/pipeline/<subdir>/data/\n+ * directory within the source tree ; otherwise\n+ * - The system data (share/libcamera/pipeline/<subdir>) directory.\n+ *\n+ * The system directories are not searched if libcamera is not installed.\n+ *\n+ * \\return The full path to the pipeline handler configuration file, or an empty\n+ * string if no configuration file can be found\n+ */\n+std::string PipelineHandler::configurationFile(const std::string &subdir,\n+\t\t\t\t\t const std::string &name) const\n+{\n+\tstd::string confPath;\n+\tstruct stat statbuf;\n+\tint ret;\n+\n+\tstd::string root = utils::libcameraSourcePath();\n+\tif (!root.empty()) {\n+\t\t/*\n+\t\t * When libcamera is used before it is installed, load\n+\t\t * configuration files from the source directory. The\n+\t\t * configuration files are then located in the 'data'\n+\t\t * subdirectory of the corresponding pipeline handler.\n+\t\t */\n+\t\tstd::string confDir = root + \"src/libcamera/pipeline/\";\n+\t\tconfPath = confDir + subdir + \"/data/\" + name;\n+\n+\t\tLOG(Pipeline, Info)\n+\t\t\t<< \"libcamera is not installed. Loading platform configuration file from '\"\n+\t\t\t<< confPath << \"'\";\n+\n+\t\tret = stat(confPath.c_str(), &statbuf);\n+\t\tif (ret == 0 && (statbuf.st_mode & S_IFMT) == S_IFREG)\n+\t\t\treturn confPath;\n+\t} else {\n+\t\t/* Else look in the system locations. */\n+\t\tconfPath = std::string(LIBCAMERA_DATA_DIR)\n+\t\t\t\t+ \"/pipeline/\" + subdir + '/' + name;\n+\t\tret = stat(confPath.c_str(), &statbuf);\n+\t\tif (ret == 0 && (statbuf.st_mode & S_IFMT) == S_IFREG)\n+\t\t\treturn confPath;\n+\t}\n+\n+\tLOG(Pipeline, Error)\n+\t\t<< \"Configuration file '\" << confPath\n+\t\t<< \"' not found for pipeline handler '\" << PipelineHandler::name() << \"'\";\n+\n+\treturn std::string();\n+}\n+\n /**\n * \\brief Register a camera to the camera manager and pipeline handler\n * \\param[in] camera The camera to be added\n", "prefixes": [ "libcamera-devel", "v5", "02/12" ] }