[{"id":35361,"web_url":"https://patchwork.libcamera.org/comment/35361/","msgid":"<175502020250.560048.7934780625017482883@ping.linuxembedded.co.uk>","date":"2025-08-12T17:36:42","subject":"Re: [PATCH] libcamera: framebuffer: Replace vector with span in\n\tconstructor","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Laurent Pinchart (2025-08-12 18:23:10)\n> The FrameBuffer constructor takes a list of planes as an std::vector.\n> The caller may stores the planes in a different type of container,\n> resulting in the needless allocation of a temporary vector. Replace it\n> with a span.\n> \n> Suggested-by: Daniel Rákos <daniel.rakos@rastergrid.com>\n> Signed-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> diff --git a/include/libcamera/framebuffer.h b/include/libcamera/framebuffer.h\n> index e83825b466aa..653c1a96132f 100644\n> --- a/include/libcamera/framebuffer.h\n> +++ b/include/libcamera/framebuffer.h\n> @@ -58,7 +58,7 @@ public:\n>                 unsigned int length;\n>         };\n>  \n> -       FrameBuffer(const std::vector<Plane> &planes, unsigned int cookie = 0);\n> +       FrameBuffer(Span<const Plane> planes, unsigned int cookie = 0);\n\nPublic ABI change?\n\n\nAlthough it's probably API compatible when recompiled anyway.\n\nWe need some tag to highlight these for the release notes ideally but\nAPI/ABI breakage window is open so:\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n\n>         FrameBuffer(std::unique_ptr<Private> d);\n>         virtual ~FrameBuffer() {}\n>  \n> diff --git a/include/libcamera/internal/framebuffer.h b/include/libcamera/internal/framebuffer.h\n> index 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>         LIBCAMERA_DECLARE_PUBLIC(FrameBuffer)\n>  \n>  public:\n> -       Private(const std::vector<Plane> &planes, uint64_t cookie = 0);\n> +       Private(Span<const Plane> planes, uint64_t cookie = 0);\n>         virtual ~Private();\n>  \n>         void setRequest(Request *request) { request_ = request; }\n> diff --git a/src/android/mm/cros_frame_buffer_allocator.cpp b/src/android/mm/cros_frame_buffer_allocator.cpp\n> index 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>         CrosFrameBufferData(cros::ScopedBufferHandle scopedHandle,\n> -                           const std::vector<FrameBuffer::Plane> &planes)\n> +                           Span<const FrameBuffer::Plane> planes)\n>                 : FrameBuffer::Private(planes), scopedHandle_(std::move(scopedHandle))\n>         {\n>         }\n> diff --git a/src/android/mm/generic_frame_buffer_allocator.cpp b/src/android/mm/generic_frame_buffer_allocator.cpp\n> index 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>         GenericFrameBufferData(struct alloc_device_t *allocDevice,\n>                                buffer_handle_t handle,\n> -                              const std::vector<FrameBuffer::Plane> &planes)\n> +                              Span<const FrameBuffer::Plane> planes)\n>                 : FrameBuffer::Private(planes), allocDevice_(allocDevice),\n>                   handle_(handle)\n>         {\n> diff --git a/src/libcamera/framebuffer.cpp b/src/libcamera/framebuffer.cpp\n> index 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> -       : planes_(planes), cookie_(cookie), request_(nullptr),\n> -         isContiguous_(true)\n> +FrameBuffer::Private::Private(Span<const Plane> planes, uint64_t cookie)\n> +       : planes_(std::begin(planes), std::end(planes)), cookie_(cookie),\n> +         request_(nullptr), isContiguous_(true)\n>  {\n>         metadata_.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>         : FrameBuffer(std::make_unique<Private>(planes, cookie))\n>  {\n>  }\n> \n> base-commit: aa0a91c48ddb38c302390d5c4899cb9e093ddd24\n> -- \n> Regards,\n> \n> Laurent Pinchart\n>","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 BC567BDCC1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 12 Aug 2025 17:36:47 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B02FC69249;\n\tTue, 12 Aug 2025 19:36:46 +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 4B3ED6921A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 12 Aug 2025 19:36:45 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 1E9254A4;\n\tTue, 12 Aug 2025 19:35:52 +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=\"us6XCSTq\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1755020152;\n\tbh=Gi82APpHxCQdxIO1OMdc8viHw8PEiDUpzAFzloWqyHo=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=us6XCSTqR7l50YOGsrEPW6W2vmQ07h0dxWG05ZRdujfzM2c7HBA0RxPB3jFDWv4ix\n\tKX3lAeirg0rUn3O3vG4oWy0D/ZmanEBTynFtdwStftKzZF4zol9pNLT/wacr7uFpy+\n\tX1On2DQEx85nfQGKANcBh5V5sk6MAxKBVFwqqgIg=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20250812172310.17441-1-laurent.pinchart@ideasonboard.com>","References":"<20250812172310.17441-1-laurent.pinchart@ideasonboard.com>","Subject":"Re: [PATCH] libcamera: framebuffer: Replace vector with span in\n\tconstructor","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"Daniel =?utf-8?b?UsOha29z?= <daniel.rakos@rastergrid.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Tue, 12 Aug 2025 18:36:42 +0100","Message-ID":"<175502020250.560048.7934780625017482883@ping.linuxembedded.co.uk>","User-Agent":"alot/0.9.1","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>"}},{"id":35362,"web_url":"https://patchwork.libcamera.org/comment/35362/","msgid":"<20250812192240.GA25073@pendragon.ideasonboard.com>","date":"2025-08-12T19:22:40","subject":"Re: [PATCH] libcamera: framebuffer: Replace vector with span in\n\tconstructor","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Tue, Aug 12, 2025 at 06:36:42PM +0100, Kieran Bingham wrote:\n> Quoting Laurent Pinchart (2025-08-12 18:23:10)\n> > The FrameBuffer constructor takes a list of planes as an std::vector.\n> > The caller may stores the planes in a different type of container,\n> > resulting in the needless allocation of a temporary vector. Replace it\n> > with a span.\n> > \n> > Suggested-by: Daniel Rákos <daniel.rakos@rastergrid.com>\n> > Signed-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> > diff --git a/include/libcamera/framebuffer.h b/include/libcamera/framebuffer.h\n> > index e83825b466aa..653c1a96132f 100644\n> > --- a/include/libcamera/framebuffer.h\n> > +++ b/include/libcamera/framebuffer.h\n> > @@ -58,7 +58,7 @@ public:\n> >                 unsigned int length;\n> >         };\n> >  \n> > -       FrameBuffer(const std::vector<Plane> &planes, unsigned int cookie = 0);\n> > +       FrameBuffer(Span<const Plane> planes, unsigned int cookie = 0);\n> \n> Public ABI change?\n\nYes.\n\n> Although it's probably API compatible when recompiled anyway.\n\nIt should be, yes. And dynamic linking will fail as the symbol name\nchanges, so you won't get weird crashes.\n\n> We need some tag to highlight these for the release notes ideally but\n> API/ABI breakage window is open so:\n> \n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> \n> >         FrameBuffer(std::unique_ptr<Private> d);\n> >         virtual ~FrameBuffer() {}\n> >  \n> > diff --git a/include/libcamera/internal/framebuffer.h b/include/libcamera/internal/framebuffer.h\n> > index 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> >         LIBCAMERA_DECLARE_PUBLIC(FrameBuffer)\n> >  \n> >  public:\n> > -       Private(const std::vector<Plane> &planes, uint64_t cookie = 0);\n> > +       Private(Span<const Plane> planes, uint64_t cookie = 0);\n> >         virtual ~Private();\n> >  \n> >         void setRequest(Request *request) { request_ = request; }\n> > diff --git a/src/android/mm/cros_frame_buffer_allocator.cpp b/src/android/mm/cros_frame_buffer_allocator.cpp\n> > index 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> >         CrosFrameBufferData(cros::ScopedBufferHandle scopedHandle,\n> > -                           const std::vector<FrameBuffer::Plane> &planes)\n> > +                           Span<const FrameBuffer::Plane> planes)\n> >                 : FrameBuffer::Private(planes), scopedHandle_(std::move(scopedHandle))\n> >         {\n> >         }\n> > diff --git a/src/android/mm/generic_frame_buffer_allocator.cpp b/src/android/mm/generic_frame_buffer_allocator.cpp\n> > index 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> >         GenericFrameBufferData(struct alloc_device_t *allocDevice,\n> >                                buffer_handle_t handle,\n> > -                              const std::vector<FrameBuffer::Plane> &planes)\n> > +                              Span<const FrameBuffer::Plane> planes)\n> >                 : FrameBuffer::Private(planes), allocDevice_(allocDevice),\n> >                   handle_(handle)\n> >         {\n> > diff --git a/src/libcamera/framebuffer.cpp b/src/libcamera/framebuffer.cpp\n> > index 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> > -       : planes_(planes), cookie_(cookie), request_(nullptr),\n> > -         isContiguous_(true)\n> > +FrameBuffer::Private::Private(Span<const Plane> planes, uint64_t cookie)\n> > +       : planes_(std::begin(planes), std::end(planes)), cookie_(cookie),\n> > +         request_(nullptr), isContiguous_(true)\n> >  {\n> >         metadata_.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> >         : FrameBuffer(std::make_unique<Private>(planes, cookie))\n> >  {\n> >  }\n> > \n> > base-commit: aa0a91c48ddb38c302390d5c4899cb9e093ddd24","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 E7B7CBEFBE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 12 Aug 2025 19:23:02 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6436B69249;\n\tTue, 12 Aug 2025 21:23:01 +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 463B76921A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 12 Aug 2025 21:22:59 +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 E8C7D4A4;\n\tTue, 12 Aug 2025 21:22:05 +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=\"OLBwmfmF\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1755026526;\n\tbh=5QaK5WXfQ0WNVYBANzoRE6hTUD3f9oGwieBbdiHwT24=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=OLBwmfmFxw7qhhZa4vHzB6SzUnP9hx4AKEXeKSVjuB3VS84yCo5x8ooN0092gGaDU\n\t3ySLUAGzT+TLhZc5pCuHYrVYd3rJU5K9yVfAK8TASCFoX7L12Ylq8maDMzp4GC+bry\n\tmtSm9L5zF39+0WQJP50F1eMrgWbamDh7iCRB8T9Y=","Date":"Tue, 12 Aug 2025 22:22:40 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org, Daniel =?utf-8?b?UsOha29z?=\n\t<daniel.rakos@rastergrid.com>","Subject":"Re: [PATCH] libcamera: framebuffer: Replace vector with span in\n\tconstructor","Message-ID":"<20250812192240.GA25073@pendragon.ideasonboard.com>","References":"<20250812172310.17441-1-laurent.pinchart@ideasonboard.com>\n\t<175502020250.560048.7934780625017482883@ping.linuxembedded.co.uk>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<175502020250.560048.7934780625017482883@ping.linuxembedded.co.uk>","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>"}},{"id":35364,"web_url":"https://patchwork.libcamera.org/comment/35364/","msgid":"<babdbaf4-b866-4396-88bb-96cb6826f4fc@ideasonboard.com>","date":"2025-08-13T07:00:23","subject":"Re: [PATCH] libcamera: framebuffer: Replace vector with span in\n\tconstructor","submitter":{"id":216,"url":"https://patchwork.libcamera.org/api/people/216/","name":"Barnabás Pőcze","email":"barnabas.pocze@ideasonboard.com"},"content":"2025. 08. 12. 19:23 keltezéssel, Laurent Pinchart írta:\n> The FrameBuffer constructor takes a list of planes as an std::vector.\n> The caller may stores the planes in a different type of container,\n> resulting in the needless allocation of a temporary vector. Replace it\n> with a span.\n> \n> Suggested-by: Daniel Rákos <daniel.rakos@rastergrid.com>\n> Signed-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> diff --git a/include/libcamera/framebuffer.h b/include/libcamera/framebuffer.h\n> index 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>   \n> diff --git a/include/libcamera/internal/framebuffer.h b/include/libcamera/internal/framebuffer.h\n> index 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; }\n> diff --git a/src/android/mm/cros_frame_buffer_allocator.cpp b/src/android/mm/cros_frame_buffer_allocator.cpp\n> index 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}\n> diff --git a/src/android/mm/generic_frame_buffer_allocator.cpp b/src/android/mm/generic_frame_buffer_allocator.cpp\n> index 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{\n> diff --git a/src/libcamera/framebuffer.cpp b/src/libcamera/framebuffer.cpp\n> index 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\nWhat was the motivation for using `std::{begin,end}()` instead of\n`planes.{begin,end}()`?\n\nReviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n\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> \n> base-commit: aa0a91c48ddb38c302390d5c4899cb9e093ddd24","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 8A0E8BEFBE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 13 Aug 2025 07:00:29 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8C48769249;\n\tWed, 13 Aug 2025 09:00:28 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id BB44B61443\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 13 Aug 2025 09:00:26 +0200 (CEST)","from [192.168.33.21] (185.221.141.188.nat.pool.zt.hu\n\t[185.221.141.188])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 67B5B346;\n\tWed, 13 Aug 2025 08:59:33 +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=\"rmbhdyaT\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1755068373;\n\tbh=lWcLU/f4BeNzV+IE/dOIk6gtahMnVgdrxNsz+jGK8bE=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=rmbhdyaThIx5BPkd8tuqdLKvZSPoH4QrqjgAEqyKIyXniIwBrzLMDcg8svYiI+Z8u\n\totueZH3oLvfgWnpmkhFbORozTkS6K/AWyA3ceoVI+nKttDIZhSdmIQtNdq5BMcOXdr\n\tpODXJ1erhPA68EDdpNjSl3s50ADcRcX+FNpulsv0=","Message-ID":"<babdbaf4-b866-4396-88bb-96cb6826f4fc@ideasonboard.com>","Date":"Wed, 13 Aug 2025 09:00:23 +0200","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH] libcamera: framebuffer: Replace vector with span in\n\tconstructor","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Cc":"=?utf-8?q?Daniel_R=C3=A1kos?= <daniel.rakos@rastergrid.com>","References":"<20250812172310.17441-1-laurent.pinchart@ideasonboard.com>","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Content-Language":"en-US, hu-HU","In-Reply-To":"<20250812172310.17441-1-laurent.pinchart@ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","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>"}},{"id":35372,"web_url":"https://patchwork.libcamera.org/comment/35372/","msgid":"<20250813104009.GD6440@pendragon.ideasonboard.com>","date":"2025-08-13T10:40:09","subject":"Re: [PATCH] libcamera: framebuffer: Replace vector with span in\n\tconstructor","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Wed, Aug 13, 2025 at 09:00:23AM +0200, Barnabás Pőcze wrote:\n> 2025. 08. 12. 19:23 keltezéssel, Laurent Pinchart írta:\n> > The FrameBuffer constructor takes a list of planes as an std::vector.\n> > The caller may stores the planes in a different type of container,\n> > resulting in the needless allocation of a temporary vector. Replace it\n> > with a span.\n> > \n> > Suggested-by: Daniel Rákos <daniel.rakos@rastergrid.com>\n> > Signed-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> > diff --git a/include/libcamera/framebuffer.h b/include/libcamera/framebuffer.h\n> > index 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> >   \n> > diff --git a/include/libcamera/internal/framebuffer.h b/include/libcamera/internal/framebuffer.h\n> > index 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; }\n> > diff --git a/src/android/mm/cros_frame_buffer_allocator.cpp b/src/android/mm/cros_frame_buffer_allocator.cpp\n> > index 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}\n> > diff --git a/src/android/mm/generic_frame_buffer_allocator.cpp b/src/android/mm/generic_frame_buffer_allocator.cpp\n> > index 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{\n> > diff --git a/src/libcamera/framebuffer.cpp b/src/libcamera/framebuffer.cpp\n> > index 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> \n> What was the motivation for using `std::{begin,end}()` instead of\n> `planes.{begin,end}()`?\n\nNone :-) If you think planes.begin() and planes.end() are better I can\nupdate the patch.\n\n> Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n> \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> > \n> > base-commit: aa0a91c48ddb38c302390d5c4899cb9e093ddd24","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 1F7F4BEFBE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 13 Aug 2025 10:40:31 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8B2C66924A;\n\tWed, 13 Aug 2025 12:40:30 +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 B9A9169249\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 13 Aug 2025 12:40:28 +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 245D82EC;\n\tWed, 13 Aug 2025 12:39: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=\"O1J5ak3r\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1755081575;\n\tbh=wbA8dZTlTs8n27x8vrZ3BdGpaDQg8wnS6yL2ehiGT8o=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=O1J5ak3rnuPFw87CCKfIVTex3Up1GqlfzS8p7cBeDDbK3nzUL/5ktPzVWqvXT04Jg\n\tImuJe/5oxhPM4rpwuynUT4mhO64vGGu/qRcgqXWKNZZ6rZuptaSnKSn6CYfeL3ppsN\n\t+JolPyKnsh7JonIK6FrsncjxyuPt3YiJPtai/hBc=","Date":"Wed, 13 Aug 2025 13:40:09 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org, Daniel =?utf-8?b?UsOha29z?=\n\t<daniel.rakos@rastergrid.com>","Subject":"Re: [PATCH] libcamera: framebuffer: Replace vector with span in\n\tconstructor","Message-ID":"<20250813104009.GD6440@pendragon.ideasonboard.com>","References":"<20250812172310.17441-1-laurent.pinchart@ideasonboard.com>\n\t<babdbaf4-b866-4396-88bb-96cb6826f4fc@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<babdbaf4-b866-4396-88bb-96cb6826f4fc@ideasonboard.com>","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>"}}]