Show a patch.

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

{
    "id": 12016,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/12016/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/12016/",
    "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": "<20210420130741.236848-7-kieran.bingham@ideasonboard.com>",
    "date": "2021-04-20T13:07:41",
    "name": "[libcamera-devel,v4,6/6] libcamera: request: Make it extensible",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": false,
    "hash": "35a96fc282233ca99a47d5bbd49fd84f6231d8a0",
    "submitter": {
        "id": 4,
        "url": "https://patchwork.libcamera.org/api/1.1/people/4/?format=api",
        "name": "Kieran Bingham",
        "email": "kieran.bingham@ideasonboard.com"
    },
    "delegate": {
        "id": 11,
        "url": "https://patchwork.libcamera.org/api/1.1/users/11/?format=api",
        "username": "kbingham",
        "first_name": "Kieran",
        "last_name": "Bingham",
        "email": "kieran.bingham@ideasonboard.com"
    },
    "mbox": "https://patchwork.libcamera.org/patch/12016/mbox/",
    "series": [
        {
            "id": 1952,
            "url": "https://patchwork.libcamera.org/api/1.1/series/1952/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1952",
            "date": "2021-04-20T13:07:35",
            "name": "IPU3 Debug Improvements",
            "version": 4,
            "mbox": "https://patchwork.libcamera.org/series/1952/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/12016/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/12016/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 A740DBDB16\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 20 Apr 2021 13:07:53 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5A4056885B;\n\tTue, 20 Apr 2021 15:07:53 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 27C8868848\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 20 Apr 2021 15:07:48 +0200 (CEST)",
            "from Q.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net\n\t[86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id AB8C21172;\n\tTue, 20 Apr 2021 15:07:47 +0200 (CEST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"GB/kSRZB\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1618924067;\n\tbh=wMRpuy1H/rF5bzYMG+ti3c5ayvGN5Ca88P/T1NxiRI4=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=GB/kSRZBS9/qfhQPYau4mPI0//U5QZoxOGz1x4jaAErEMdZTktVYqB+1KRZHI6yH0\n\tlgPLWNDaHVzOK8PJ4I7nHSpd5eJc0MXGw/FlVOjBqOCvc0Uoe+qTvdkYiZ2/tzFYdH\n\t+3j3t+SJC0CYqLFDDxFcw2W9sw7fTWCFEoxsfFOc=",
        "From": "Kieran Bingham <kieran.bingham@ideasonboard.com>",
        "To": "libcamera devel <libcamera-devel@lists.libcamera.org>",
        "Date": "Tue, 20 Apr 2021 14:07:41 +0100",
        "Message-Id": "<20210420130741.236848-7-kieran.bingham@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20210420130741.236848-1-kieran.bingham@ideasonboard.com>",
        "References": "<20210420130741.236848-1-kieran.bingham@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH v4 6/6] libcamera: request: Make it\n\textensible",
        "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": "Provide an extensible private object for the Request class.\nThis allows us to make modifications to the private API and storage of\nrequests without affecting the public API or ABI.\n\nThe D pointer is obtained in all Request functions implemented in the\nrequest.cpp file along with an assertion that the D pointer was valid to\nprovide extra validation checking that the Request has not been\ndeleted, while in use as it is 'owned' by the application.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n---\nThe assertions added in findBuffer, complete() and completeBuffer()\nallow us to ensure that the Request is still valid while asynchronous\nactions occur on the Request internally in libcamera, and provide\n(almost) equivalent functionality as the Request Canary previously\nproposed.\n\nThe additions in reuse() and addBuffer() are called from applications,\nso the assertions may be less helpful there, but I've added them for\nconsistency.\n\n include/libcamera/request.h |  4 +++-\n src/libcamera/request.cpp   | 34 ++++++++++++++++++++++++++++++++--\n 2 files changed, 35 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/include/libcamera/request.h b/include/libcamera/request.h\nindex 4cf5ff3f7d3b..909a1aebc2d2 100644\n--- a/include/libcamera/request.h\n+++ b/include/libcamera/request.h\n@@ -24,8 +24,10 @@ class CameraControlValidator;\n class FrameBuffer;\n class Stream;\n \n-class Request\n+class Request : public Extensible\n {\n+\tLIBCAMERA_DECLARE_PRIVATE(Request)\n+\n public:\n \tenum Status {\n \t\tRequestPending,\ndiff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp\nindex ce2dd7b17f10..977bfac4fce6 100644\n--- a/src/libcamera/request.cpp\n+++ b/src/libcamera/request.cpp\n@@ -28,6 +28,19 @@ namespace libcamera {\n \n LOG_DEFINE_CATEGORY(Request)\n \n+class Request::Private : public Extensible::Private\n+{\n+\tLIBCAMERA_DECLARE_PUBLIC(Request)\n+\n+public:\n+\tPrivate(Request *request);\n+};\n+\n+Request::Private::Private(Request *request)\n+\t: Extensible::Private(request)\n+{\n+}\n+\n /**\n  * \\enum Request::Status\n  * Request completion status\n@@ -73,8 +86,8 @@ LOG_DEFINE_CATEGORY(Request)\n  *\n  */\n Request::Request(Camera *camera, uint64_t cookie)\n-\t: camera_(camera), sequence_(0), cookie_(cookie),\n-\t  status_(RequestPending), cancelled_(false)\n+\t: Extensible(new Private(this)), camera_(camera), sequence_(0),\n+\t  cookie_(cookie), status_(RequestPending), cancelled_(false)\n {\n \t/**\n \t * \\todo Should the Camera expose a validator instance, to avoid\n@@ -114,6 +127,9 @@ Request::~Request()\n  */\n void Request::reuse(ReuseFlag flags)\n {\n+\tPrivate *const d = LIBCAMERA_D_PTR();\n+\tASSERT(d);\n+\n \tLIBCAMERA_TRACEPOINT(request_reuse, this);\n \n \tpending_.clear();\n@@ -179,6 +195,9 @@ void Request::reuse(ReuseFlag flags)\n  */\n int Request::addBuffer(const Stream *stream, FrameBuffer *buffer)\n {\n+\tPrivate *const d = LIBCAMERA_D_PTR();\n+\tASSERT(d);\n+\n \tif (!stream) {\n \t\tLOG(Request, Error) << \"Invalid stream reference\";\n \t\treturn -EINVAL;\n@@ -214,6 +233,9 @@ int Request::addBuffer(const Stream *stream, FrameBuffer *buffer)\n  */\n FrameBuffer *Request::findBuffer(const Stream *stream) const\n {\n+\tconst Private *const d = LIBCAMERA_D_PTR();\n+\tASSERT(d);\n+\n \tconst auto it = bufferMap_.find(stream);\n \tif (it == bufferMap_.end())\n \t\treturn nullptr;\n@@ -282,6 +304,8 @@ FrameBuffer *Request::findBuffer(const Stream *stream) const\n  */\n void Request::complete()\n {\n+\tPrivate *const d = LIBCAMERA_D_PTR();\n+\tASSERT(d);\n \tASSERT(status_ == RequestPending);\n \tASSERT(!hasPendingBuffers());\n \n@@ -307,6 +331,9 @@ void Request::complete()\n  */\n bool Request::completeBuffer(FrameBuffer *buffer)\n {\n+\tPrivate *const d = LIBCAMERA_D_PTR();\n+\tASSERT(d);\n+\n \tLIBCAMERA_TRACEPOINT(request_complete_buffer, this, buffer);\n \n \tint ret = pending_.erase(buffer);\n@@ -330,6 +357,9 @@ bool Request::completeBuffer(FrameBuffer *buffer)\n  */\n std::string Request::toString() const\n {\n+\tconst Private *const d = LIBCAMERA_D_PTR();\n+\tASSERT(d);\n+\n \tstd::stringstream ss;\n \n \t/* Pending, Completed, Cancelled(X). */\n",
    "prefixes": [
        "libcamera-devel",
        "v4",
        "6/6"
    ]
}