[{"id":39563,"web_url":"https://patchwork.libcamera.org/comment/39563/","msgid":"<CAHW6GYKXWLe2ur4_LJ4gVKE4Bmypx0o06ANrjO0_g02ALo+SaA@mail.gmail.com>","date":"2026-07-02T11:55:26","subject":"Re: [PATCH v2 1/1] pipeline: rpi: Handle buffers with offsets","submitter":{"id":42,"url":"https://patchwork.libcamera.org/api/people/42/","name":"David Plowman","email":"david.plowman@raspberrypi.com"},"content":"Actually I want to drop this patch. There are things not right about\nit. Will have another think!\n\nDavid\n\nOn Wed, 1 Jul 2026 at 14:25, David Plowman\n<david.plowman@raspberrypi.com> wrote:\n>\n> This allows camera images to be written to offset locations within\n> buffers (which must have be allocated with sufficient space\n> available).\n>\n> Firstly, the RPi::Stream class tracks associated \"ispOutputIndex\" for\n> output streams, that is, whether it corresponds to ISP output branch 0\n> or branch 1.\n>\n> Secondly, we pass buffer offsets on to libpisp for each request.\n>\n> The libpisp version is moved on to 1.6.0 which is required for this\n> change.\n>\n> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>\n> ---\n>  .../pipeline/rpi/common/rpi_stream.h          | 10 ++++++++--\n>  src/libcamera/pipeline/rpi/pisp/meson.build   |  2 +-\n>  src/libcamera/pipeline/rpi/pisp/pisp.cpp      | 19 +++++++++++++++++++\n>  subprojects/libpisp.wrap                      |  2 +-\n>  4 files changed, 29 insertions(+), 4 deletions(-)\n>\n> diff --git a/src/libcamera/pipeline/rpi/common/rpi_stream.h b/src/libcamera/pipeline/rpi/common/rpi_stream.h\n> index 300a352a..51931867 100644\n> --- a/src/libcamera/pipeline/rpi/common/rpi_stream.h\n> +++ b/src/libcamera/pipeline/rpi/common/rpi_stream.h\n> @@ -97,14 +97,14 @@ public:\n>         using StreamFlags = Flags<StreamFlag>;\n>\n>         Stream()\n> -               : flags_(StreamFlag::None), id_(0), swDownscale_(0)\n> +               : flags_(StreamFlag::None), id_(0), swDownscale_(0), ispOutputIndex_(-1)\n>         {\n>         }\n>\n>         Stream(const char *name, MediaEntity *dev, StreamFlags flags = StreamFlag::None)\n>                 : flags_(flags), name_(name),\n>                   dev_(std::make_unique<V4L2VideoDevice>(dev)), id_(0),\n> -                 swDownscale_(0)\n> +                 swDownscale_(0), ispOutputIndex_(-1)\n>         {\n>         }\n>\n> @@ -125,6 +125,9 @@ public:\n>\n>         void setExportedBuffer(FrameBuffer *buffer);\n>\n> +       void setIspIndex(int ispIndex) { ispOutputIndex_ = ispIndex; }\n> +       int getIspIndex() const { return ispOutputIndex_; }\n> +\n>         int allocateBuffers(unsigned int count);\n>         int queueBuffer(FrameBuffer *buffer);\n>         void returnBuffer(FrameBuffer *buffer);\n> @@ -181,6 +184,9 @@ private:\n>          * as the stream needs to maintain ownership of these buffers.\n>          */\n>         std::vector<std::unique_ptr<FrameBuffer>> internalBuffers_;\n> +\n> +       /* For output streams, the ISP branch for this stream (otherwise -1). */\n> +       int ispOutputIndex_;\n>  };\n>\n>  /*\n> diff --git a/src/libcamera/pipeline/rpi/pisp/meson.build b/src/libcamera/pipeline/rpi/pisp/meson.build\n> index 178df94c..121f93ef 100644\n> --- a/src/libcamera/pipeline/rpi/pisp/meson.build\n> +++ b/src/libcamera/pipeline/rpi/pisp/meson.build\n> @@ -5,7 +5,7 @@ libcamera_internal_sources += files([\n>  ])\n>\n>  librt = cc.find_library('rt', required : true)\n> -libpisp_dep = dependency('libpisp', fallback : ['libpisp', 'libpisp_dep'])\n> +libpisp_dep = dependency('libpisp', version : '>=1.6.0', fallback : ['libpisp', 'libpisp_dep'])\n>\n>  libcamera_deps += [libpisp_dep, librt]\n>\n> diff --git a/src/libcamera/pipeline/rpi/pisp/pisp.cpp b/src/libcamera/pipeline/rpi/pisp/pisp.cpp\n> index c9d89d58..23f4c14d 100644\n> --- a/src/libcamera/pipeline/rpi/pisp/pisp.cpp\n> +++ b/src/libcamera/pipeline/rpi/pisp/pisp.cpp\n> @@ -1524,6 +1524,7 @@ int PiSPCameraData::platformConfigure(const RPi::RPiCameraConfiguration *rpiConf\n>                         beEnables |= PISP_BE_RGB_ENABLE_OUTPUT0;\n>                         ispIndex = 0;\n>                 }\n> +               stream->setIspIndex(ispIndex);\n>\n>                 format = outStreams[i].format;\n>                 bool needs32BitConversion = adjustDeviceFormat(format);\n> @@ -2306,6 +2307,24 @@ void PiSPCameraData::tryRunPipeline()\n>         Request *request = requestQueue_.front();\n>         ASSERT(request->metadata().empty());\n>\n> +       /* Pass the plane offsets of any output buffers to the Back End ISP. */\n> +       for (auto const &[stream, buffer] : request->buffers()) {\n> +               int ispIndex = static_cast<const RPi::Stream *>(stream)->getIspIndex();\n> +               if (ispIndex >= 0) {\n> +                       /*\n> +                        * PiSP takes only 2 offsets; offset 3 (where required) is assumed\n> +                        * to be the same as offset 2.\n> +                        */\n> +                       unsigned int offset = buffer->planes()[0].offset;\n> +                       unsigned int offset2 = 0;\n> +                       if (buffer->planes().size() > 1)\n> +                               offset2 = buffer->planes()[1].offset;\n> +\n> +                       pisp_be_output_format_extra extra{ 0, 0, { offset, offset2 } };\n> +                       be_->SetOutputFormatExtra(ispIndex, extra);\n> +               }\n> +       }\n> +\n>         /* See if a new ScalerCrop value needs to be applied. */\n>         applyScalerCrop(request->controls());\n>\n> diff --git a/subprojects/libpisp.wrap b/subprojects/libpisp.wrap\n> index b92de484..1a3c3b77 100644\n> --- a/subprojects/libpisp.wrap\n> +++ b/subprojects/libpisp.wrap\n> @@ -2,5 +2,5 @@\n>\n>  [wrap-git]\n>  url = https://github.com/raspberrypi/libpisp.git\n> -revision = v1.5.0\n> +revision = v1.6.0\n>  depth = 1\n> --\n> 2.47.3\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 DE13DC3301\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  2 Jul 2026 11:55:39 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A02C365FB7;\n\tThu,  2 Jul 2026 13:55:39 +0200 (CEST)","from mail-ed1-x533.google.com (mail-ed1-x533.google.com\n\t[IPv6:2a00:1450:4864:20::533])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 06F3C656DE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  2 Jul 2026 13:55:38 +0200 (CEST)","by mail-ed1-x533.google.com with SMTP id\n\t4fb4d7f45d1cf-6984169c126so3217642a12.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 02 Jul 2026 04:55:38 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"o7F3FxSn\"; dkim-atps=neutral","ARC-Seal":"i=1; a=rsa-sha256; t=1782993337; cv=none;\n\td=google.com; s=arc-20260327;\n\tb=mWLRSXj98n722ONu4eyL0ZkijNa6GMeZ0kvGxwpqElNaSyL/eaJXzdafvXR78cNwSt\n\tK2uTT847mnGVnR8kmVyhvJKukedRXytEFfLrJaSOj586ME8GN8PTGrXbcJKT3D2SsjeH\n\t1IBOadONLa9cpVLGAsRYS8y86zm9NtAr2nrP+hLmSZ2Dz0xaqhx/dYXQj4hYCgO7KutA\n\tsf3PWZxWn51/VB7TfrBw0ZmriHKq4PanEfwjjGvV1wtMUovlSlyJGimf3wfcZv2z7rQy\n\tUSTo5bjtdQ7RwlzyzNGG3SN5b0CV7PC3bdNPyE0JFclbjtf3h9gS7MzoU6hwIgn0+JDe\n\tyd0A==","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n\ts=arc-20260327; \n\th=to:subject:message-id:date:from:in-reply-to:references:mime-version\n\t:dkim-signature;\n\tbh=Qyahy7ROp1vEXL38DcXdSDu6pVN3FUfMTPsno00q5U4=;\n\tfh=wtmKwyi0l3IkgfllUcb23GUQ5DBcFLPuxebUMmhSdY0=;\n\tb=a03YomVopH71Cy+LzijE3PpFvpstYA6ooVzZYjVcnNfdV/2+xkVkZ+y6q3J2EX/Q4i\n\tNvycGUn9lhbRJ9rOLN160sZAlfNb2iQq/LRdawzQQk3NzHhMR/3fBNDgFH/pKQo17PKI\n\tjzXI/8a4xOelkjBcUuANkbrjspEKZWhbJGyXELyjylIdmD8YLA6nfN0Q1a5xpjILE6Io\n\t4Xm1kSvEwxZJl6kxb4pMOuGje6sn+aX67wH8IzSF6abI85WvPXazqryqw6YVg/pbxUwf\n\tfaUwAQvlN/ise5ziULpinY6Havt3XdnH5zw0cv1vWppecFIx24uC59r+/UG2vxU/xdPg\n\tPEYw==; darn=lists.libcamera.org","ARC-Authentication-Results":"i=1; mx.google.com; arc=none","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1782993337; x=1783598137;\n\tdarn=lists.libcamera.org; \n\th=to:subject:message-id:date:from:in-reply-to:references:mime-version\n\t:from:to:cc:subject:date:message-id:reply-to;\n\tbh=Qyahy7ROp1vEXL38DcXdSDu6pVN3FUfMTPsno00q5U4=;\n\tb=o7F3FxSn9laRRNXozM5Ff/Wdu0f2EUcCajyZVy4rXreyOnYijYvlR1Isp8SMaO+GXp\n\tbTgtpS5Sqb2LCNY3JKHPertE6mCV2i2BuzC5BriU4pVqFFLsfljk/lDwAMLSjrdtJhky\n\txfjQEdEZeocJyHL1JzHjanaf6j3/bK2gheHJ9AU4ljv6NyPni3zZ5Jtzg9L0f97Qhgbq\n\tvzhYsyiP3LrsWIEFL0ewvu5eWAY0a0Skjk158WNzaE0QPyVRTgMACXANXKQIa+xTDMFn\n\to1erYdEgcrhnHTunCs1LfTg0HpFh61xqvQ3MIR7iaJCmbPdokKHo9fRsch+bfPtWINNW\n\tbYDQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20251104; t=1782993337; x=1783598137;\n\th=to:subject:message-id:date:from:in-reply-to:references:mime-version\n\t:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id\n\t:reply-to;\n\tbh=Qyahy7ROp1vEXL38DcXdSDu6pVN3FUfMTPsno00q5U4=;\n\tb=iSKCf9TYytJfB06Ly6duvNWp2ayHPY83yTIWdxW05zM9KfqRfRx90bWOFjUhYtDZPg\n\tuGXdFFkQUCxwtY+e46iIZcfolMHwTAt7pKGTOlj6P9d4obNH+xDx8D9YPpth+aXWAped\n\tW8FdYJ4QIkTDbEsx7LD1TDuEF8yvRuN/0Iiwd0vc7Se3LnIMdQEcqqHvsPO8y3V907p6\n\tIMRV0Ti8l/z3owSjcQn1iPyWPDXfN5SQ1a5iAJ5neB1it2nqFBxvE9ypThZrnoSz5LKr\n\twrLBKvlAXinFtKlkQvJ+8XpVVvana8bk3VEWwEOKqB+wurlZHmH89fVU5IS1uAOAbiXk\n\t0efQ==","X-Gm-Message-State":"AOJu0YwrAyGcNxSqiLxZZty6OzK7nfCpmkiIAAz6s66Vtl1AY+NppXU4\n\tP39A2AFOA4LpyPSCdHywCCjlabVkfYecJelW3tphTdYDbuRiQhKSkc3zeEUv0gn85fgf4ASZX5B\n\tD/sznEFuXzoKEtiMG7fajXF/XswVmDKWJiLBKhBoePdLKapxd5z38ml8=","X-Gm-Gg":"AfdE7ckydmP/sroQnJMAyVuyHDpzWATyxux5gr1JWLf3TqAVlq4e8pZcqG0FeRDJatQ\n\t/6RNaejQwwNH/FbH3D7xS2ki4LO9yKRlxiDURodYbOVWVYB4m1ZYafSl2A3dI81w6giDQMdc7ec\n\tS+JEtuEUaZT2xGSYC4iivfz/RF30uqP6T02ajL7qC9C/cLoY0EiHacGAOiDcPT23IUcEJYKDgvk\n\tilZBMlJ36mDJjVU23ovclEsNrXFHdFWDTJ8xqVVf9p41DV61ZI2Ls6TWLa4tOwY7p0uyFr1Toyo\n\tyUmo0eyV5ssy+vBbWooOBwFlKatYJwZzKH3D6s/hji0lmIHfbN7M6Z283SKDsCLQ0Ntm8/ulbBx\n\tr1GYIaFgcqMjQrQ==","X-Received":"by 2002:a05:6402:3214:b0:68c:d4e:3a46 with SMTP id\n\t4fb4d7f45d1cf-6989f2dea37mr2696589a12.8.1782993337407;\n\tThu, 02 Jul 2026 04:55:37 -0700 (PDT)","MIME-Version":"1.0","References":"<20260701132555.66035-1-david.plowman@raspberrypi.com>\n\t<20260701132555.66035-2-david.plowman@raspberrypi.com>","In-Reply-To":"<20260701132555.66035-2-david.plowman@raspberrypi.com>","From":"David Plowman <david.plowman@raspberrypi.com>","Date":"Thu, 2 Jul 2026 12:55:26 +0100","X-Gm-Features":"AVVi8Cfrc4Pbxg1-x15eK5Fcv4MUDwFPf97Or5Kr70JfeysLCTmt1J1BWz_1TfA","Message-ID":"<CAHW6GYKXWLe2ur4_LJ4gVKE4Bmypx0o06ANrjO0_g02ALo+SaA@mail.gmail.com>","Subject":"Re: [PATCH v2 1/1] pipeline: rpi: Handle buffers with offsets","To":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"UTF-8\"","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":39564,"web_url":"https://patchwork.libcamera.org/comment/39564/","msgid":"<20260702120153.GA3534761@killaraus.ideasonboard.com>","date":"2026-07-02T12:01:53","subject":"Re: [PATCH v2 1/1] pipeline: rpi: Handle buffers with offsets","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Thu, Jul 02, 2026 at 12:55:26PM +0100, David Plowman wrote:\n> Actually I want to drop this patch. There are things not right about\n> it. Will have another think!\n\nI think we also need to consider it in the context of Barnabás buffers\nsplit from requests, which turns the implicit buffer queues into pools\nand therefore drops the guarantee that FrameBuffer objects will be used\nin the order they're given to the camera.\n\n> On Wed, 1 Jul 2026 at 14:25, David Plowman wrote:\n> >\n> > This allows camera images to be written to offset locations within\n> > buffers (which must have be allocated with sufficient space\n> > available).\n> >\n> > Firstly, the RPi::Stream class tracks associated \"ispOutputIndex\" for\n> > output streams, that is, whether it corresponds to ISP output branch 0\n> > or branch 1.\n> >\n> > Secondly, we pass buffer offsets on to libpisp for each request.\n> >\n> > The libpisp version is moved on to 1.6.0 which is required for this\n> > change.\n> >\n> > Signed-off-by: David Plowman <david.plowman@raspberrypi.com>\n> > ---\n> >  .../pipeline/rpi/common/rpi_stream.h          | 10 ++++++++--\n> >  src/libcamera/pipeline/rpi/pisp/meson.build   |  2 +-\n> >  src/libcamera/pipeline/rpi/pisp/pisp.cpp      | 19 +++++++++++++++++++\n> >  subprojects/libpisp.wrap                      |  2 +-\n> >  4 files changed, 29 insertions(+), 4 deletions(-)\n> >\n> > diff --git a/src/libcamera/pipeline/rpi/common/rpi_stream.h b/src/libcamera/pipeline/rpi/common/rpi_stream.h\n> > index 300a352a..51931867 100644\n> > --- a/src/libcamera/pipeline/rpi/common/rpi_stream.h\n> > +++ b/src/libcamera/pipeline/rpi/common/rpi_stream.h\n> > @@ -97,14 +97,14 @@ public:\n> >         using StreamFlags = Flags<StreamFlag>;\n> >\n> >         Stream()\n> > -               : flags_(StreamFlag::None), id_(0), swDownscale_(0)\n> > +               : flags_(StreamFlag::None), id_(0), swDownscale_(0), ispOutputIndex_(-1)\n> >         {\n> >         }\n> >\n> >         Stream(const char *name, MediaEntity *dev, StreamFlags flags = StreamFlag::None)\n> >                 : flags_(flags), name_(name),\n> >                   dev_(std::make_unique<V4L2VideoDevice>(dev)), id_(0),\n> > -                 swDownscale_(0)\n> > +                 swDownscale_(0), ispOutputIndex_(-1)\n> >         {\n> >         }\n> >\n> > @@ -125,6 +125,9 @@ public:\n> >\n> >         void setExportedBuffer(FrameBuffer *buffer);\n> >\n> > +       void setIspIndex(int ispIndex) { ispOutputIndex_ = ispIndex; }\n> > +       int getIspIndex() const { return ispOutputIndex_; }\n> > +\n> >         int allocateBuffers(unsigned int count);\n> >         int queueBuffer(FrameBuffer *buffer);\n> >         void returnBuffer(FrameBuffer *buffer);\n> > @@ -181,6 +184,9 @@ private:\n> >          * as the stream needs to maintain ownership of these buffers.\n> >          */\n> >         std::vector<std::unique_ptr<FrameBuffer>> internalBuffers_;\n> > +\n> > +       /* For output streams, the ISP branch for this stream (otherwise -1). */\n> > +       int ispOutputIndex_;\n> >  };\n> >\n> >  /*\n> > diff --git a/src/libcamera/pipeline/rpi/pisp/meson.build b/src/libcamera/pipeline/rpi/pisp/meson.build\n> > index 178df94c..121f93ef 100644\n> > --- a/src/libcamera/pipeline/rpi/pisp/meson.build\n> > +++ b/src/libcamera/pipeline/rpi/pisp/meson.build\n> > @@ -5,7 +5,7 @@ libcamera_internal_sources += files([\n> >  ])\n> >\n> >  librt = cc.find_library('rt', required : true)\n> > -libpisp_dep = dependency('libpisp', fallback : ['libpisp', 'libpisp_dep'])\n> > +libpisp_dep = dependency('libpisp', version : '>=1.6.0', fallback : ['libpisp', 'libpisp_dep'])\n> >\n> >  libcamera_deps += [libpisp_dep, librt]\n> >\n> > diff --git a/src/libcamera/pipeline/rpi/pisp/pisp.cpp b/src/libcamera/pipeline/rpi/pisp/pisp.cpp\n> > index c9d89d58..23f4c14d 100644\n> > --- a/src/libcamera/pipeline/rpi/pisp/pisp.cpp\n> > +++ b/src/libcamera/pipeline/rpi/pisp/pisp.cpp\n> > @@ -1524,6 +1524,7 @@ int PiSPCameraData::platformConfigure(const RPi::RPiCameraConfiguration *rpiConf\n> >                         beEnables |= PISP_BE_RGB_ENABLE_OUTPUT0;\n> >                         ispIndex = 0;\n> >                 }\n> > +               stream->setIspIndex(ispIndex);\n> >\n> >                 format = outStreams[i].format;\n> >                 bool needs32BitConversion = adjustDeviceFormat(format);\n> > @@ -2306,6 +2307,24 @@ void PiSPCameraData::tryRunPipeline()\n> >         Request *request = requestQueue_.front();\n> >         ASSERT(request->metadata().empty());\n> >\n> > +       /* Pass the plane offsets of any output buffers to the Back End ISP. */\n> > +       for (auto const &[stream, buffer] : request->buffers()) {\n> > +               int ispIndex = static_cast<const RPi::Stream *>(stream)->getIspIndex();\n> > +               if (ispIndex >= 0) {\n> > +                       /*\n> > +                        * PiSP takes only 2 offsets; offset 3 (where required) is assumed\n> > +                        * to be the same as offset 2.\n> > +                        */\n> > +                       unsigned int offset = buffer->planes()[0].offset;\n> > +                       unsigned int offset2 = 0;\n> > +                       if (buffer->planes().size() > 1)\n> > +                               offset2 = buffer->planes()[1].offset;\n> > +\n> > +                       pisp_be_output_format_extra extra{ 0, 0, { offset, offset2 } };\n> > +                       be_->SetOutputFormatExtra(ispIndex, extra);\n> > +               }\n> > +       }\n> > +\n> >         /* See if a new ScalerCrop value needs to be applied. */\n> >         applyScalerCrop(request->controls());\n> >\n> > diff --git a/subprojects/libpisp.wrap b/subprojects/libpisp.wrap\n> > index b92de484..1a3c3b77 100644\n> > --- a/subprojects/libpisp.wrap\n> > +++ b/subprojects/libpisp.wrap\n> > @@ -2,5 +2,5 @@\n> >\n> >  [wrap-git]\n> >  url = https://github.com/raspberrypi/libpisp.git\n> > -revision = v1.5.0\n> > +revision = v1.6.0\n> >  depth = 1","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 7341CC3302\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  2 Jul 2026 12:01:57 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 90DF5656DE;\n\tThu,  2 Jul 2026 14:01:56 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id EAD64656DE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  2 Jul 2026 14:01:54 +0200 (CEST)","from killaraus.ideasonboard.com\n\t(2001-14ba-70f3-e800--a06.rev.dnainternet.fi\n\t[IPv6:2001:14ba:70f3:e800::a06])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 4DFA33A2;\n\tThu,  2 Jul 2026 14:01:09 +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=\"lmSmus5y\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1782993669;\n\tbh=lFc+XZVmAftXa81ajXMt81NVs7g0cmq2U9gmYC4SRCo=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=lmSmus5yy/5+/yQUWmwRLNI+kVdvUbMGlCmPprRnYoojhHvX14H2mYxcpM9ve/uvI\n\t5CUtMEYhPs2sCB/d/cGN7TMOQYqM9I4qfPS9DGODTE2IMp6r2uopPmimlwpx/QqFjG\n\tI1WWJUXD5kuE5Ebtuqm4Crta/ZhahRPnox205cAI=","Date":"Thu, 2 Jul 2026 15:01:53 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"David Plowman <david.plowman@raspberrypi.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v2 1/1] pipeline: rpi: Handle buffers with offsets","Message-ID":"<20260702120153.GA3534761@killaraus.ideasonboard.com>","References":"<20260701132555.66035-1-david.plowman@raspberrypi.com>\n\t<20260701132555.66035-2-david.plowman@raspberrypi.com>\n\t<CAHW6GYKXWLe2ur4_LJ4gVKE4Bmypx0o06ANrjO0_g02ALo+SaA@mail.gmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<CAHW6GYKXWLe2ur4_LJ4gVKE4Bmypx0o06ANrjO0_g02ALo+SaA@mail.gmail.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>"}},{"id":39566,"web_url":"https://patchwork.libcamera.org/comment/39566/","msgid":"<CAHW6GYKDEDwO+86L+1fJ1t=c2m3SCN72jY9KzOTdbOPf0CVbdw@mail.gmail.com>","date":"2026-07-03T09:01:15","subject":"Re: [PATCH v2 1/1] pipeline: rpi: Handle buffers with offsets","submitter":{"id":42,"url":"https://patchwork.libcamera.org/api/people/42/","name":"David Plowman","email":"david.plowman@raspberrypi.com"},"content":"Hi Laurent\n\nHappy to pause this for a bit, but maybe just to recap what seem to be\nthe sticking points:\n\n1. As Dave pointed out elsewhere, V4L2 explicitly doesn't propagate\nthe offsets for \"capture\" buffers, which is what these are. This seems\nlike a bit of a blocker!\n\n2. libpisp, on the other hand, trivially does exactly what we need.\n\"All\" that is required is to get an offset number to it from\nsomewhere...\n\n3. The code above gets the number from the plane offset, which doesn't\nfeel super-lovely to me. Putting something in the StreamConfiguration\nmight be tidier, but I can imagine objections from other PHs because\n(a) it would require work and (b) might not be supportable anyway.\n\nDavid\n\nOn Thu, 2 Jul 2026 at 13:01, Laurent Pinchart\n<laurent.pinchart@ideasonboard.com> wrote:\n>\n> On Thu, Jul 02, 2026 at 12:55:26PM +0100, David Plowman wrote:\n> > Actually I want to drop this patch. There are things not right about\n> > it. Will have another think!\n>\n> I think we also need to consider it in the context of Barnabás buffers\n> split from requests, which turns the implicit buffer queues into pools\n> and therefore drops the guarantee that FrameBuffer objects will be used\n> in the order they're given to the camera.\n>\n> > On Wed, 1 Jul 2026 at 14:25, David Plowman wrote:\n> > >\n> > > This allows camera images to be written to offset locations within\n> > > buffers (which must have be allocated with sufficient space\n> > > available).\n> > >\n> > > Firstly, the RPi::Stream class tracks associated \"ispOutputIndex\" for\n> > > output streams, that is, whether it corresponds to ISP output branch 0\n> > > or branch 1.\n> > >\n> > > Secondly, we pass buffer offsets on to libpisp for each request.\n> > >\n> > > The libpisp version is moved on to 1.6.0 which is required for this\n> > > change.\n> > >\n> > > Signed-off-by: David Plowman <david.plowman@raspberrypi.com>\n> > > ---\n> > >  .../pipeline/rpi/common/rpi_stream.h          | 10 ++++++++--\n> > >  src/libcamera/pipeline/rpi/pisp/meson.build   |  2 +-\n> > >  src/libcamera/pipeline/rpi/pisp/pisp.cpp      | 19 +++++++++++++++++++\n> > >  subprojects/libpisp.wrap                      |  2 +-\n> > >  4 files changed, 29 insertions(+), 4 deletions(-)\n> > >\n> > > diff --git a/src/libcamera/pipeline/rpi/common/rpi_stream.h b/src/libcamera/pipeline/rpi/common/rpi_stream.h\n> > > index 300a352a..51931867 100644\n> > > --- a/src/libcamera/pipeline/rpi/common/rpi_stream.h\n> > > +++ b/src/libcamera/pipeline/rpi/common/rpi_stream.h\n> > > @@ -97,14 +97,14 @@ public:\n> > >         using StreamFlags = Flags<StreamFlag>;\n> > >\n> > >         Stream()\n> > > -               : flags_(StreamFlag::None), id_(0), swDownscale_(0)\n> > > +               : flags_(StreamFlag::None), id_(0), swDownscale_(0), ispOutputIndex_(-1)\n> > >         {\n> > >         }\n> > >\n> > >         Stream(const char *name, MediaEntity *dev, StreamFlags flags = StreamFlag::None)\n> > >                 : flags_(flags), name_(name),\n> > >                   dev_(std::make_unique<V4L2VideoDevice>(dev)), id_(0),\n> > > -                 swDownscale_(0)\n> > > +                 swDownscale_(0), ispOutputIndex_(-1)\n> > >         {\n> > >         }\n> > >\n> > > @@ -125,6 +125,9 @@ public:\n> > >\n> > >         void setExportedBuffer(FrameBuffer *buffer);\n> > >\n> > > +       void setIspIndex(int ispIndex) { ispOutputIndex_ = ispIndex; }\n> > > +       int getIspIndex() const { return ispOutputIndex_; }\n> > > +\n> > >         int allocateBuffers(unsigned int count);\n> > >         int queueBuffer(FrameBuffer *buffer);\n> > >         void returnBuffer(FrameBuffer *buffer);\n> > > @@ -181,6 +184,9 @@ private:\n> > >          * as the stream needs to maintain ownership of these buffers.\n> > >          */\n> > >         std::vector<std::unique_ptr<FrameBuffer>> internalBuffers_;\n> > > +\n> > > +       /* For output streams, the ISP branch for this stream (otherwise -1). */\n> > > +       int ispOutputIndex_;\n> > >  };\n> > >\n> > >  /*\n> > > diff --git a/src/libcamera/pipeline/rpi/pisp/meson.build b/src/libcamera/pipeline/rpi/pisp/meson.build\n> > > index 178df94c..121f93ef 100644\n> > > --- a/src/libcamera/pipeline/rpi/pisp/meson.build\n> > > +++ b/src/libcamera/pipeline/rpi/pisp/meson.build\n> > > @@ -5,7 +5,7 @@ libcamera_internal_sources += files([\n> > >  ])\n> > >\n> > >  librt = cc.find_library('rt', required : true)\n> > > -libpisp_dep = dependency('libpisp', fallback : ['libpisp', 'libpisp_dep'])\n> > > +libpisp_dep = dependency('libpisp', version : '>=1.6.0', fallback : ['libpisp', 'libpisp_dep'])\n> > >\n> > >  libcamera_deps += [libpisp_dep, librt]\n> > >\n> > > diff --git a/src/libcamera/pipeline/rpi/pisp/pisp.cpp b/src/libcamera/pipeline/rpi/pisp/pisp.cpp\n> > > index c9d89d58..23f4c14d 100644\n> > > --- a/src/libcamera/pipeline/rpi/pisp/pisp.cpp\n> > > +++ b/src/libcamera/pipeline/rpi/pisp/pisp.cpp\n> > > @@ -1524,6 +1524,7 @@ int PiSPCameraData::platformConfigure(const RPi::RPiCameraConfiguration *rpiConf\n> > >                         beEnables |= PISP_BE_RGB_ENABLE_OUTPUT0;\n> > >                         ispIndex = 0;\n> > >                 }\n> > > +               stream->setIspIndex(ispIndex);\n> > >\n> > >                 format = outStreams[i].format;\n> > >                 bool needs32BitConversion = adjustDeviceFormat(format);\n> > > @@ -2306,6 +2307,24 @@ void PiSPCameraData::tryRunPipeline()\n> > >         Request *request = requestQueue_.front();\n> > >         ASSERT(request->metadata().empty());\n> > >\n> > > +       /* Pass the plane offsets of any output buffers to the Back End ISP. */\n> > > +       for (auto const &[stream, buffer] : request->buffers()) {\n> > > +               int ispIndex = static_cast<const RPi::Stream *>(stream)->getIspIndex();\n> > > +               if (ispIndex >= 0) {\n> > > +                       /*\n> > > +                        * PiSP takes only 2 offsets; offset 3 (where required) is assumed\n> > > +                        * to be the same as offset 2.\n> > > +                        */\n> > > +                       unsigned int offset = buffer->planes()[0].offset;\n> > > +                       unsigned int offset2 = 0;\n> > > +                       if (buffer->planes().size() > 1)\n> > > +                               offset2 = buffer->planes()[1].offset;\n> > > +\n> > > +                       pisp_be_output_format_extra extra{ 0, 0, { offset, offset2 } };\n> > > +                       be_->SetOutputFormatExtra(ispIndex, extra);\n> > > +               }\n> > > +       }\n> > > +\n> > >         /* See if a new ScalerCrop value needs to be applied. */\n> > >         applyScalerCrop(request->controls());\n> > >\n> > > diff --git a/subprojects/libpisp.wrap b/subprojects/libpisp.wrap\n> > > index b92de484..1a3c3b77 100644\n> > > --- a/subprojects/libpisp.wrap\n> > > +++ b/subprojects/libpisp.wrap\n> > > @@ -2,5 +2,5 @@\n> > >\n> > >  [wrap-git]\n> > >  url = https://github.com/raspberrypi/libpisp.git\n> > > -revision = v1.5.0\n> > > +revision = v1.6.0\n> > >  depth = 1\n>\n> --\n> Regards,\n>\n> Laurent Pinchart","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 055E1C328C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  3 Jul 2026 09:01:30 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BD2DF65FC4;\n\tFri,  3 Jul 2026 11:01:29 +0200 (CEST)","from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com\n\t[IPv6:2a00:1450:4864:20::52a])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id EB7D0658BF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  3 Jul 2026 11:01:27 +0200 (CEST)","by mail-ed1-x52a.google.com with SMTP id\n\t4fb4d7f45d1cf-698aa7ba3e6so627382a12.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 03 Jul 2026 02:01:27 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"B0f2FFyS\"; dkim-atps=neutral","ARC-Seal":"i=1; a=rsa-sha256; t=1783069287; cv=none;\n\td=google.com; s=arc-20260327;\n\tb=gCKg/eLGXTaFVERyPuxwNnlo9wptx9NISQYfKdddEFE4QOjvZvl4a2bxaHUr9wPt/Q\n\td7V+VxeSEUEAzBfbo+fTvtJoO+T52oXWItUVzEfmpenJgKJ2boOwSYyNrAYKOsamNys1\n\t7v10I9X3OMkvZKBVvO95/UcT1/5zURYzdGVTysjKbnuiuTtsB8JsGXPF79UnOFeOBwIR\n\tQLeL3b6RNJ9SNXFq/FYoloqJ7nX+6sC8ZTk+6803uVAHUnd77fbmP2BUznMa1Ov2eRBb\n\tyCpKVCzwnd+jPYvAjkcMnNsqXdUAvQP+3V8VCdi9oy8Ac2MYCoilNO9hgHbgnPyvvKNr\n\tDLeA==","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n\ts=arc-20260327; \n\th=content-transfer-encoding:cc:to:subject:message-id:date:from\n\t:in-reply-to:references:mime-version:dkim-signature;\n\tbh=mPoEIReBq4PkqPHTuRpnB6DPeSxPmpfaMsiOcGieEzM=;\n\tfh=kAwbguIY0wmqf1QQypnTiLH20ruRu7+JSSp6fzxLlN4=;\n\tb=Kn1vro0MOs9TgPagBTBPNd4xD9iZr2vYTc3EnRwZy9KXUH2bCZPOGz6mQOeAYeGLKQ\n\tUXXiQ3uEaedHAfdYwFxdrul+AVYr6PRebFFkmJaXAHdz+8HSxab3DJBPpCYODwXneQa7\n\tA6IG/aRpL20wlyPVLKQ/i/UPE/gW895ElQyX56ZjiPN8hIDTmn3hsl+Wq2JrFeHtWKdB\n\tA3dWUrkkaOzxz5QGpWCdrUdCTEuypxqWD07eFfGX0TyIigP4hn6NpWR+msT5v1o/232l\n\tRTxzPqpq3C/71l75f+UJ7BKq4i+N7UhQJHJpRkDpi43IQ39yTCVDG6fZ+JMzUHaozkbl\n\tNazg==; darn=lists.libcamera.org","ARC-Authentication-Results":"i=1; mx.google.com; arc=none","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1783069287; x=1783674087;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:cc:to:subject:message-id:date:from\n\t:in-reply-to:references:mime-version:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=mPoEIReBq4PkqPHTuRpnB6DPeSxPmpfaMsiOcGieEzM=;\n\tb=B0f2FFyS1hzSrQ3x0ZuCRP2ak3Zk6ImcNM+RjOPZlVk7nK1NSxIVPwccy6oCJv6fm4\n\tGL9+XWdLob7p7t1m/ny1J98C48AubwlwaRexBrLGqbCpvn38VNaidCnbED9INa2CnMYI\n\tXeuEydrZ03hxz0eGW8jycXtOjEICnnvMhEhWaJd6wEGcQemNv53uAjjWX+vNNzqX8qs2\n\t+aRZPjpYzKaomcBxyAgsKolSmhzVENmIx35F2FajVOJFDPsTliTR+y08YfpqaLHYKWDw\n\tClu7BJMInUoXldQRBHjg8TrWRl5XGTilVHw0bIca4jjHT9EZ998p04iG5tu5c3F9Kdmj\n\th85Q==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20251104; t=1783069287; x=1783674087;\n\th=content-transfer-encoding:cc:to:subject:message-id:date:from\n\t:in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from\n\t:to:cc:subject:date:message-id:reply-to;\n\tbh=mPoEIReBq4PkqPHTuRpnB6DPeSxPmpfaMsiOcGieEzM=;\n\tb=fY6OstMZvsZKvX+Q67KA+vKAY2DS22jQhJLbM8y+1avBkYxgj0s19EN+K107qKZELL\n\tqbgiV7hxJ23iCDBr33ybg3rIVIy7zzASZBmZYANPpQs1MtCRD3rHGnkzKiTke2HXJQnO\n\tnuTby023OwF/PYU++jR/YXO/e/O3bgOFZ276UMkwImA+IzNC/OF4C5alf+m4iCuiVO0/\n\tqlkPw/NvZjjSfqAbR8l/wJA8aCtSa1ZQelri+zwXp1JGuuNDw6Z0mzgOZ3X0fv4Ta3f1\n\txcu3aJCh66W4LYRtLfAker9Yp/KGko7cJ7Rrg7BvTSlLEPKnopE+SIqy/jCDmy3dYW+t\n\tS7lw==","X-Gm-Message-State":"AOJu0Yzn/36Nb3AtYNuMm6lcKAtKbvwoCSHpo+Ll4zb1Uhh9ERmAHWwQ\n\toEGYbar74jX9vsVoc6Btp75YNszJ0NN25JSR/Pqw9uJpukqzmghxhzRAxAO/gU+tCkVTgwlvXgK\n\tuE633Xvnx6jt+4Xq7/3QTm1slGSatPrjFlIobXd63JxbcTaHqF5Dqck4=","X-Gm-Gg":"AfdE7cn5vc857xLidyazT9H2kzo4hKGcJPCss/KV3d1TAleiiMNPQ0NNhSqM5LWiKTJ\n\tT5RpWserpYKFVFeCC/UM6Fr07e68Dx3EauJ7U/wij+oHdIEnrd2oGBa6/2tbV9rQazw6wz4SVye\n\tfJcz8SmqrQNcWbAhAZaDEd7PZX+Ch+miFjdKgLBYVdoAgM11MRpfNJQfyq42MwwQgE8t+ln650F\n\tg+4Cl6OyGb6eH50nondKNXOJ8CC2+d1r+rpV8Qs8DzuTKQKnX6bQZSOK9KQcUMcFrEy/B9jAHDd\n\t7Rmoz4ZmW7pF9EQPrgy9IYJgwx/Rd1LHzgcO0FPphrWmVovlzjzEASGlidtYITspJJGuKknSWXr\n\tVmhBaPwA/O0OKGp0ftbsNO06O","X-Received":"by 2002:a05:6402:5409:b0:698:9702:a227 with SMTP id\n\t4fb4d7f45d1cf-6989f36f5c8mr4123150a12.30.1783069286848;\n\tFri, 03 Jul 2026 02:01:26 -0700 (PDT)","MIME-Version":"1.0","References":"<20260701132555.66035-1-david.plowman@raspberrypi.com>\n\t<20260701132555.66035-2-david.plowman@raspberrypi.com>\n\t<CAHW6GYKXWLe2ur4_LJ4gVKE4Bmypx0o06ANrjO0_g02ALo+SaA@mail.gmail.com>\n\t<20260702120153.GA3534761@killaraus.ideasonboard.com>","In-Reply-To":"<20260702120153.GA3534761@killaraus.ideasonboard.com>","From":"David Plowman <david.plowman@raspberrypi.com>","Date":"Fri, 3 Jul 2026 10:01:15 +0100","X-Gm-Features":"AVVi8CfSw5FjTOG10_nDrIRFBgFrmIkfu0srTlSlOjpufe-vXTw66HTx5r8lkic","Message-ID":"<CAHW6GYKDEDwO+86L+1fJ1t=c2m3SCN72jY9KzOTdbOPf0CVbdw@mail.gmail.com>","Subject":"Re: [PATCH v2 1/1] pipeline: rpi: Handle buffers with offsets","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","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":39568,"web_url":"https://patchwork.libcamera.org/comment/39568/","msgid":"<20260703124344.GD3659451@killaraus.ideasonboard.com>","date":"2026-07-03T12:43:44","subject":"Re: [PATCH v2 1/1] pipeline: rpi: Handle buffers with offsets","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Fri, Jul 03, 2026 at 10:01:15AM +0100, David Plowman wrote:\n> Hi Laurent\n> \n> Happy to pause this for a bit, but maybe just to recap what seem to be\n> the sticking points:\n> \n> 1. As Dave pointed out elsewhere, V4L2 explicitly doesn't propagate\n> the offsets for \"capture\" buffers, which is what these are. This seems\n> like a bit of a blocker!\n> \n> 2. libpisp, on the other hand, trivially does exactly what we need.\n> \"All\" that is required is to get an offset number to it from\n> somewhere...\n\nI agree with the above, but FrameBuffer::Plane::offset does not need to\nbe blindly propagated to v4l2_buffer.m.planes.m.offset. The pipeline\nhandler can use the offset to program the ISP through a different\nmechanism.\n\n> 3. The code above gets the number from the plane offset, which doesn't\n> feel super-lovely to me. Putting something in the StreamConfiguration\n> might be tidier, but I can imagine objections from other PHs because\n> (a) it would require work and (b) might not be supportable anyway.\n\nI'm not very concerned about (a). My first concern about the control you\ninitially proposed is that interactions with other API elements\n(including FrameBuffer::Plane::offset, as well as other controls) are\nnot defined. FrameBuffer::Plane::offset was designed to tell where in\nthe DMA buffer the camera should store data. I don't want to add another\nmechanism without considering the existing one. Maybe we would conclude\nafter design discussions that FrameBuffer::Plane::offset should be\nreplaced by a control, but those design discussions never happened.\n\n> On Thu, 2 Jul 2026 at 13:01, Laurent Pinchart wrote:\n> > On Thu, Jul 02, 2026 at 12:55:26PM +0100, David Plowman wrote:\n> > > Actually I want to drop this patch. There are things not right about\n> > > it. Will have another think!\n> >\n> > I think we also need to consider it in the context of Barnabás buffers\n> > split from requests, which turns the implicit buffer queues into pools\n> > and therefore drops the guarantee that FrameBuffer objects will be used\n> > in the order they're given to the camera.\n> >\n> > > On Wed, 1 Jul 2026 at 14:25, David Plowman wrote:\n> > > >\n> > > > This allows camera images to be written to offset locations within\n> > > > buffers (which must have be allocated with sufficient space\n> > > > available).\n> > > >\n> > > > Firstly, the RPi::Stream class tracks associated \"ispOutputIndex\" for\n> > > > output streams, that is, whether it corresponds to ISP output branch 0\n> > > > or branch 1.\n> > > >\n> > > > Secondly, we pass buffer offsets on to libpisp for each request.\n> > > >\n> > > > The libpisp version is moved on to 1.6.0 which is required for this\n> > > > change.\n> > > >\n> > > > Signed-off-by: David Plowman <david.plowman@raspberrypi.com>\n> > > > ---\n> > > >  .../pipeline/rpi/common/rpi_stream.h          | 10 ++++++++--\n> > > >  src/libcamera/pipeline/rpi/pisp/meson.build   |  2 +-\n> > > >  src/libcamera/pipeline/rpi/pisp/pisp.cpp      | 19 +++++++++++++++++++\n> > > >  subprojects/libpisp.wrap                      |  2 +-\n> > > >  4 files changed, 29 insertions(+), 4 deletions(-)\n> > > >\n> > > > diff --git a/src/libcamera/pipeline/rpi/common/rpi_stream.h b/src/libcamera/pipeline/rpi/common/rpi_stream.h\n> > > > index 300a352a..51931867 100644\n> > > > --- a/src/libcamera/pipeline/rpi/common/rpi_stream.h\n> > > > +++ b/src/libcamera/pipeline/rpi/common/rpi_stream.h\n> > > > @@ -97,14 +97,14 @@ public:\n> > > >         using StreamFlags = Flags<StreamFlag>;\n> > > >\n> > > >         Stream()\n> > > > -               : flags_(StreamFlag::None), id_(0), swDownscale_(0)\n> > > > +               : flags_(StreamFlag::None), id_(0), swDownscale_(0), ispOutputIndex_(-1)\n> > > >         {\n> > > >         }\n> > > >\n> > > >         Stream(const char *name, MediaEntity *dev, StreamFlags flags = StreamFlag::None)\n> > > >                 : flags_(flags), name_(name),\n> > > >                   dev_(std::make_unique<V4L2VideoDevice>(dev)), id_(0),\n> > > > -                 swDownscale_(0)\n> > > > +                 swDownscale_(0), ispOutputIndex_(-1)\n> > > >         {\n> > > >         }\n> > > >\n> > > > @@ -125,6 +125,9 @@ public:\n> > > >\n> > > >         void setExportedBuffer(FrameBuffer *buffer);\n> > > >\n> > > > +       void setIspIndex(int ispIndex) { ispOutputIndex_ = ispIndex; }\n> > > > +       int getIspIndex() const { return ispOutputIndex_; }\n> > > > +\n> > > >         int allocateBuffers(unsigned int count);\n> > > >         int queueBuffer(FrameBuffer *buffer);\n> > > >         void returnBuffer(FrameBuffer *buffer);\n> > > > @@ -181,6 +184,9 @@ private:\n> > > >          * as the stream needs to maintain ownership of these buffers.\n> > > >          */\n> > > >         std::vector<std::unique_ptr<FrameBuffer>> internalBuffers_;\n> > > > +\n> > > > +       /* For output streams, the ISP branch for this stream (otherwise -1). */\n> > > > +       int ispOutputIndex_;\n> > > >  };\n> > > >\n> > > >  /*\n> > > > diff --git a/src/libcamera/pipeline/rpi/pisp/meson.build b/src/libcamera/pipeline/rpi/pisp/meson.build\n> > > > index 178df94c..121f93ef 100644\n> > > > --- a/src/libcamera/pipeline/rpi/pisp/meson.build\n> > > > +++ b/src/libcamera/pipeline/rpi/pisp/meson.build\n> > > > @@ -5,7 +5,7 @@ libcamera_internal_sources += files([\n> > > >  ])\n> > > >\n> > > >  librt = cc.find_library('rt', required : true)\n> > > > -libpisp_dep = dependency('libpisp', fallback : ['libpisp', 'libpisp_dep'])\n> > > > +libpisp_dep = dependency('libpisp', version : '>=1.6.0', fallback : ['libpisp', 'libpisp_dep'])\n> > > >\n> > > >  libcamera_deps += [libpisp_dep, librt]\n> > > >\n> > > > diff --git a/src/libcamera/pipeline/rpi/pisp/pisp.cpp b/src/libcamera/pipeline/rpi/pisp/pisp.cpp\n> > > > index c9d89d58..23f4c14d 100644\n> > > > --- a/src/libcamera/pipeline/rpi/pisp/pisp.cpp\n> > > > +++ b/src/libcamera/pipeline/rpi/pisp/pisp.cpp\n> > > > @@ -1524,6 +1524,7 @@ int PiSPCameraData::platformConfigure(const RPi::RPiCameraConfiguration *rpiConf\n> > > >                         beEnables |= PISP_BE_RGB_ENABLE_OUTPUT0;\n> > > >                         ispIndex = 0;\n> > > >                 }\n> > > > +               stream->setIspIndex(ispIndex);\n> > > >\n> > > >                 format = outStreams[i].format;\n> > > >                 bool needs32BitConversion = adjustDeviceFormat(format);\n> > > > @@ -2306,6 +2307,24 @@ void PiSPCameraData::tryRunPipeline()\n> > > >         Request *request = requestQueue_.front();\n> > > >         ASSERT(request->metadata().empty());\n> > > >\n> > > > +       /* Pass the plane offsets of any output buffers to the Back End ISP. */\n> > > > +       for (auto const &[stream, buffer] : request->buffers()) {\n> > > > +               int ispIndex = static_cast<const RPi::Stream *>(stream)->getIspIndex();\n> > > > +               if (ispIndex >= 0) {\n> > > > +                       /*\n> > > > +                        * PiSP takes only 2 offsets; offset 3 (where required) is assumed\n> > > > +                        * to be the same as offset 2.\n> > > > +                        */\n> > > > +                       unsigned int offset = buffer->planes()[0].offset;\n> > > > +                       unsigned int offset2 = 0;\n> > > > +                       if (buffer->planes().size() > 1)\n> > > > +                               offset2 = buffer->planes()[1].offset;\n> > > > +\n> > > > +                       pisp_be_output_format_extra extra{ 0, 0, { offset, offset2 } };\n> > > > +                       be_->SetOutputFormatExtra(ispIndex, extra);\n> > > > +               }\n> > > > +       }\n> > > > +\n> > > >         /* See if a new ScalerCrop value needs to be applied. */\n> > > >         applyScalerCrop(request->controls());\n> > > >\n> > > > diff --git a/subprojects/libpisp.wrap b/subprojects/libpisp.wrap\n> > > > index b92de484..1a3c3b77 100644\n> > > > --- a/subprojects/libpisp.wrap\n> > > > +++ b/subprojects/libpisp.wrap\n> > > > @@ -2,5 +2,5 @@\n> > > >\n> > > >  [wrap-git]\n> > > >  url = https://github.com/raspberrypi/libpisp.git\n> > > > -revision = v1.5.0\n> > > > +revision = v1.6.0\n> > > >  depth = 1","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 539C3C328C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  3 Jul 2026 12:43:49 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AC41465FC6;\n\tFri,  3 Jul 2026 14:43:48 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 726B565FC3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  3 Jul 2026 14:43:46 +0200 (CEST)","from killaraus.ideasonboard.com\n\t(2001-14ba-70f3-e800--a06.rev.dnainternet.fi\n\t[IPv6:2001:14ba:70f3:e800::a06])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 343DA8E0;\n\tFri,  3 Jul 2026 14:43:00 +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=\"i2KaC/Sg\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1783082580;\n\tbh=NcVIJLCqepsYFNoC+anS2JeUzp5Eb2c40YmwWDEDD78=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=i2KaC/SgZ9JWvaww4dLSE1EuaH8jh2AeqOHxWs+Ii3+Hn+DvW63crP2yEkSl1zIzc\n\tr3twSrGrvTczahi6FHFDZQp6UbvKJYoKylhOP714LY5iy9cm2awI8x+81wn+LvxNzT\n\tcnBxdrZRtRj9znQS2B6czvjUHKJaYQERPN46u2nc=","Date":"Fri, 3 Jul 2026 15:43:44 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"David Plowman <david.plowman@raspberrypi.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v2 1/1] pipeline: rpi: Handle buffers with offsets","Message-ID":"<20260703124344.GD3659451@killaraus.ideasonboard.com>","References":"<20260701132555.66035-1-david.plowman@raspberrypi.com>\n\t<20260701132555.66035-2-david.plowman@raspberrypi.com>\n\t<CAHW6GYKXWLe2ur4_LJ4gVKE4Bmypx0o06ANrjO0_g02ALo+SaA@mail.gmail.com>\n\t<20260702120153.GA3534761@killaraus.ideasonboard.com>\n\t<CAHW6GYKDEDwO+86L+1fJ1t=c2m3SCN72jY9KzOTdbOPf0CVbdw@mail.gmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<CAHW6GYKDEDwO+86L+1fJ1t=c2m3SCN72jY9KzOTdbOPf0CVbdw@mail.gmail.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>"}}]