Show a patch.

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

{
    "id": 27089,
    "url": "https://patchwork.libcamera.org/api/patches/27089/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/27089/",
    "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": "<20260629163017.863145-11-barnabas.pocze@ideasonboard.com>",
    "date": "2026-06-29T16:29:33",
    "name": "[RFC,v1,10/54] v4l2: v4l2_camera_proxy: Remove `bufferCount_`",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "16ea8d5f40e6b094a2ecbae58d19cad0d6dea656",
    "submitter": {
        "id": 216,
        "url": "https://patchwork.libcamera.org/api/people/216/?format=api",
        "name": "Barnabás Pőcze",
        "email": "barnabas.pocze@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/27089/mbox/",
    "series": [
        {
            "id": 6025,
            "url": "https://patchwork.libcamera.org/api/series/6025/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=6025",
            "date": "2026-06-29T16:29:23",
            "name": "libcamera: Split requests and buffers",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/6025/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/27089/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/27089/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 C6D35C3261\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 29 Jun 2026 16:30:53 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 644CD65F80;\n\tMon, 29 Jun 2026 18:30:38 +0200 (CEST)",
            "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 10A0B65F30\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 29 Jun 2026 18:30:23 +0200 (CEST)",
            "from pb-laptop.local (185.221.140.128.nat.pool.zt.hu\n\t[185.221.140.128])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E1E8E12D6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 29 Jun 2026 18:29:39 +0200 (CEST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"pEvNkkSr\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1782750580;\n\tbh=aan4wQ65l6eE6m4pO2bt+MtuqPUHjFp7LdA2bFqlQ+s=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=pEvNkkSrEz/8UsxcoQpgDc4CnPvukMrp58FeE9IlH91/f/RKuo/QQc2vGfzFJe7AF\n\tXllDChZWhyNGDVATNy2+qjaXzDj9ba9xRQBsW9YI87o8XgC4DXgPMI+vzdYM5IE9IT\n\taNExzt0Tu83MIlGafkUr52stTcbLWBvrabOPMGZg=",
        "From": "=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Subject": "[RFC PATCH v1 10/54] v4l2: v4l2_camera_proxy: Remove `bufferCount_`",
        "Date": "Mon, 29 Jun 2026 18:29:33 +0200",
        "Message-ID": "<20260629163017.863145-11-barnabas.pocze@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.54.0",
        "In-Reply-To": "<20260629163017.863145-1-barnabas.pocze@ideasonboard.com>",
        "References": "<20260629163017.863145-1-barnabas.pocze@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "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>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "The field always has the same value as `buffers_.size()`, so use that.\n\nSigned-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n---\n src/v4l2/v4l2_camera_proxy.cpp | 22 ++++++++++------------\n src/v4l2/v4l2_camera_proxy.h   |  1 -\n 2 files changed, 10 insertions(+), 13 deletions(-)",
    "diff": "diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp\nindex b4f06c1c51..94c0006cf3 100644\n--- a/src/v4l2/v4l2_camera_proxy.cpp\n+++ b/src/v4l2/v4l2_camera_proxy.cpp\n@@ -41,7 +41,7 @@ LOG_DECLARE_CATEGORY(V4L2Compat)\n \n 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: refcount_(0), index_(index), currentBuf_(0),\n \t  vcam_(std::make_unique<V4L2Camera>(camera)), owner_(nullptr)\n {\n \tquerycap(camera);\n@@ -393,7 +393,7 @@ int V4L2CameraProxy::vidioc_s_fmt(V4L2CameraFile *file, struct v4l2_format *arg)\n \tSize size(arg->fmt.pix.width, arg->fmt.pix.height);\n \tV4L2PixelFormat v4l2Format = V4L2PixelFormat(arg->fmt.pix.pixelformat);\n \tret = vcam_->configure(&streamConfig_, size, v4l2Format.toPixelFormat(),\n-\t\t\t       bufferCount_);\n+\t\t\t       buffers_.size());\n \tif (ret < 0)\n \t\treturn -EINVAL;\n \n@@ -495,7 +495,6 @@ void V4L2CameraProxy::freeBuffers()\n {\n \tvcam_->freeBuffers();\n \tbuffers_.clear();\n-\tbufferCount_ = 0;\n }\n \n int V4L2CameraProxy::vidioc_reqbufs(V4L2CameraFile *file, struct v4l2_requestbuffers *arg)\n@@ -533,7 +532,7 @@ int V4L2CameraProxy::vidioc_reqbufs(V4L2CameraFile *file, struct v4l2_requestbuf\n \t\treturn 0;\n \t}\n \n-\tif (bufferCount_ > 0)\n+\tif (!buffers_.empty())\n \t\tfreeBuffers();\n \n \tSize size(v4l2PixFormat_.width, v4l2PixFormat_.height);\n@@ -546,7 +545,6 @@ int V4L2CameraProxy::vidioc_reqbufs(V4L2CameraFile *file, struct v4l2_requestbuf\n \tsetFmtFromConfig(streamConfig_);\n \n \targ->count = streamConfig_.bufferCount;\n-\tbufferCount_ = arg->count;\n \n \tret = vcam_->allocBuffers(arg->count);\n \tif (ret < 0) {\n@@ -579,7 +577,7 @@ int V4L2CameraProxy::vidioc_querybuf(V4L2CameraFile *file, struct v4l2_buffer *a\n \tLOG(V4L2Compat, Debug)\n \t\t<< \"[\" << file->description() << \"] \" << __func__ << \"()\";\n \n-\tif (arg->index >= bufferCount_)\n+\tif (arg->index >= buffers_.size())\n \t\treturn -EINVAL;\n \n \tif (!validateBufferType(arg->type))\n@@ -601,7 +599,7 @@ int V4L2CameraProxy::vidioc_prepare_buf(V4L2CameraFile *file, struct v4l2_buffer\n \tif (!hasOwnership(file))\n \t\treturn -EBUSY;\n \n-\tif (arg->index >= bufferCount_)\n+\tif (arg->index >= buffers_.size())\n \t\treturn -EINVAL;\n \n \tif (arg->flags & V4L2_BUF_FLAG_REQUEST_FD)\n@@ -630,7 +628,7 @@ int V4L2CameraProxy::vidioc_qbuf(V4L2CameraFile *file, struct v4l2_buffer *arg)\n \t\t<< \"[\" << file->description() << \"] \" << __func__\n \t\t<< \"(index=\" << arg->index << \")\";\n \n-\tif (arg->index >= bufferCount_)\n+\tif (arg->index >= buffers_.size())\n \t\treturn -EINVAL;\n \n \tif (buffers_[arg->index].flags & V4L2_BUF_FLAG_QUEUED)\n@@ -660,7 +658,7 @@ int V4L2CameraProxy::vidioc_dqbuf(V4L2CameraFile *file, struct v4l2_buffer *arg,\n \tLOG(V4L2Compat, Debug)\n \t\t<< \"[\" << file->description() << \"] \" << __func__ << \"()\";\n \n-\tif (arg->index >= bufferCount_)\n+\tif (arg->index >= buffers_.size())\n \t\treturn -EINVAL;\n \n \tif (!hasOwnership(file))\n@@ -695,7 +693,7 @@ int V4L2CameraProxy::vidioc_dqbuf(V4L2CameraFile *file, struct v4l2_buffer *arg,\n \tbuf.length = sizeimage_;\n \t*arg = buf;\n \n-\tcurrentBuf_ = (currentBuf_ + 1) % bufferCount_;\n+\tcurrentBuf_ = (currentBuf_ + 1) % buffers_.size();\n \n \tuint64_t data;\n \tint ret = ::read(file->efd(), &data, sizeof(data));\n@@ -717,7 +715,7 @@ int V4L2CameraProxy::vidioc_expbuf(V4L2CameraFile *file, struct v4l2_exportbuffe\n \tif (!validateBufferType(arg->type))\n \t\treturn -EINVAL;\n \n-\tif (arg->index >= bufferCount_)\n+\tif (arg->index >= buffers_.size())\n \t\treturn -EINVAL;\n \n \tif (arg->flags & ~(O_CLOEXEC | O_ACCMODE))\n@@ -737,7 +735,7 @@ int V4L2CameraProxy::vidioc_streamon(V4L2CameraFile *file, int *arg)\n \tLOG(V4L2Compat, Debug)\n \t\t<< \"[\" << file->description() << \"] \" << __func__ << \"()\";\n \n-\tif (bufferCount_ == 0)\n+\tif (buffers_.empty())\n \t\treturn -EINVAL;\n \n \tif (!validateBufferType(*arg))\ndiff --git a/src/v4l2/v4l2_camera_proxy.h b/src/v4l2/v4l2_camera_proxy.h\nindex 5aa352c36f..6ef23fd82c 100644\n--- a/src/v4l2/v4l2_camera_proxy.h\n+++ b/src/v4l2/v4l2_camera_proxy.h\n@@ -80,7 +80,6 @@ private:\n \tunsigned int index_;\n \n \tlibcamera::StreamConfiguration streamConfig_;\n-\tunsigned int bufferCount_;\n \tunsigned int currentBuf_;\n \tunsigned int sizeimage_;\n \n",
    "prefixes": [
        "RFC",
        "v1",
        "10/54"
    ]
}