Show a patch.

GET /api/patches/14677/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 14677,
    "url": "https://patchwork.libcamera.org/api/patches/14677/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/14677/",
    "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": "<20211120111313.106621-10-jacopo@jmondi.org>",
    "date": "2021-11-20T11:13:10",
    "name": "[libcamera-devel,v2,09/12] libcamera: pipeline_handler: Prepare Request",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "40c48928d215a649922bb51c28fc6cfa1dd6eaa9",
    "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/14677/mbox/",
    "series": [
        {
            "id": 2739,
            "url": "https://patchwork.libcamera.org/api/series/2739/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2739",
            "date": "2021-11-20T11:13:01",
            "name": "libcamera: Add support for Fence",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/2739/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/14677/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/14677/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 629C6C3252\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 20 Nov 2021 11:12:31 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A43596043C;\n\tSat, 20 Nov 2021 12:12:30 +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 2EFE06039C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 20 Nov 2021 12:12:28 +0100 (CET)",
            "(Authenticated sender: jacopo@jmondi.org)\n\tby relay11.mail.gandi.net (Postfix) with ESMTPSA id B7D19100002;\n\tSat, 20 Nov 2021 11:12:27 +0000 (UTC)"
        ],
        "From": "Jacopo Mondi <jacopo@jmondi.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Sat, 20 Nov 2021 12:13:10 +0100",
        "Message-Id": "<20211120111313.106621-10-jacopo@jmondi.org>",
        "X-Mailer": "git-send-email 2.33.1",
        "In-Reply-To": "<20211120111313.106621-1-jacopo@jmondi.org>",
        "References": "<20211120111313.106621-1-jacopo@jmondi.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 09/12] 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 the Request::Private\nstatus to discern if a Request has failed preparing or it can be queued\nto the hardware.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/pipeline_handler.cpp | 32 +++++++++++++++++++++++++++---\n 1 file changed, 29 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp\nindex 3b9145992c8f..82ef214d16f2 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@@ -17,6 +18,7 @@\n #include <libcamera/framebuffer.h>\n \n #include \"libcamera/internal/camera.h\"\n+#include \"libcamera/internal/framebuffer.h\"\n #include \"libcamera/internal/device_enumerator.h\"\n #include \"libcamera/internal/media_device.h\"\n #include \"libcamera/internal/request.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@@ -338,7 +342,14 @@ void PipelineHandler::queueRequest(Request *request)\n \tLIBCAMERA_TRACEPOINT(request_queue, request);\n \n \twaitingRequests_.push_back(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+\n+\tRequest::Private::Status status = request->_d()->prepare(300ms);\n+\tif (status == Request::Private::Status::Ready)\n+\t\tdoQueueRequests();\n }\n \n /**\n@@ -354,6 +365,12 @@ void PipelineHandler::doQueueRequest(Request *request)\n \n \trequest->_d()->sequence_ = data->requestSequence_++;\n \n+\tif (request->_d()->privateStatus() == Request::Private::Status::Failed) {\n+\t\trequest->_d()->cancel();\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@@ -371,9 +388,18 @@ void PipelineHandler::doQueueRequests()\n \t\t\treturn;\n \n \t\tRequest *request = waitingRequests_.front();\n-\t\twaitingRequests_.pop_front();\n+\t\tRequest::Private::Status status = request->_d()->privateStatus();\n+\n+\t\tswitch (status) {\n+\t\tcase Request::Private::Status::Pending:\n+\t\t\treturn;\n \n-\t\tdoQueueRequest(request);\n+\t\tcase Request::Private::Status::Failed:\n+\t\tcase Request::Private::Status::Ready:\n+\t\t\twaitingRequests_.pop_front();\n+\t\t\tdoQueueRequest(request);\n+\t\t\tbreak;\n+\t\t}\n \t}\n }\n \n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "09/12"
    ]
}