Patch Detail
Show a patch.
GET /api/patches/14402/?format=api
{ "id": 14402, "url": "https://patchwork.libcamera.org/api/patches/14402/?format=api", "web_url": "https://patchwork.libcamera.org/patch/14402/", "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": "<20211028111520.256612-8-jacopo@jmondi.org>", "date": "2021-10-28T11:15:17", "name": "[libcamera-devel,07/10] libcamera: pipeline_handler: Split request queueing", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "de58094ef335e71a0ea634598ed30c6b7cb91620", "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/14402/mbox/", "series": [ { "id": 2674, "url": "https://patchwork.libcamera.org/api/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/14402/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/14402/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 DFE89BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 28 Oct 2021 11:14:49 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 78FF260159;\n\tThu, 28 Oct 2021 13:14:49 +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 49F39600BA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 28 Oct 2021 13:14:41 +0200 (CEST)", "(Authenticated sender: jacopo@jmondi.org)\n\tby relay9-d.mail.gandi.net (Postfix) with ESMTPSA id D74E7FF804;\n\tThu, 28 Oct 2021 11:14:40 +0000 (UTC)" ], "From": "Jacopo Mondi <jacopo@jmondi.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Thu, 28 Oct 2021 13:15:17 +0200", "Message-Id": "<20211028111520.256612-8-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 07/10] libcamera: pipeline_handler: Split\n\trequest queueing", "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": "In order to prepare to handle synchronization fences at Request\nqueueing time, split the PipelineHandler::queueRequest() function in\ntwo, by creating a list of waiting requests and introducing a new\ndoQueueDevice() function that queues Requests to the device in the\norder the pipeline has received them.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n include/libcamera/internal/pipeline_handler.h | 7 ++++\n src/libcamera/pipeline_handler.cpp | 35 +++++++++++++++++--\n 2 files changed, 39 insertions(+), 3 deletions(-)", "diff": "diff --git a/include/libcamera/internal/pipeline_handler.h b/include/libcamera/internal/pipeline_handler.h\nindex 41cba44d990f..afb7990ea21b 100644\n--- a/include/libcamera/internal/pipeline_handler.h\n+++ b/include/libcamera/internal/pipeline_handler.h\n@@ -7,7 +7,9 @@\n #ifndef __LIBCAMERA_INTERNAL_PIPELINE_HANDLER_H__\n #define __LIBCAMERA_INTERNAL_PIPELINE_HANDLER_H__\n \n+#include <list>\n #include <memory>\n+#include <mutex>\n #include <set>\n #include <string>\n #include <sys/types.h>\n@@ -76,9 +78,14 @@ private:\n \tvoid mediaDeviceDisconnected(MediaDevice *media);\n \tvirtual void disconnect();\n \n+\tvoid doQueueRequest();\n+\n \tstd::vector<std::shared_ptr<MediaDevice>> mediaDevices_;\n \tstd::vector<std::weak_ptr<Camera>> cameras_;\n \n+\tstd::mutex waitingRequestsMutex_;\n+\tstd::list<Request *> waitingRequests_;\n+\n \tconst char *name_;\n \n \tfriend class PipelineHandlerFactory;\ndiff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp\nindex cada864687ff..38edd00cebad 100644\n--- a/src/libcamera/pipeline_handler.cpp\n+++ b/src/libcamera/pipeline_handler.cpp\n@@ -10,6 +10,7 @@\n #include <sys/sysmacros.h>\n \n #include <libcamera/base/log.h>\n+#include <libcamera/base/thread.h>\n #include <libcamera/base/utils.h>\n \n #include <libcamera/camera.h>\n@@ -312,17 +313,45 @@ void PipelineHandler::queueRequest(Request *request)\n {\n \tLIBCAMERA_TRACEPOINT(request_queue, request);\n \n+\t{\n+\t\tMutexLocker lock(waitingRequestsMutex_);\n+\t\twaitingRequests_.push_back(request);\n+\t}\n+\n+\tdoQueueRequest();\n+}\n+\n+/**\n+ * \\brief Queue a request to the device\n+ */\n+void PipelineHandler::doQueueRequest()\n+{\n+\tRequest *request = nullptr;\n+\t{\n+\t\tMutexLocker lock(waitingRequestsMutex_);\n+\n+\t\tif (!waitingRequests_.size())\n+\t\t\treturn;\n+\n+\t\trequest = waitingRequests_.front();\n+\t\twaitingRequests_.pop_front();\n+\t}\n+\n+\t/* Queue Request to the pipeline handler. */\n \tCamera *camera = request->_d()->camera();\n-\tCamera::Private *data = camera->_d();\n-\tdata->queuedRequests_.push_back(request);\n+\tCamera::Private *camData = camera->_d();\n \n-\trequest->sequence_ = data->requestSequence_++;\n+\trequest->sequence_ = camData->requestSequence_++;\n+\tcamData->queuedRequests_.push_back(request);\n \n \tint ret = queueRequestDevice(camera, request);\n \tif (ret) {\n \t\trequest->cancel();\n \t\tcompleteRequest(request);\n \t}\n+\n+\t/* Try to queue the next Request in the queue, if ready. */\n+\tdoQueueRequest();\n }\n \n /**\n", "prefixes": [ "libcamera-devel", "07/10" ] }