Show a patch.

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

{
    "id": 2208,
    "url": "https://patchwork.libcamera.org/api/patches/2208/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/2208/",
    "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": "<20191022160110.19419-1-kieran.bingham@ideasonboard.com>",
    "date": "2019-10-22T16:01:10",
    "name": "[libcamera-devel,RFC] libcamera: v4l2_videodevice: Track streaming state",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "8d32cc755a0e6851334857cd027699dd923dcadc",
    "submitter": {
        "id": 4,
        "url": "https://patchwork.libcamera.org/api/people/4/?format=api",
        "name": "Kieran Bingham",
        "email": "kieran.bingham@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/2208/mbox/",
    "series": [
        {
            "id": 541,
            "url": "https://patchwork.libcamera.org/api/series/541/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=541",
            "date": "2019-10-22T16:01:10",
            "name": "[libcamera-devel,RFC] libcamera: v4l2_videodevice: Track streaming state",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/541/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/2208/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/2208/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<kieran.bingham@ideasonboard.com>",
        "Received": [
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4E5EF6137A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 22 Oct 2019 18:01:14 +0200 (CEST)",
            "from Q.local (cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net\n\t[86.31.129.233])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id D006D595;\n\tTue, 22 Oct 2019 18:01:13 +0200 (CEST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1571760074;\n\tbh=iGjHsSQILInB1Lr4jbGr7cHTBftSYWBb7q1by3kEtuY=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=W/aU2yW/U9Vs5r9t9RZerrDmwmqBWnLhvoc2E6UFZ9Ntv4DPRPVQJnhAo6ZIDrAxE\n\ts9o7jgZThsOs0VkjAWwzRzbhHhGaK56UoozXNmZvarz+C/LdFPlzukjqXDd68vTpwW\n\tJUNefljnN0In389azGT0FMNaUI71aGp0SOiH6OQc=",
        "From": "Kieran Bingham <kieran.bingham@ideasonboard.com>",
        "To": "LibCamera Devel <libcamera-devel@lists.libcamera.org>",
        "Date": "Tue, 22 Oct 2019 17:01:10 +0100",
        "Message-Id": "<20191022160110.19419-1-kieran.bingham@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.20.1",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [RFC PATCH] libcamera: v4l2_videodevice: Track\n\tstreaming 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>",
        "X-List-Received-Date": "Tue, 22 Oct 2019 16:01:14 -0000"
    },
    "content": "Track the state of streamon/streamoff calls to simplify error paths.\n\nEnsuring that streamOff() can be called on non-streaming streams facilitates simpler\nerror code paths, where a set of devices can all call streamOff regardless of their\ninitialisation state.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n\nThis is a patch I have while developing the RPi ISP handler.\nIt means I can do the following for error paths:\n\n\tdata->isp_.stats_->streamOff();\n\tdata->isp_.capture1_->streamOff();\n \tdata->isp_.capture0_->streamOff();\n \tdata->isp_.output_->streamOff();\n \tdata->unicam_->streamOff();\n\nwhich essentially means I can just call stop(camera) for cleanup, without\nhaving to track which ones were successfully started or not.\n\nSo - Reasonable or not ?\n\nPatch will not apply directly to master, as it's currently based on my dev\nbranch, hence RFC\n\n src/libcamera/include/v4l2_videodevice.h | 2 ++\n src/libcamera/v4l2_videodevice.cpp       | 9 ++++++++-\n 2 files changed, 10 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/src/libcamera/include/v4l2_videodevice.h b/src/libcamera/include/v4l2_videodevice.h\nindex 60fca01670c6..d6e0c0e7bf02 100644\n--- a/src/libcamera/include/v4l2_videodevice.h\n+++ b/src/libcamera/include/v4l2_videodevice.h\n@@ -188,6 +188,8 @@ private:\n \tstd::map<unsigned int, Buffer *> queuedBuffers_;\n \n \tEventNotifier *fdEvent_;\n+\n+\tbool streaming_;\n };\n \n class V4L2M2MDevice\ndiff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\nindex 71c32766fc2d..01e11597cfb0 100644\n--- a/src/libcamera/v4l2_videodevice.cpp\n+++ b/src/libcamera/v4l2_videodevice.cpp\n@@ -273,7 +273,7 @@ const std::string V4L2DeviceFormat::toString() const\n  */\n V4L2VideoDevice::V4L2VideoDevice(const std::string &deviceNode)\n \t: V4L2Device(deviceNode), multiPlanar_(false), bufferPool_(nullptr),\n-\t  fdEvent_(nullptr)\n+\t  fdEvent_(nullptr), streaming_(false)\n {\n \t/*\n \t * We default to an MMAP based CAPTURE video device, however this will\n@@ -1197,6 +1197,8 @@ int V4L2VideoDevice::streamOn()\n \t\treturn ret;\n \t}\n \n+\tstreaming_ = true;\n+\n \treturn 0;\n }\n \n@@ -1214,6 +1216,9 @@ int V4L2VideoDevice::streamOff()\n {\n \tint ret;\n \n+\tif (!streaming_)\n+\t\treturn 0;\n+\n \tret = ioctl(VIDIOC_STREAMOFF, &bufferType_);\n \tif (ret < 0) {\n \t\tLOG(V4L2, Error)\n@@ -1234,6 +1239,8 @@ int V4L2VideoDevice::streamOff()\n \tqueuedBuffers_.clear();\n \tfdEvent_->setEnabled(false);\n \n+\tstreaming_ = false;\n+\n \treturn 0;\n }\n \n",
    "prefixes": [
        "libcamera-devel",
        "RFC"
    ]
}