Patch Detail
Show a patch.
GET /api/1.1/patches/14400/?format=api
{ "id": 14400, "url": "https://patchwork.libcamera.org/api/1.1/patches/14400/?format=api", "web_url": "https://patchwork.libcamera.org/patch/14400/", "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": "<20211028111520.256612-6-jacopo@jmondi.org>", "date": "2021-10-28T11:15:15", "name": "[libcamera-devel,05/10] libcamera: request: Add support for fences", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "514617a9384cc06245c730c1ad67b902d26a6117", "submitter": { "id": 3, "url": "https://patchwork.libcamera.org/api/1.1/people/3/?format=api", "name": "Jacopo Mondi", "email": "jacopo@jmondi.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/14400/mbox/", "series": [ { "id": 2674, "url": "https://patchwork.libcamera.org/api/1.1/series/2674/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2674", "date": "2021-10-28T11:15:10", "name": "libcamera: Introduce Fence support", "version": 1, "mbox": "https://patchwork.libcamera.org/series/2674/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/14400/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/14400/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 8A845BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 28 Oct 2021 11:14:48 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C576A600F9;\n\tThu, 28 Oct 2021 13:14:47 +0200 (CEST)", "from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net\n\t[217.70.183.199])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 06308600C0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 28 Oct 2021 13:14:40 +0200 (CEST)", "(Authenticated sender: jacopo@jmondi.org)\n\tby relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 8FA7DFF802;\n\tThu, 28 Oct 2021 11:14:39 +0000 (UTC)" ], "From": "Jacopo Mondi <jacopo@jmondi.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Thu, 28 Oct 2021 13:15:15 +0200", "Message-Id": "<20211028111520.256612-6-jacopo@jmondi.org>", "X-Mailer": "git-send-email 2.33.1", "In-Reply-To": "<20211028111520.256612-1-jacopo@jmondi.org>", "References": "<20211028111520.256612-1-jacopo@jmondi.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 05/10] libcamera: request: Add support for\n\tfences", "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>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Prepare the Request::Private class to handle fences by providing a\nstorage vector and interface functions to handle the number of pending\nand expired fences.\n\nThe intended user of the interface is the PipelineHandler class\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n include/libcamera/internal/request.h | 21 +++++++\n src/libcamera/request.cpp | 89 +++++++++++++++++++++++++++-\n 2 files changed, 109 insertions(+), 1 deletion(-)", "diff": "diff --git a/include/libcamera/internal/request.h b/include/libcamera/internal/request.h\nindex df0cc014067e..2be4874756de 100644\n--- a/include/libcamera/internal/request.h\n+++ b/include/libcamera/internal/request.h\n@@ -7,8 +7,12 @@\n #ifndef __LIBCAMERA_INTERNAL_REQUEST_H__\n #define __LIBCAMERA_INTERNAL_REQUEST_H__\n \n+#include <vector>\n+\n #include <libcamera/request.h>\n \n+#include <libcamera/internal/fence.h>\n+\n namespace libcamera {\n \n class Camera;\n@@ -24,9 +28,26 @@ public:\n \n \tCamera *camera() const { return camera_; }\n \n+\tunsigned int pendingFences() const { return pendingFences_; }\n+\tunsigned int expiredFences() const { return expiredFences_; }\n+\n+\tvoid reuse();\n+\n+\tstd::vector<Fence> &fences() { return fences_; }\n+\tvoid addFence(Fence &&fence);\n+\tvoid clearFences();\n+\n+\tvoid fenceExpired();\n+\tvoid fenceCompleted();\n+\n private:\n \tCamera *camera_;\n \tbool cancelled_;\n+\n+\tunsigned int pendingFences_ = 0;\n+\tunsigned int expiredFences_ = 0;\n+\n+\tstd::vector<Fence> fences_;\n };\n \n } /* namespace libcamera */\ndiff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp\nindex 33fee1ac05ba..e88eee1fac36 100644\n--- a/src/libcamera/request.cpp\n+++ b/src/libcamera/request.cpp\n@@ -63,6 +63,92 @@ Request::Private::~Private()\n * request hasn't been queued\n */\n \n+/**\n+ * \\fn Request::Private::pendingFences()\n+ * \\brief Retrieve the number of pending fences\n+ *\n+ * A Fence is pending if has not yet been signalled or it has not expired yet.\n+ *\n+ * \\return The number of pending fences\n+ */\n+\n+/**\n+ * \\fn Request::Private::expiredFences()\n+ * \\brief Retrieve the number of expired fences\n+ * \\return The number of expired fences\n+ */\n+\n+/**\n+ * \\brief Reset the request for reuse\n+ */\n+void Request::Private::reuse()\n+{\n+\tcancelled_ = false;\n+\n+\tfences_.clear();\n+\tpendingFences_ = 0;\n+\texpiredFences_ = 0;\n+}\n+\n+/**\n+ * \\fn Request::Private::fences()\n+ * \\brief Retrieve a reference to the vector of pending fences\n+ * \\return A reference to the vector of pending fences\n+ */\n+\n+/**\n+ * \\brief Move a Fence into the Request\n+ *\n+ * Move a Fence into the Request and increase the pending fences\n+ * counter. The Fence is now stored into the Request and the original\n+ * one passed in as parameter is reset.\n+ *\n+ * Once the Fence completes, either because it is signalled or because\n+ * it has expired, the caller shall notify the Request about this by\n+ * calling fenceCompleted() or fenceExpired();\n+ */\n+void Request::Private::addFence(Fence &&fence)\n+{\n+\tfences_.push_back(std::move(fence));\n+\tpendingFences_++;\n+}\n+\n+/**\n+ * \\brief Release all Fences stored in the request\n+ *\n+ * Clear the vector of fences in the Request by releasing all of them.\n+ * All Fences are closed and their file descriptors reset to 0.\n+ */\n+void Request::Private::clearFences()\n+{\n+\tASSERT(!pendingFences_);\n+\tfences_.clear();\n+}\n+\n+/**\n+ * \\brief Notify that a Fence has been signalled\n+ *\n+ * Notify to the Request that a Fence has completed. This function decrease the\n+ * number of pending Fences in the request.\n+ */\n+void Request::Private::fenceCompleted()\n+{\n+\tpendingFences_--;\n+}\n+\n+/**\n+ * \\brief Notify that a Fence has expired\n+ *\n+ * Notify to the Request that a Fence has expired. This function decrease the\n+ * number of pending Fences in the request and increase the number of expired\n+ * ones.\n+ */\n+void Request::Private::fenceExpired()\n+{\n+\texpiredFences_++;\n+\tpendingFences_--;\n+}\n+\n /**\n * \\enum Request::Status\n * Request completion status\n@@ -158,10 +244,11 @@ void Request::reuse(ReuseFlag flags)\n \n \tsequence_ = 0;\n \tstatus_ = RequestPending;\n-\t_d()->cancelled_ = false;\n \n \tcontrols_->clear();\n \tmetadata_->clear();\n+\n+\t_d()->reuse();\n }\n \n /**\n", "prefixes": [ "libcamera-devel", "05/10" ] }