Show a patch.

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

{
    "id": 4048,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/4048/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/4048/",
    "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": "<20200616131244.70308-5-paul.elder@ideasonboard.com>",
    "date": "2020-06-16T13:12:33",
    "name": "[libcamera-devel,04/15] v4l2: v4l2_camera_proxy: Implement VIDIOC_G/S_PRIORITY",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "0b494dc93c24c187768389eca3ff64e7e4716593",
    "submitter": {
        "id": 17,
        "url": "https://patchwork.libcamera.org/api/1.1/people/17/?format=api",
        "name": "Paul Elder",
        "email": "paul.elder@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/4048/mbox/",
    "series": [
        {
            "id": 1006,
            "url": "https://patchwork.libcamera.org/api/1.1/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/4048/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/4048/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 E08E2603C1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 16 Jun 2020 15:13:07 +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 677EFF9;\n\tTue, 16 Jun 2020 15:13:06 +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=\"BH4WwXXY\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1592313187;\n\tbh=1L1rh8oULEbcXBYHA607Rw3RyBVtMB3vEmT1OMSyPLk=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=BH4WwXXYCSVUFpQSdz1yKQEFNZRPcLSvQ4pWsrYjsH6/RZJl3HUSzaJ4ic+fdaMHI\n\tCc75FYg7YhcmNqFrbZOJR/vH2gQgkLWucdHGKzNRN9XBuAOzUmhWu2r8wUyRt2r5p4\n\tjOMjR4+f9O8MHDPGbzutl7apPYpzRUyRtbD/RYWw=",
        "From": "Paul Elder <paul.elder@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Tue, 16 Jun 2020 22:12:33 +0900",
        "Message-Id": "<20200616131244.70308-5-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 04/15] v4l2: v4l2_camera_proxy: Implement\n\tVIDIOC_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": "Tue, 16 Jun 2020 13:13:08 -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 src/v4l2/v4l2_camera_proxy.cpp | 48 +++++++++++++++++++++++++++++++++-\n src/v4l2/v4l2_camera_proxy.h   |  4 +++\n 2 files changed, 51 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp\nindex d899853..f268f7a 100644\n--- a/src/v4l2/v4l2_camera_proxy.cpp\n+++ b/src/v4l2/v4l2_camera_proxy.cpp\n@@ -34,7 +34,7 @@ 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  acquiredFd_(-1), initialized_(false)\n+\t  v4l2RecordPriorityFd_(-1), acquiredFd_(-1), initialized_(false)\n {\n \tquerycap(camera);\n }\n@@ -44,6 +44,7 @@ int V4L2CameraProxy::open(int fd, bool nonBlocking)\n \tLOG(V4L2Compat, Debug) << \"Servicing open fd = \" << fd;\n \n \tnonBlockingFds_[fd] = nonBlocking;\n+\tpriorities_[fd] = V4L2_PRIORITY_DEFAULT;\n \n \trefcount_++;\n \n@@ -77,6 +78,7 @@ int V4L2CameraProxy::open(int fd, bool nonBlocking)\n void V4L2CameraProxy::dup(int oldfd, int newfd)\n {\n \tnonBlockingFds_[newfd] = nonBlockingFds_[oldfd];\n+\tpriorities_[newfd] = V4L2_PRIORITY_DEFAULT;\n \trefcount_++;\n }\n \n@@ -85,6 +87,7 @@ void V4L2CameraProxy::close(int fd)\n \tLOG(V4L2Compat, Debug) << \"Servicing close fd = \" << fd;\n \n \tnonBlockingFds_.erase(fd);\n+\tpriorities_.erase(fd);\n \n \tif (acquiredFd_ == fd)\n \t\tacquiredFd_ = -1;\n@@ -357,6 +360,43 @@ int V4L2CameraProxy::vidioc_try_fmt(int fd, struct v4l2_format *arg)\n \treturn 0;\n }\n \n+int V4L2CameraProxy::vidioc_g_priority(int fd, enum v4l2_priority *arg)\n+{\n+\tLOG(V4L2Compat, Debug) << \"Servicing vidioc_g_priority fd = \" << fd;\n+\n+\tif (arg == nullptr)\n+\t\treturn -EFAULT;\n+\n+\tif (v4l2RecordPriorityFd_ != -1)\n+\t\t*arg = V4L2_PRIORITY_RECORD;\n+\telse\n+\t\t*arg = priorities_[fd];\n+\n+\treturn 0;\n+}\n+\n+int V4L2CameraProxy::vidioc_s_priority(int fd, enum v4l2_priority *arg)\n+{\n+\tLOG(V4L2Compat, Debug)\n+\t\t<< \"Servicing vidioc_s_priority fd = \" << fd\n+\t\t<< \" prio =  \" << ((arg == nullptr) ? -1 : (int)*arg);\n+\n+\tif (arg == nullptr)\n+\t\treturn -EFAULT;\n+\n+\tif (v4l2RecordPriorityFd_ != -1 && v4l2RecordPriorityFd_ != fd)\n+\t\treturn -EBUSY;\n+\n+\tif (*arg == V4L2_PRIORITY_RECORD)\n+\t\tv4l2RecordPriorityFd_ = fd;\n+\telse if (v4l2RecordPriorityFd_ == fd)\n+\t\tv4l2RecordPriorityFd_ = -1;\n+\n+\tpriorities_[fd] = *arg;\n+\n+\treturn 0;\n+}\n+\n int V4L2CameraProxy::freeBuffers()\n {\n \tLOG(V4L2Compat, Debug) << \"Freeing libcamera bufs\";\n@@ -603,6 +643,12 @@ int V4L2CameraProxy::ioctl(int fd, unsigned long request, void *arg)\n \tcase VIDIOC_TRY_FMT:\n \t\tret = vidioc_try_fmt(fd, static_cast<struct v4l2_format *>(arg));\n \t\tbreak;\n+\tcase VIDIOC_G_PRIORITY:\n+\t\tret = vidioc_g_priority(fd, static_cast<enum v4l2_priority *>(arg));\n+\t\tbreak;\n+\tcase VIDIOC_S_PRIORITY:\n+\t\tret = vidioc_s_priority(fd, static_cast<enum v4l2_priority *>(arg));\n+\t\tbreak;\n \tcase VIDIOC_REQBUFS:\n \t\tret = vidioc_reqbufs(fd, 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 90e518c..a0c373d 100644\n--- a/src/v4l2/v4l2_camera_proxy.h\n+++ b/src/v4l2/v4l2_camera_proxy.h\n@@ -49,6 +49,8 @@ private:\n \tint vidioc_g_fmt(int fd, struct v4l2_format *arg);\n \tint vidioc_s_fmt(int fd, struct v4l2_format *arg);\n \tint vidioc_try_fmt(int fd, struct v4l2_format *arg);\n+\tint vidioc_g_priority(int fd, enum v4l2_priority *arg);\n+\tint vidioc_s_priority(int fd, enum v4l2_priority *arg);\n \tint vidioc_reqbufs(int fd, struct v4l2_requestbuffers *arg);\n \tint vidioc_querybuf(int fd, struct v4l2_buffer *arg);\n \tint vidioc_qbuf(int fd, struct v4l2_buffer *arg);\n@@ -84,6 +86,8 @@ private:\n \tint efd_;\n \n \tstd::map<int, bool> nonBlockingFds_;\n+\tstd::map<int, enum v4l2_priority> priorities_;\n+\tint v4l2RecordPriorityFd_;\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",
        "04/15"
    ]
}