Show a patch.

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

{
    "id": 24095,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/24095/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/24095/",
    "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": "<20250812172310.17441-1-laurent.pinchart@ideasonboard.com>",
    "date": "2025-08-12T17:23:10",
    "name": "libcamera: framebuffer: Replace vector with span in constructor",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "75b84343cd8f3d509c787b00ce170e278b8a50b3",
    "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/24095/mbox/",
    "series": [
        {
            "id": 5370,
            "url": "https://patchwork.libcamera.org/api/1.1/series/5370/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5370",
            "date": "2025-08-12T17:23:10",
            "name": "libcamera: framebuffer: Replace vector with span in constructor",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/5370/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/24095/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/24095/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 1FC50BEFBE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 12 Aug 2025 17:23:32 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4B5596921B;\n\tTue, 12 Aug 2025 19:23:31 +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 286666921A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 12 Aug 2025 19:23:29 +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 040DD4A4;\n\tTue, 12 Aug 2025 19:22:35 +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=\"s/1WLveA\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1755019356;\n\tbh=2jZ8wX4rztGOO3uj2DVqBc2kfBXcxkc401xxrV/RJvw=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=s/1WLveA/xi3VO+YQaY1c77+0sryPFf+9O4rn3FzsLbAs6YpWs5pc1ZgyCLNczgBS\n\tJI/2tqNZ6FwntnX+ezzUgumyrPfjavn8kyKr46iM8kqVIYao2SAntBwdJGhwvFkCHG\n\t3bK/c8/aaUl82EBdF9gTW71mqvp6GjoTgNlPRD9w=",
        "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] libcamera: framebuffer: Replace vector with span in\n\tconstructor",
        "Date": "Tue, 12 Aug 2025 20:23:10 +0300",
        "Message-ID": "<20250812172310.17441-1-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.49.1",
        "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 FrameBuffer constructor takes a list of planes as an std::vector.\nThe caller may stores the planes in a different type of container,\nresulting in the needless allocation of a temporary vector. Replace it\nwith a span.\n\nSuggested-by: Daniel Rákos <daniel.rakos@rastergrid.com>\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/framebuffer.h                   | 2 +-\n include/libcamera/internal/framebuffer.h          | 3 ++-\n src/android/mm/cros_frame_buffer_allocator.cpp    | 2 +-\n src/android/mm/generic_frame_buffer_allocator.cpp | 2 +-\n src/libcamera/framebuffer.cpp                     | 8 ++++----\n 5 files changed, 9 insertions(+), 8 deletions(-)\n\n\nbase-commit: aa0a91c48ddb38c302390d5c4899cb9e093ddd24",
    "diff": "diff --git a/include/libcamera/framebuffer.h b/include/libcamera/framebuffer.h\nindex e83825b466aa..653c1a96132f 100644\n--- a/include/libcamera/framebuffer.h\n+++ b/include/libcamera/framebuffer.h\n@@ -58,7 +58,7 @@ public:\n \t\tunsigned int length;\n \t};\n \n-\tFrameBuffer(const std::vector<Plane> &planes, unsigned int cookie = 0);\n+\tFrameBuffer(Span<const Plane> planes, unsigned int cookie = 0);\n \tFrameBuffer(std::unique_ptr<Private> d);\n \tvirtual ~FrameBuffer() {}\n \ndiff --git a/include/libcamera/internal/framebuffer.h b/include/libcamera/internal/framebuffer.h\nindex 97b49d42063f..67b090fc307f 100644\n--- a/include/libcamera/internal/framebuffer.h\n+++ b/include/libcamera/internal/framebuffer.h\n@@ -12,6 +12,7 @@\n #include <utility>\n \n #include <libcamera/base/class.h>\n+#include <libcamera/base/span.h>\n \n #include <libcamera/fence.h>\n #include <libcamera/framebuffer.h>\n@@ -23,7 +24,7 @@ class FrameBuffer::Private : public Extensible::Private\n \tLIBCAMERA_DECLARE_PUBLIC(FrameBuffer)\n \n public:\n-\tPrivate(const std::vector<Plane> &planes, uint64_t cookie = 0);\n+\tPrivate(Span<const Plane> planes, uint64_t cookie = 0);\n \tvirtual ~Private();\n \n \tvoid setRequest(Request *request) { request_ = request; }\ndiff --git a/src/android/mm/cros_frame_buffer_allocator.cpp b/src/android/mm/cros_frame_buffer_allocator.cpp\nindex 264c0d481272..7ec116e1500d 100644\n--- a/src/android/mm/cros_frame_buffer_allocator.cpp\n+++ b/src/android/mm/cros_frame_buffer_allocator.cpp\n@@ -29,7 +29,7 @@ class CrosFrameBufferData : public FrameBuffer::Private\n \n public:\n \tCrosFrameBufferData(cros::ScopedBufferHandle scopedHandle,\n-\t\t\t    const std::vector<FrameBuffer::Plane> &planes)\n+\t\t\t    Span<const FrameBuffer::Plane> planes)\n \t\t: FrameBuffer::Private(planes), scopedHandle_(std::move(scopedHandle))\n \t{\n \t}\ndiff --git a/src/android/mm/generic_frame_buffer_allocator.cpp b/src/android/mm/generic_frame_buffer_allocator.cpp\nindex 79625a9a3c75..25ad6b035e73 100644\n--- a/src/android/mm/generic_frame_buffer_allocator.cpp\n+++ b/src/android/mm/generic_frame_buffer_allocator.cpp\n@@ -35,7 +35,7 @@ class GenericFrameBufferData : public FrameBuffer::Private\n public:\n \tGenericFrameBufferData(struct alloc_device_t *allocDevice,\n \t\t\t       buffer_handle_t handle,\n-\t\t\t       const std::vector<FrameBuffer::Plane> &planes)\n+\t\t\t       Span<const FrameBuffer::Plane> planes)\n \t\t: FrameBuffer::Private(planes), allocDevice_(allocDevice),\n \t\t  handle_(handle)\n \t{\ndiff --git a/src/libcamera/framebuffer.cpp b/src/libcamera/framebuffer.cpp\nindex 219db50d6527..cb849b8e40fe 100644\n--- a/src/libcamera/framebuffer.cpp\n+++ b/src/libcamera/framebuffer.cpp\n@@ -130,9 +130,9 @@ LOG_DEFINE_CATEGORY(Buffer)\n  * \\param[in] planes The frame memory planes\n  * \\param[in] cookie Cookie\n  */\n-FrameBuffer::Private::Private(const std::vector<Plane> &planes, uint64_t cookie)\n-\t: planes_(planes), cookie_(cookie), request_(nullptr),\n-\t  isContiguous_(true)\n+FrameBuffer::Private::Private(Span<const Plane> planes, uint64_t cookie)\n+\t: planes_(std::begin(planes), std::end(planes)), cookie_(cookie),\n+\t  request_(nullptr), isContiguous_(true)\n {\n \tmetadata_.planes_.resize(planes_.size());\n }\n@@ -315,7 +315,7 @@ ino_t fileDescriptorInode(const SharedFD &fd)\n  * \\param[in] planes The frame memory planes\n  * \\param[in] cookie Cookie\n  */\n-FrameBuffer::FrameBuffer(const std::vector<Plane> &planes, unsigned int cookie)\n+FrameBuffer::FrameBuffer(Span<const Plane> planes, unsigned int cookie)\n \t: FrameBuffer(std::make_unique<Private>(planes, cookie))\n {\n }\n",
    "prefixes": []
}