Show a patch.

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

{
    "id": 24131,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/24131/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/24131/",
    "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": "<20250815113400.20623-2-laurent.pinchart@ideasonboard.com>",
    "date": "2025-08-15T11:33:53",
    "name": "[v2,1/8] libcamera: v4l2_videodevice: Avoid repeated calls to FrameBuffer::planes()",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "3ac5b2a68d4e547a60cfefa567cbd2ea35a3262c",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/24131/mbox/",
    "series": [
        {
            "id": 5383,
            "url": "https://patchwork.libcamera.org/api/1.1/series/5383/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5383",
            "date": "2025-08-15T11:33:52",
            "name": "libcamera: Use span in FrameBuffer & assorted cleanups",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/5383/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/24131/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/24131/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 857D7BEFBE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 15 Aug 2025 11:34:28 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E7C806925E;\n\tFri, 15 Aug 2025 13:34:23 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DE45861443\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 15 Aug 2025 13:34:21 +0200 (CEST)",
            "from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id E1287605;\n\tFri, 15 Aug 2025 13:33:26 +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=\"Ef4jFpon\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1755257607;\n\tbh=yRAxsrQ6ipP0IxLlpZKKaiJQ3ujWO9s1cmAAiPwGlHE=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=Ef4jFponHfCvA9TDD0+VJYHW1YKB/qIZ5xas87iWkHQicXo3Zb0RMHCpzMnmTZRZm\n\ttEivEKNIosLkt5rgthOQ4RU28mCS6U7N5WkC3BFz8ksqDlTcGR87Cg+VLHbfN5qkYY\n\tkz05fbWhhjx0amyHTImgQ9yj1Nz/NsNf2Ho3JPsc=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "=?utf-8?q?Daniel_R=C3=A1kos?= <daniel.rakos@rastergrid.com>",
        "Subject": "[PATCH v2 1/8] libcamera: v4l2_videodevice: Avoid repeated calls to\n\tFrameBuffer::planes()",
        "Date": "Fri, 15 Aug 2025 14:33:53 +0300",
        "Message-ID": "<20250815113400.20623-2-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.49.1",
        "In-Reply-To": "<20250815113400.20623-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20250815113400.20623-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "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 V4L2VideoDevice::dequeueBuffer() calls buffer->planes() multiple\ntimes. Store the planes array in a local variable to make this more\nefficient.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/v4l2_videodevice.cpp | 9 +++++----\n 1 file changed, 5 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\nindex 5b3530b4e542..ba1889a939cb 100644\n--- a/src/libcamera/v4l2_videodevice.cpp\n+++ b/src/libcamera/v4l2_videodevice.cpp\n@@ -1909,9 +1909,10 @@ FrameBuffer *V4L2VideoDevice::dequeueBuffer()\n \t}\n \tmetadata.sequence -= firstFrame_.value();\n \n+\tconst std::vector<FrameBuffer::Plane> &framebufferPlanes = buffer->planes();\n \tunsigned int numV4l2Planes = multiPlanar ? buf.length : 1;\n \n-\tif (numV4l2Planes != buffer->planes().size()) {\n+\tif (numV4l2Planes != framebufferPlanes.size()) {\n \t\t/*\n \t\t * If we have a multi-planar buffer with a V4L2\n \t\t * single-planar format, split the V4L2 buffer across\n@@ -1921,7 +1922,7 @@ FrameBuffer *V4L2VideoDevice::dequeueBuffer()\n \t\tif (numV4l2Planes != 1) {\n \t\t\tLOG(V4L2, Error)\n \t\t\t\t<< \"Invalid number of planes (\" << numV4l2Planes\n-\t\t\t\t<< \" != \" << buffer->planes().size() << \")\";\n+\t\t\t\t<< \" != \" << framebufferPlanes.size() << \")\";\n \n \t\t\tmetadata.status = FrameMetadata::FrameError;\n \t\t\treturn buffer;\n@@ -1938,12 +1939,12 @@ FrameBuffer *V4L2VideoDevice::dequeueBuffer()\n \t\t\t\t       : buf.bytesused;\n \t\tunsigned int remaining = bytesused;\n \n-\t\tfor (auto [i, plane] : utils::enumerate(buffer->planes())) {\n+\t\tfor (auto [i, plane] : utils::enumerate(framebufferPlanes)) {\n \t\t\tif (!remaining) {\n \t\t\t\tLOG(V4L2, Error)\n \t\t\t\t\t<< \"Dequeued buffer (\" << bytesused\n \t\t\t\t\t<< \" bytes) too small for plane lengths \"\n-\t\t\t\t\t<< utils::join(buffer->planes(), \"/\",\n+\t\t\t\t\t<< utils::join(framebufferPlanes, \"/\",\n \t\t\t\t\t\t       [](const FrameBuffer::Plane &p) {\n \t\t\t\t\t\t\t       return p.length;\n \t\t\t\t\t\t       });\n",
    "prefixes": [
        "v2",
        "1/8"
    ]
}