Patch Detail
Show a patch.
GET /api/patches/15132/?format=api
{ "id": 15132, "url": "https://patchwork.libcamera.org/api/patches/15132/?format=api", "web_url": "https://patchwork.libcamera.org/patch/15132/", "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": "<20211210205239.354901-10-jacopo@jmondi.org>", "date": "2021-12-10T20:52:37", "name": "[libcamera-devel,v5,09/11] libcamera: pipeline_handler: Prepare Request", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "2b723685e46d446f1eba9bb6b3cc592021984094", "submitter": { "id": 3, "url": "https://patchwork.libcamera.org/api/people/3/?format=api", "name": "Jacopo Mondi", "email": "jacopo@jmondi.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/15132/mbox/", "series": [ { "id": 2837, "url": "https://patchwork.libcamera.org/api/series/2837/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2837", "date": "2021-12-10T20:52:28", "name": "libcamera: Add fence", "version": 5, "mbox": "https://patchwork.libcamera.org/series/2837/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/15132/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/15132/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 26685BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 10 Dec 2021 20:52:05 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BAFB2608EB;\n\tFri, 10 Dec 2021 21:52:04 +0100 (CET)", "from relay11.mail.gandi.net (relay11.mail.gandi.net\n\t[217.70.178.231])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3EEE7608E3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 10 Dec 2021 21:51:58 +0100 (CET)", "(Authenticated sender: jacopo@jmondi.org)\n\tby relay11.mail.gandi.net (Postfix) with ESMTPSA id 98391100006;\n\tFri, 10 Dec 2021 20:51:57 +0000 (UTC)" ], "From": "Jacopo Mondi <jacopo@jmondi.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Fri, 10 Dec 2021 21:52:37 +0100", "Message-Id": "<20211210205239.354901-10-jacopo@jmondi.org>", "X-Mailer": "git-send-email 2.33.1", "In-Reply-To": "<20211210205239.354901-1-jacopo@jmondi.org>", "References": "<20211210205239.354901-1-jacopo@jmondi.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v5 09/11] libcamera: pipeline_handler:\n\tPrepare Request", "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": "Before queueing a request to the device, any synchronization fence from\nthe Request framebuffers has to be waited on.\n\nConnect the Request::Private::prepared signal to the function that\nqueues requests to the hardware and call Request::Private::prepare().\n\nWhen the waiting request queue is inspected, verify if it has completed its\npreparation phase and queue it to the device.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/pipeline_handler.cpp | 37 +++++++++++++++++++++++-------\n 1 file changed, 29 insertions(+), 8 deletions(-)", "diff": "diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp\nindex 92b5e3ab07d8..0bc0e341b9e7 100644\n--- a/src/libcamera/pipeline_handler.cpp\n+++ b/src/libcamera/pipeline_handler.cpp\n@@ -7,6 +7,7 @@\n \n #include \"libcamera/internal/pipeline_handler.h\"\n \n+#include <chrono>\n #include <sys/sysmacros.h>\n \n #include <libcamera/base/log.h>\n@@ -18,6 +19,7 @@\n \n #include \"libcamera/internal/camera.h\"\n #include \"libcamera/internal/device_enumerator.h\"\n+#include \"libcamera/internal/framebuffer.h\"\n #include \"libcamera/internal/media_device.h\"\n #include \"libcamera/internal/request.h\"\n #include \"libcamera/internal/tracepoints.h\"\n@@ -36,6 +38,8 @@\n * the REGISTER_PIPELINE_HANDLER() macro.\n */\n \n+using namespace std::chrono_literals;\n+\n namespace libcamera {\n \n LOG_DEFINE_CATEGORY(Pipeline)\n@@ -323,10 +327,16 @@ bool PipelineHandler::hasPendingRequests(const Camera *camera) const\n * \\param[in] request The request to queue\n *\n * This function queues a capture request to the pipeline handler for\n- * processing. The request is first added to the internal list of queued\n- * requests, and then passed to the pipeline handler with a call to\n- * queueRequestDevice(). If the pipeline handler fails in queuing the request\n- * to the hardware the request is cancelled.\n+ * processing. The request is first added to the internal list of waiting\n+ * requests which have to be prepared to make sure they are ready for being\n+ * queued to the pipeline handler.\n+ *\n+ * The queue of waiting requests is iterated and all prepared requests are\n+ * passed to the pipeline handler in the same order they have been queued by\n+ * calling this function.\n+ *\n+ * If a Request fails during the preparation phase or if the pipeline handler\n+ * fails in queuing the request to the hardware the request is cancelled.\n *\n * Keeping track of queued requests ensures automatic completion of all requests\n * when the pipeline handler is stopped with stop(). Request completion shall be\n@@ -339,7 +349,11 @@ void PipelineHandler::queueRequest(Request *request)\n \tLIBCAMERA_TRACEPOINT(request_queue, request);\n \n \twaitingRequests_.push(request);\n-\tdoQueueRequests();\n+\n+\trequest->_d()->prepared.connect(this, [this]() {\n+\t\t\t\t\t\tdoQueueRequests();\n+\t\t\t\t\t});\n+\trequest->_d()->prepare(300ms);\n }\n \n /**\n@@ -355,6 +369,11 @@ void PipelineHandler::doQueueRequest(Request *request)\n \n \trequest->_d()->sequence_ = data->requestSequence_++;\n \n+\tif (request->_d()->cancelled_) {\n+\t\tcompleteRequest(request);\n+\t\treturn;\n+\t}\n+\n \tint ret = queueRequestDevice(camera, request);\n \tif (ret) {\n \t\trequest->_d()->cancel();\n@@ -363,18 +382,20 @@ void PipelineHandler::doQueueRequest(Request *request)\n }\n \n /**\n- * \\brief Queue requests to the device\n+ * \\brief Queue prepared requests to the device\n *\n * Iterate the list of waiting requests and queue them to the device one\n- * by one.\n+ * by one if they have been prepared.\n */\n void PipelineHandler::doQueueRequests()\n {\n \twhile (!waitingRequests_.empty()) {\n \t\tRequest *request = waitingRequests_.front();\n-\t\twaitingRequests_.pop();\n+\t\tif (!request->_d()->prepared_)\n+\t\t\tbreak;\n \n \t\tdoQueueRequest(request);\n+\t\twaitingRequests_.pop();\n \t}\n }\n \n", "prefixes": [ "libcamera-devel", "v5", "09/11" ] }