Show a patch.

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

{
    "id": 11718,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/11718/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/11718/",
    "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": "<20210325134231.1400051-11-kieran.bingham@ideasonboard.com>",
    "date": "2021-03-25T13:42:28",
    "name": "[libcamera-devel,v3,08/11] libcamera: camera: Extend with a Stopping state",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "f99d110a479a22f04943afb4c5789f1eb4f931b5",
    "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/11718/mbox/",
    "series": [
        {
            "id": 1832,
            "url": "https://patchwork.libcamera.org/api/1.1/series/1832/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1832",
            "date": "2021-03-25T13:42:18",
            "name": "[libcamera-devel,v3,01/11] utils: ipc: proxy: Track IPA with a state machine",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/1832/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/11718/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/11718/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 5826BC32E9\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 25 Mar 2021 13:42:49 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 166E268D74;\n\tThu, 25 Mar 2021 14:42:49 +0100 (CET)",
            "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 92FA368D78\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 25 Mar 2021 14:42:38 +0100 (CET)",
            "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 3805E8F0;\n\tThu, 25 Mar 2021 14:42:38 +0100 (CET)"
        ],
        "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=\"Wsqc09ge\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1616679758;\n\tbh=jy5bYpvfy4XXzv0fMaKRnM42klCMw03KqumuNftoGeA=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=Wsqc09gez3ixKcPSpBs1qrJJ2oglb6bTSKvF9IrbzJYz9KPQQNyd2M5D8BC8R+LZh\n\t0IYj7ShWb3eky9zGI5xvHErDmPdUlpLMctcN1APq1fQTDf68zTeUmaPKgl7QTnTDgI\n\tyPi5ENC8L7pdaetMQpZd6hpxiz3MAFKDNtBrOZes=",
        "From": "Kieran Bingham <kieran.bingham@ideasonboard.com>",
        "To": "libcamera devel <libcamera-devel@lists.libcamera.org>",
        "Date": "Thu, 25 Mar 2021 13:42:28 +0000",
        "Message-Id": "<20210325134231.1400051-11-kieran.bingham@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20210325134231.1400051-1-kieran.bingham@ideasonboard.com>",
        "References": "<20210325134231.1400051-1-kieran.bingham@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH v3 08/11] libcamera: camera: Extend with a\n\tStopping state",
        "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": "When the camera is being stop()ped, active requests will complete. These\nmay trigger an application to re-queue those requests to the camera but\nthat is not permitted.\n\nExtend the camera state to include a stopping state which is entered as\nsoon as a call to stop() is made. At this point, any request queued will\nbe rejected with a warning, while any pending requests are either\nsuccessfully completed or cancelled.\n\nWhen the pipeline handler has finished stopping, the camera state will\ntransition to the CameraConfigured state where it can begin to accept\nrequests again, and be restarted.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/libcamera/camera.cpp | 18 ++++++++++++++++--\n 1 file changed, 16 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp\nindex 336ab8695ab3..7f7956ba732f 100644\n--- a/src/libcamera/camera.cpp\n+++ b/src/libcamera/camera.cpp\n@@ -339,6 +339,7 @@ public:\n \t\tCameraAvailable,\n \t\tCameraAcquired,\n \t\tCameraConfigured,\n+\t\tCameraStopping,\n \t\tCameraRunning,\n \t};\n \n@@ -382,6 +383,7 @@ static const char *const camera_state_names[] = {\n \t\"Available\",\n \t\"Acquired\",\n \t\"Configured\",\n+\t\"Stopping\",\n \t\"Running\",\n };\n \n@@ -492,6 +494,7 @@ void Camera::Private::setState(State state)\n  *   node [shape = doublecircle ]; Available;\n  *   node [shape = circle ]; Acquired;\n  *   node [shape = circle ]; Configured;\n+ *   node [shape = circle ]; Stopping;\n  *   node [shape = circle ]; Running;\n  *\n  *   Available -> Available [label = \"release()\"];\n@@ -504,7 +507,8 @@ void Camera::Private::setState(State state)\n  *   Configured -> Configured [label = \"configure(), createRequest()\"];\n  *   Configured -> Running [label = \"start()\"];\n  *\n- *   Running -> Configured [label = \"stop()\"];\n+ *   Running -> Stopping [label = \"stop()\"];\n+ *   Stopping -> Configured;\n  *   Running -> Running [label = \"createRequest(), queueRequest()\"];\n  * }\n  * \\enddot\n@@ -524,6 +528,12 @@ void Camera::Private::setState(State state)\n  * release() the camera and to get back to the Available state or start()\n  * it to progress to the Running state.\n  *\n+ * \\subsubsection Stopping\n+ * The camera has been asked to stop. Pending reqeusts are being completed or\n+ * cancelled, and no new requests are permitted to be queued. The camera will\n+ * transition to the Configured state when all queued requests have been\n+ * returned to the application.\n+ *\n  * \\subsubsection Running\n  * The camera is running and ready to process requests queued by the\n  * application. The camera remains in this state until it is stopped and moved\n@@ -1071,6 +1081,8 @@ int Camera::stop()\n \n \tLOG(Camera, Debug) << \"Stopping capture\";\n \n+\td->setState(Private::CameraStopping);\n+\n \td->pipe_->invokeMethod(&PipelineHandler::stop, ConnectionTypeBlocking,\n \t\t\t       this);\n \n@@ -1091,7 +1103,9 @@ void Camera::requestComplete(Request *request)\n \tPrivate *const d = LIBCAMERA_D_PTR();\n \n \t/* Disconnected cameras are still able to complete requests. */\n-\tint ret = d->isAccessAllowed(__FUNCTION__, Private::CameraRunning);\n+\tint ret = d->isAccessAllowed(__FUNCTION__,\n+\t\t\t\t     Private::CameraStopping,\n+\t\t\t\t     Private::CameraRunning);\n \tif (ret < 0 && ret != -ENODEV)\n \t\tLOG(Camera, Fatal) << \"Trying to complete a request when stopped\";\n \n",
    "prefixes": [
        "libcamera-devel",
        "v3",
        "08/11"
    ]
}