Show a patch.

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

{
    "id": 4085,
    "url": "https://patchwork.libcamera.org/api/patches/4085/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/4085/",
    "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": "<20200619054123.19052-6-paul.elder@ideasonboard.com>",
    "date": "2020-06-19T05:41:11",
    "name": "[libcamera-devel,v2,05/17] v4l2: v4l2_camera_proxy: Implement VIDIOC_G/S_PRIORITY",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "b70ddfeeaaeaad97bfaf7e59fabf9defb0010007",
    "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/4085/mbox/",
    "series": [
        {
            "id": 1017,
            "url": "https://patchwork.libcamera.org/api/series/1017/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1017",
            "date": "2020-06-19T05:41:06",
            "name": "Support v4l2-compliance",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/1017/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/4085/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/4085/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<paul.elder@ideasonboard.com>",
        "Received": [
            "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 7FD1A603BF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 19 Jun 2020 07:41:46 +0200 (CEST)",
            "from jade.flets-east.jp (unknown\n\t[IPv6:2400:4051:61:600:e972:d773:e99a:4f79])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id EF232556;\n\tFri, 19 Jun 2020 07:41:44 +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=\"twaA/TXG\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1592545306;\n\tbh=gFr7DJnqrrD48VO4JMq4OvrvnusUHZbSZNpenGeTllg=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=twaA/TXGwvbNrOPnJ8lC0p4H6cDtsDjR3N88I5MV+xb+i90M/ZKdBIuTzzw9XvmRp\n\t3U02VZkgAEf+3ST6eCCWeqKS1+AO4zvOGxHUDEYe6pZIQALiIxFvVkUNiakq1wpxpj\n\tI4l4fL6MreGYrLbF+kH1cp7OowuWNQtDafhX1jkM=",
        "From": "Paul Elder <paul.elder@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri, 19 Jun 2020 14:41:11 +0900",
        "Message-Id": "<20200619054123.19052-6-paul.elder@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.27.0",
        "In-Reply-To": "<20200619054123.19052-1-paul.elder@ideasonboard.com>",
        "References": "<20200619054123.19052-1-paul.elder@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 05/17] v4l2: v4l2_camera_proxy:\n\tImplement VIDIOC_G/S_PRIORITY",
        "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": "Fri, 19 Jun 2020 05:41:46 -0000"
    },
    "content": "Implement VIDIOC_G_PRIORITY and VIDIOC_S_PRIORITY, according to what\nv4l2-compliance wants.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n\n---\nChanges in v2:\n- use V4L2CameraFile instead of fd and priorities map\n---\n src/v4l2/v4l2_camera_proxy.cpp | 42 +++++++++++++++++++++++++++++++++-\n src/v4l2/v4l2_camera_proxy.h   |  3 +++\n 2 files changed, 44 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp\nindex 117d7ff..3e95645 100644\n--- a/src/v4l2/v4l2_camera_proxy.cpp\n+++ b/src/v4l2/v4l2_camera_proxy.cpp\n@@ -37,7 +37,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  acquiredCf_(nullptr), initialized_(false)\n+\t  v4l2RecordPriorityCf_(nullptr), acquiredCf_(nullptr),\n+\t  initialized_(false)\n {\n \tquerycap(camera);\n }\n@@ -344,6 +345,37 @@ int V4L2CameraProxy::vidioc_try_fmt(V4L2CameraFile *cf, struct v4l2_format *arg)\n \treturn 0;\n }\n \n+int V4L2CameraProxy::vidioc_g_priority(V4L2CameraFile *cf, enum v4l2_priority *arg)\n+{\n+\tLOG(V4L2Compat, Debug) << \"Servicing vidioc_g_priority fd = \" << cf->efd();\n+\n+\tif (v4l2RecordPriorityCf_)\n+\t\t*arg = V4L2_PRIORITY_RECORD;\n+\telse\n+\t\t*arg = cf->priority_;\n+\n+\treturn 0;\n+}\n+\n+int V4L2CameraProxy::vidioc_s_priority(V4L2CameraFile *cf, enum v4l2_priority *arg)\n+{\n+\tLOG(V4L2Compat, Debug)\n+\t\t<< \"Servicing vidioc_s_priority fd = \" << cf->efd()\n+\t\t<< \" prio =  \" << (int)*arg;\n+\n+\tif (v4l2RecordPriorityCf_ && v4l2RecordPriorityCf_ != cf)\n+\t\treturn -EBUSY;\n+\n+\tif (*arg == V4L2_PRIORITY_RECORD)\n+\t\tv4l2RecordPriorityCf_ = cf;\n+\telse if (v4l2RecordPriorityCf_ == cf)\n+\t\tv4l2RecordPriorityCf_ = nullptr;\n+\n+\tcf->priority_ = *arg;\n+\n+\treturn 0;\n+}\n+\n int V4L2CameraProxy::freeBuffers()\n {\n \tLOG(V4L2Compat, Debug) << \"Freeing libcamera bufs\";\n@@ -560,6 +592,8 @@ std::set<unsigned long> V4L2CameraProxy::supportedIoctls_ = {\n \tVIDIOC_G_FMT,\n \tVIDIOC_S_FMT,\n \tVIDIOC_TRY_FMT,\n+\tVIDIOC_G_PRIORITY,\n+\tVIDIOC_S_PRIORITY,\n \tVIDIOC_REQBUFS,\n \tVIDIOC_QUERYBUF,\n \tVIDIOC_QBUF,\n@@ -597,6 +631,12 @@ int V4L2CameraProxy::ioctl(V4L2CameraFile *cf, unsigned long request, void *arg)\n \tcase VIDIOC_TRY_FMT:\n \t\tret = vidioc_try_fmt(cf, static_cast<struct v4l2_format *>(arg));\n \t\tbreak;\n+\tcase VIDIOC_G_PRIORITY:\n+\t\tret = vidioc_g_priority(cf, static_cast<enum v4l2_priority *>(arg));\n+\t\tbreak;\n+\tcase VIDIOC_S_PRIORITY:\n+\t\tret = vidioc_s_priority(cf, static_cast<enum v4l2_priority *>(arg));\n+\t\tbreak;\n \tcase VIDIOC_REQBUFS:\n \t\tret = vidioc_reqbufs(cf, static_cast<struct v4l2_requestbuffers *>(arg));\n \t\tbreak;\ndiff --git a/src/v4l2/v4l2_camera_proxy.h b/src/v4l2/v4l2_camera_proxy.h\nindex dd7e793..3260eec 100644\n--- a/src/v4l2/v4l2_camera_proxy.h\n+++ b/src/v4l2/v4l2_camera_proxy.h\n@@ -51,6 +51,8 @@ private:\n \tint vidioc_g_fmt(V4L2CameraFile *cf, struct v4l2_format *arg);\n \tint vidioc_s_fmt(V4L2CameraFile *cf, struct v4l2_format *arg);\n \tint vidioc_try_fmt(V4L2CameraFile *cf, struct v4l2_format *arg);\n+\tint vidioc_g_priority(V4L2CameraFile *cf, enum v4l2_priority *arg);\n+\tint vidioc_s_priority(V4L2CameraFile *cf, enum v4l2_priority *arg);\n \tint vidioc_reqbufs(V4L2CameraFile *cf, struct v4l2_requestbuffers *arg);\n \tint vidioc_querybuf(V4L2CameraFile *cf, struct v4l2_buffer *arg);\n \tint vidioc_qbuf(V4L2CameraFile *cf, struct v4l2_buffer *arg);\n@@ -87,6 +89,7 @@ private:\n \n \tint efd_;\n \n+\tV4L2CameraFile *v4l2RecordPriorityCf_;\n \t/*\n \t * This is an exclusive lock on the camera. When this is not taken,\n \t * anybody can call any ioctl before reqbufs. reqbufs with count > 0\n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "05/17"
    ]
}