Show a patch.

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

{
    "id": 12242,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/12242/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/12242/",
    "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": "<20210510105235.28319-3-jacopo@jmondi.org>",
    "date": "2021-05-10T10:52:29",
    "name": "[libcamera-devel,2/8] libcamera: request: Add Request::cancel()",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "7787168354e96af90033571a8d6e13f3fd26d583",
    "submitter": {
        "id": 3,
        "url": "https://patchwork.libcamera.org/api/1.1/people/3/?format=api",
        "name": "Jacopo Mondi",
        "email": "jacopo@jmondi.org"
    },
    "delegate": {
        "id": 15,
        "url": "https://patchwork.libcamera.org/api/1.1/users/15/?format=api",
        "username": "jmondi",
        "first_name": "Jacopo",
        "last_name": "Mondi",
        "email": "jacopo@jmondi.org"
    },
    "mbox": "https://patchwork.libcamera.org/patch/12242/mbox/",
    "series": [
        {
            "id": 2016,
            "url": "https://patchwork.libcamera.org/api/1.1/series/2016/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2016",
            "date": "2021-05-10T10:52:27",
            "name": "android: Implement flush() camera operation",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/2016/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/12242/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/12242/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 882CABF835\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 10 May 2021 10:51:59 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id DA8F668920;\n\tMon, 10 May 2021 12:51:58 +0200 (CEST)",
            "from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net\n\t[217.70.183.196])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6CCFA602BE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 10 May 2021 12:51:57 +0200 (CEST)",
            "from uno.homenet.telecomitalia.it\n\t(host-82-59-136-116.retail.telecomitalia.it [82.59.136.116])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 8C43BE01E6;\n\tMon, 10 May 2021 10:51:56 +0000 (UTC)"
        ],
        "X-Originating-IP": "82.59.136.116",
        "From": "Jacopo Mondi <jacopo@jmondi.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon, 10 May 2021 12:52:29 +0200",
        "Message-Id": "<20210510105235.28319-3-jacopo@jmondi.org>",
        "X-Mailer": "git-send-email 2.31.1",
        "In-Reply-To": "<20210510105235.28319-1-jacopo@jmondi.org>",
        "References": "<20210510105235.28319-1-jacopo@jmondi.org>",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH 2/8] libcamera: request: Add\n\tRequest::cancel()",
        "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>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Add a cancel() function to the Request class that allows to forcefully\ncomplete the request and its associated buffers in error state.\n\nOnly pending requests can be forcefully cancelled. Enforce that\nby asserting the request state to be RequestPending.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n include/libcamera/request.h |  1 +\n src/libcamera/request.cpp   | 30 ++++++++++++++++++++++++++++++\n 2 files changed, 31 insertions(+)",
    "diff": "diff --git a/include/libcamera/request.h b/include/libcamera/request.h\nindex 4cf5ff3f7d3b..5596901ddd8e 100644\n--- a/include/libcamera/request.h\n+++ b/include/libcamera/request.h\n@@ -65,6 +65,7 @@ private:\n \tfriend class PipelineHandler;\n \n \tvoid complete();\n+\tvoid cancel();\n \n \tbool completeBuffer(FrameBuffer *buffer);\n \ndiff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp\nindex ce2dd7b17f10..fc5e25199112 100644\n--- a/src/libcamera/request.cpp\n+++ b/src/libcamera/request.cpp\n@@ -292,6 +292,36 @@ void Request::complete()\n \tLIBCAMERA_TRACEPOINT(request_complete, this);\n }\n \n+/**\n+ * \\brief Cancel a queued request\n+ *\n+ * Mark the request and its associated buffers as cancelled and complete it.\n+ *\n+ * Set the status of each buffer in the request to the frame cancelled state and\n+ * remove them from the pending buffer queue before completing the request with\n+ * error.\n+ */\n+void Request::cancel()\n+{\n+\tLIBCAMERA_TRACEPOINT(request_cancel, this);\n+\n+\tASSERT(status_ == RequestPending);\n+\n+\t/*\n+\t * We can't simply loop and call completeBuffer() as erase() invalidates\n+\t * pointers and iterators, so we have to manually cancel the buffer and\n+\t * erase it from the pending buffers list.\n+\t */\n+\tfor (auto buffer = pending_.begin(); buffer != pending_.end();) {\n+\t\t(*buffer)->cancel();\n+\t\t(*buffer)->setRequest(nullptr);\n+\t\tbuffer = pending_.erase(buffer);\n+\t}\n+\n+\tcancelled_ = true;\n+\tcomplete();\n+}\n+\n /**\n  * \\brief Complete a buffer for the request\n  * \\param[in] buffer The buffer that has completed\n",
    "prefixes": [
        "libcamera-devel",
        "2/8"
    ]
}