Show a patch.

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

{
    "id": 4053,
    "url": "https://patchwork.libcamera.org/api/patches/4053/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/4053/",
    "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": "<20200616131244.70308-10-paul.elder@ideasonboard.com>",
    "date": "2020-06-16T13:12:38",
    "name": "[libcamera-devel,09/15] v4l2: v4l2_cammera_proxy: Reset buffer flags on streamoff when already off",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "58ef5a93d67a153a279c267baa56e78c01a6b56e",
    "submitter": {
        "id": 17,
        "url": "https://patchwork.libcamera.org/api/people/17/?format=api",
        "name": "Paul Elder",
        "email": "paul.elder@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/4053/mbox/",
    "series": [
        {
            "id": 1006,
            "url": "https://patchwork.libcamera.org/api/series/1006/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1006",
            "date": "2020-06-16T13:12:29",
            "name": "Support v4l2-compliance",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/1006/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/4053/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/4053/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<paul.elder@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 5D13061F72\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 16 Jun 2020 15:13:17 +0200 (CEST)",
            "from jade.flets-east.jp (unknown\n\t[IPv6:2400:4051:61:600:2807:bdfa:f6a:8e53])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E741AF9;\n\tTue, 16 Jun 2020 15:13:15 +0200 (CEST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"XEn7KEX8\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1592313197;\n\tbh=d0nXpwSQo/5EWRBjCr9n31E3PtQ9sPzZ/S0qcDne9TY=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=XEn7KEX8Y15DhxMEwOGd45pgem/doN3K0BBmpXK7o/juXw5Z3d4z8UKb9D/sf9EyK\n\t3y9NrnPVIzsO7OlmA/GHjBA4Ce5rvDQrNxHW3AmKB+qOeS5U4dtDCnqPH4FiW7/nC/\n\tzy0xOnYY4Oiu0tnTbYYstYp4MhgtCJk6es4Mx6Is=",
        "From": "Paul Elder <paul.elder@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Tue, 16 Jun 2020 22:12:38 +0900",
        "Message-Id": "<20200616131244.70308-10-paul.elder@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.27.0",
        "In-Reply-To": "<20200616131244.70308-1-paul.elder@ideasonboard.com>",
        "References": "<20200616131244.70308-1-paul.elder@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 09/15] v4l2: v4l2_cammera_proxy: Reset\n\tbuffer flags on streamoff when already off",
        "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, 16 Jun 2020 13:13:17 -0000"
    },
    "content": "If VIDIOC_STREAMOFF is called when the stream is already off, just reset\nthe buffer status flags and return. Add a streaming flag to\nV4L2CameraProxy to track the streaming status.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n---\n src/v4l2/v4l2_camera_proxy.cpp | 18 +++++++++++++++++-\n src/v4l2/v4l2_camera_proxy.h   |  1 +\n 2 files changed, 18 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp\nindex fd2785f..63b4124 100644\n--- a/src/v4l2/v4l2_camera_proxy.cpp\n+++ b/src/v4l2/v4l2_camera_proxy.cpp\n@@ -34,7 +34,8 @@ V4L2CameraProxy::V4L2CameraProxy(unsigned int index,\n \t\t\t\t std::shared_ptr<Camera> camera)\n \t: refcount_(0), index_(index), bufferCount_(0), currentBuf_(0),\n \t  vcam_(std::make_unique<V4L2Camera>(camera)), efd_(-1),\n-\t  v4l2RecordPriorityFd_(-1), acquiredFd_(-1), initialized_(false)\n+\t  v4l2RecordPriorityFd_(-1), acquiredFd_(-1), initialized_(false),\n+\t  streaming_(false)\n {\n \tquerycap(camera);\n }\n@@ -628,6 +629,9 @@ int V4L2CameraProxy::vidioc_dqbuf(int fd, struct v4l2_buffer *arg)\n \tif (arg == nullptr)\n \t\treturn -EFAULT;\n \n+\tif (!streaming_)\n+\t\treturn -EINVAL;\n+\n \tint ret = lock(fd);\n \tif (ret < 0)\n \t\treturn ret;\n@@ -666,6 +670,9 @@ int V4L2CameraProxy::vidioc_streamon(int fd, int *arg)\n \tif (arg == nullptr)\n \t\treturn -EFAULT;\n \n+\tif (streaming_)\n+\t\treturn 0;\n+\n \tint ret = lock(fd);\n \tif (ret < 0)\n \t\treturn ret;\n@@ -674,6 +681,7 @@ int V4L2CameraProxy::vidioc_streamon(int fd, int *arg)\n \t\treturn -EINVAL;\n \n \tcurrentBuf_ = 0;\n+\tstreaming_ = true;\n \n \treturn vcam_->streamOn();\n }\n@@ -685,6 +693,12 @@ int V4L2CameraProxy::vidioc_streamoff(int fd, int *arg)\n \tif (arg == nullptr)\n \t\treturn -EFAULT;\n \n+\tif (!streaming_) {\n+\t\tfor (unsigned int i = 0; i < bufferCount_; i++)\n+\t\t\tbuffers_[i].flags &= ~(V4L2_BUF_FLAG_QUEUED | V4L2_BUF_FLAG_DONE);\n+\t\treturn 0;\n+\t}\n+\n \tint ret = lock(fd);\n \tif (ret < 0)\n \t\treturn ret;\n@@ -697,6 +711,8 @@ int V4L2CameraProxy::vidioc_streamoff(int fd, int *arg)\n \tfor (struct v4l2_buffer &buf : buffers_)\n \t\tbuf.flags &= ~(V4L2_BUF_FLAG_QUEUED | V4L2_BUF_FLAG_DONE);\n \n+\tstreaming_ = false;\n+\n \treturn ret;\n }\n \ndiff --git a/src/v4l2/v4l2_camera_proxy.h b/src/v4l2/v4l2_camera_proxy.h\nindex 2ff9571..28b2fa0 100644\n--- a/src/v4l2/v4l2_camera_proxy.h\n+++ b/src/v4l2/v4l2_camera_proxy.h\n@@ -103,6 +103,7 @@ private:\n \tint acquiredFd_;\n \n \tbool initialized_;\n+\tbool streaming_;\n };\n \n #endif /* __V4L2_CAMERA_PROXY_H__ */\n",
    "prefixes": [
        "libcamera-devel",
        "09/15"
    ]
}