[{"id":26238,"web_url":"https://patchwork.libcamera.org/comment/26238/","msgid":"<167388575603.42371.7911015366897654333@Monstersaurus>","date":"2023-01-16T16:15:56","subject":"Re: [libcamera-devel] [PATCH v4 01/12] libcamera: stream: Add\n\tstream hints to StreamConfiguration","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Naushir Patuck via libcamera-devel (2022-12-09 09:00:39)\n> Add a new hints flags field in the StreamConfiguration structure to allow the\n> application to specify certain intended behavior when driving libcamera.\n> Pipeline handlers are expected to look at these hint flags and may optimise\n> internal operations based on them.\n> \n> Currently, only one flag is listed, MandatoryRequestBuffer, which the\n> application sets to guarantee that a buffer will be provided in the Request for\n> each configured stream.\n> \n> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> ---\n>  include/libcamera/stream.h |  8 ++++++++\n>  src/libcamera/stream.cpp   | 24 ++++++++++++++++++++++++\n>  2 files changed, 32 insertions(+)\n> \n> diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h\n> index 29235ddf0d8a..1c5273004297 100644\n> --- a/include/libcamera/stream.h\n> +++ b/include/libcamera/stream.h\n> @@ -13,6 +13,8 @@\n>  #include <string>\n>  #include <vector>\n>  \n> +#include <libcamera/base/flags.h>\n> +\n>  #include <libcamera/color_space.h>\n>  #include <libcamera/framebuffer.h>\n>  #include <libcamera/geometry.h>\n> @@ -51,6 +53,12 @@ struct StreamConfiguration {\n>  \n>         std::optional<ColorSpace> colorSpace;\n>  \n> +       enum class Hint {\n> +               None = 0,\n> +               MandatoryRequestBuffer = (1 << 0),\n\nMight be bikeshedding, but reading later in the series I understand this\nto mean that this is a 'Mandatory Stream'.\n\nThat makes me think \"MandatoryStream\" is what we're hinting at ? But\neven that might not convey it fully, so I'm not opposed to\nMandatoryRequestBuffer.\n\nI get the idea here, but I don't currently know how we might expose to\napplications if the hints are 'possible'/'usable'/'valid'?\n\nOr maybe it doesn't matter for hints. Applications could just set them\nto say \"I'm going to do this...\" ? And it doesn't matter if the pipeline\nsupports it or not...\n\n\n> +       };\n> +       Flags<Hint> hints;\n> +\n>         Stream *stream() const { return stream_; }\n>         void setStream(Stream *stream) { stream_ = stream; }\n>         const StreamFormats &formats() const { return formats_; }\n> diff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp\n> index 67f308157fbf..504c6d86cd04 100644\n> --- a/src/libcamera/stream.cpp\n> +++ b/src/libcamera/stream.cpp\n> @@ -349,6 +349,30 @@ StreamConfiguration::StreamConfiguration(const StreamFormats &formats)\n>   * color spaces can be supported and in what combinations.\n>   */\n>  \n> +/**\n> + * \\enum StreamConfiguration::Hint\n> + * \\brief List of available hint flags provided by the application for a stream\n> + *\n> + * \\var StreamConfiguration::Hint::None\n> + * No hints for this stream.\n> + * \\var StreamConfiguration::Hint::MandatoryRequestBuffer\n> + * Informs the pipeline handler that the application guarantee to provide a\n\ns/guarantee/guarantees/\nor ..\nwill guarantee\n\n> + * buffer for the configured stream in the Request. This may allow the pipeline\n\n/in the Request/in every Request/\n\n> + * handler to allocate fewer (or no) buffers for internal use.\n> + */\n> +\n> +/**\n> + * \\var StreamConfiguration::hints\n> + * \\brief Application provided StreamConfiguration::Hint flags for specific\n> + * stream behavior\n> + *\n> + * Provides hints from the application to the pipeline handlers on how it\n> + * intends on handling a given configured stream. These hints may alter the\n> + * behavior of the pipeline handlers, for example, by allocating fewer buffers\n> + * for internal use if an application guarantees to always provide a buffer in\n> + * the Request for a stream.\n> + */\n> +\n>  /**\n>   * \\fn StreamConfiguration::stream()\n>   * \\brief Retrieve the stream associated with the configuration\n> -- \n> 2.25.1\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 82CEFBD87C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 16 Jan 2023 16:16:01 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id ECAA6625E4;\n\tMon, 16 Jan 2023 17:16:00 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 63E4D61F01\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 16 Jan 2023 17:15:59 +0100 (CET)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E2D76802;\n\tMon, 16 Jan 2023 17:15:58 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1673885761;\n\tbh=MV4JjpdYY0KrRj45nvkv6c+qaNf2Z/ffqsKTDJ241Ug=;\n\th=In-Reply-To:References:To:Date:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=oPfUE9Y8LygDMI24OMmOg/hurix2EwWZUI31lIT6MktOljrnuBU/uotSWg0W6vb1b\n\tShbjTyXk7+xtaPT2bbEv9Cjv9N4noHvuOcViy2GQyqCOL8AWVi1ey4Z1XvxPQ95luU\n\tP/ivJ6Je9onuaje94EYCof0gIp/PvWd0zmuJbGoLviRD2DrZC22uJ18ta0Uc/FEx0T\n\t7qMyEwfSLOKZkkrxtNWiBO3Rnoh5Siw03JCRePU33RTFYQxV9b5L5Z5KYlQcL2A92g\n\t441CFChXncNGfHucskTx7AT2KzuVdlFi6981xOxaSWzKNfnDBPE53H5Q7LiO7lujzb\n\tE4xN5RHAtGMDw==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1673885759;\n\tbh=MV4JjpdYY0KrRj45nvkv6c+qaNf2Z/ffqsKTDJ241Ug=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=uEt6e+l9ZHV9KP7TQn1ztQv4LVjExlPaOXOMTbnRj31Iz8Bdjcvtn2/9U5OyvkVSL\n\t6ge0PvczULwQcHzyYPecIaw2z/Ez6R97IiTE2XfPDKYgiILBpObOznSD4Z7IGfRia1\n\tPOOK9IDpDryLyICrhiz2FfgKivj5HDBKjG6YIXNA="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"uEt6e+l9\"; dkim-atps=neutral","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20221209090050.19441-2-naush@raspberrypi.com>","References":"<20221209090050.19441-1-naush@raspberrypi.com>\n\t<20221209090050.19441-2-naush@raspberrypi.com>","To":"Naushir Patuck <naush@raspberrypi.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Mon, 16 Jan 2023 16:15:56 +0000","Message-ID":"<167388575603.42371.7911015366897654333@Monstersaurus>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [PATCH v4 01/12] libcamera: stream: Add\n\tstream hints to StreamConfiguration","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>","From":"Kieran Bingham via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":26242,"web_url":"https://patchwork.libcamera.org/comment/26242/","msgid":"<167389089871.42371.14126090746612754535@Monstersaurus>","date":"2023-01-16T17:41:38","subject":"Re: [libcamera-devel] [PATCH v4 01/12] libcamera: stream: Add\n\tstream hints to StreamConfiguration","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Kieran Bingham (2023-01-16 16:15:56)\n> Quoting Naushir Patuck via libcamera-devel (2022-12-09 09:00:39)\n> > Add a new hints flags field in the StreamConfiguration structure to allow the\n> > application to specify certain intended behavior when driving libcamera.\n> > Pipeline handlers are expected to look at these hint flags and may optimise\n> > internal operations based on them.\n> > \n> > Currently, only one flag is listed, MandatoryRequestBuffer, which the\n> > application sets to guarantee that a buffer will be provided in the Request for\n> > each configured stream.\n> > \n> > Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> > ---\n> >  include/libcamera/stream.h |  8 ++++++++\n> >  src/libcamera/stream.cpp   | 24 ++++++++++++++++++++++++\n> >  2 files changed, 32 insertions(+)\n> > \n> > diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h\n> > index 29235ddf0d8a..1c5273004297 100644\n> > --- a/include/libcamera/stream.h\n> > +++ b/include/libcamera/stream.h\n> > @@ -13,6 +13,8 @@\n> >  #include <string>\n> >  #include <vector>\n> >  \n> > +#include <libcamera/base/flags.h>\n> > +\n> >  #include <libcamera/color_space.h>\n> >  #include <libcamera/framebuffer.h>\n> >  #include <libcamera/geometry.h>\n> > @@ -51,6 +53,12 @@ struct StreamConfiguration {\n> >  \n> >         std::optional<ColorSpace> colorSpace;\n> >  \n> > +       enum class Hint {\n> > +               None = 0,\n> > +               MandatoryRequestBuffer = (1 << 0),\n> \n> Might be bikeshedding, but reading later in the series I understand this\n> to mean that this is a 'Mandatory Stream'.\n> \n> That makes me think \"MandatoryStream\" is what we're hinting at ? But\n> even that might not convey it fully, so I'm not opposed to\n> MandatoryRequestBuffer.\n> \n> I get the idea here, but I don't currently know how we might expose to\n> applications if the hints are 'possible'/'usable'/'valid'?\n> \n> Or maybe it doesn't matter for hints. Applications could just set them\n> to say \"I'm going to do this...\" ? And it doesn't matter if the pipeline\n> supports it or not...\n\nAnd to throw in a spanner / go for discussions:\n\nTrying to think about this, I would expect that the 'default' case of\nmost applications handling a stream would be such that on that single\nstream - it's expected that the stream is a mandatory stream.\n\nThat means I'm tempted to suggest this is inverted...\n\nMake the stream hint 'optional' ... and only if the stream is marked as\noptional can the buffers not be added to a request?\n\nThat way - applications for single streams get the correct behaviour 'by\ndefault' ... while more complex systems with multiple streams define\nwhich stream is likely to be only provided optionally...\n\nThoughts anyone?\n\n--\nKieran\n\n\n> \n> \n> > +       };\n> > +       Flags<Hint> hints;\n> > +\n> >         Stream *stream() const { return stream_; }\n> >         void setStream(Stream *stream) { stream_ = stream; }\n> >         const StreamFormats &formats() const { return formats_; }\n> > diff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp\n> > index 67f308157fbf..504c6d86cd04 100644\n> > --- a/src/libcamera/stream.cpp\n> > +++ b/src/libcamera/stream.cpp\n> > @@ -349,6 +349,30 @@ StreamConfiguration::StreamConfiguration(const StreamFormats &formats)\n> >   * color spaces can be supported and in what combinations.\n> >   */\n> >  \n> > +/**\n> > + * \\enum StreamConfiguration::Hint\n> > + * \\brief List of available hint flags provided by the application for a stream\n> > + *\n> > + * \\var StreamConfiguration::Hint::None\n> > + * No hints for this stream.\n> > + * \\var StreamConfiguration::Hint::MandatoryRequestBuffer\n> > + * Informs the pipeline handler that the application guarantee to provide a\n> \n> s/guarantee/guarantees/\n> or ..\n> will guarantee\n> \n> > + * buffer for the configured stream in the Request. This may allow the pipeline\n> \n> /in the Request/in every Request/\n> \n> > + * handler to allocate fewer (or no) buffers for internal use.\n> > + */\n> > +\n> > +/**\n> > + * \\var StreamConfiguration::hints\n> > + * \\brief Application provided StreamConfiguration::Hint flags for specific\n> > + * stream behavior\n> > + *\n> > + * Provides hints from the application to the pipeline handlers on how it\n> > + * intends on handling a given configured stream. These hints may alter the\n> > + * behavior of the pipeline handlers, for example, by allocating fewer buffers\n> > + * for internal use if an application guarantees to always provide a buffer in\n> > + * the Request for a stream.\n> > + */\n> > +\n> >  /**\n> >   * \\fn StreamConfiguration::stream()\n> >   * \\brief Retrieve the stream associated with the configuration\n> > -- \n> > 2.25.1\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 B9267C3240\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 16 Jan 2023 17:41:43 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 29557625E4;\n\tMon, 16 Jan 2023 18:41:43 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D475B61F01\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 16 Jan 2023 18:41:41 +0100 (CET)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 61CC6802;\n\tMon, 16 Jan 2023 18:41:41 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1673890903;\n\tbh=qx3VGFCqFas6mQKHZCYofWJB9AevKHzvrLC5n6Mmehg=;\n\th=In-Reply-To:References:To:Date:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=eQ6pikvhix4crER+cudX0JM2Q8USgw81yuFAL3eQc5awTGNCEXa3xUsGV6Ombmz24\n\te4QrUhgabQEfr8vykklI9fs0ZRblunaoONTFrG6zLGasVpcq+6QEj6IwDhSvEs649I\n\tD7x+UD9loaMkTKNkDyFIs7ntcV3BJd0ZeR1o+sQfUlyr8rkrkNwSt2DLcgLHMKwoCo\n\t7yfTNukIprPKv3yi+oOHW60khPWlXEURjQ2tjOl3QY3XgKv1QZVgiwlCKXMVAx5a/2\n\tEZtc9VIKum99F9RJGGZdeyZRUX+rc5gzSNs/zQqw8Kwvw1BB1uWN5XRBwQpiQC1duZ\n\to0FlD57rdrOKQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1673890901;\n\tbh=qx3VGFCqFas6mQKHZCYofWJB9AevKHzvrLC5n6Mmehg=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=KAFJ1km5IZnG6akfOChvuEwQQFki7Q+/cUJxlBlvEfA/qwY1AQPfyg1xHXc2Di+Hd\n\tCOo94oy46fqncGdjPTBTHYRgGX6MC+pykI7hNsih/5T3S1uMV7Ajvc6xYAVlpi2neS\n\tjBoNF7IoBgyf1+vZ9NdYPZTeTqQH53YBtvPB8rmc="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"KAFJ1km5\"; dkim-atps=neutral","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<167388575603.42371.7911015366897654333@Monstersaurus>","References":"<20221209090050.19441-1-naush@raspberrypi.com>\n\t<20221209090050.19441-2-naush@raspberrypi.com>\n\t<167388575603.42371.7911015366897654333@Monstersaurus>","To":"Naushir Patuck <naush@raspberrypi.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Mon, 16 Jan 2023 17:41:38 +0000","Message-ID":"<167389089871.42371.14126090746612754535@Monstersaurus>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [PATCH v4 01/12] libcamera: stream: Add\n\tstream hints to StreamConfiguration","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>","From":"Kieran Bingham via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":26243,"web_url":"https://patchwork.libcamera.org/comment/26243/","msgid":"<167389101492.42371.8814323026565581440@Monstersaurus>","date":"2023-01-16T17:43:34","subject":"Re: [libcamera-devel] [PATCH v4 01/12] libcamera: stream: Add\n\tstream hints to StreamConfiguration","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Kieran Bingham (2023-01-16 17:41:38)\n> Quoting Kieran Bingham (2023-01-16 16:15:56)\n> > Quoting Naushir Patuck via libcamera-devel (2022-12-09 09:00:39)\n> > > Add a new hints flags field in the StreamConfiguration structure to allow the\n> > > application to specify certain intended behavior when driving libcamera.\n> > > Pipeline handlers are expected to look at these hint flags and may optimise\n> > > internal operations based on them.\n> > > \n> > > Currently, only one flag is listed, MandatoryRequestBuffer, which the\n> > > application sets to guarantee that a buffer will be provided in the Request for\n> > > each configured stream.\n> > > \n> > > Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> > > ---\n> > >  include/libcamera/stream.h |  8 ++++++++\n> > >  src/libcamera/stream.cpp   | 24 ++++++++++++++++++++++++\n> > >  2 files changed, 32 insertions(+)\n> > > \n> > > diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h\n> > > index 29235ddf0d8a..1c5273004297 100644\n> > > --- a/include/libcamera/stream.h\n> > > +++ b/include/libcamera/stream.h\n> > > @@ -13,6 +13,8 @@\n> > >  #include <string>\n> > >  #include <vector>\n> > >  \n> > > +#include <libcamera/base/flags.h>\n> > > +\n> > >  #include <libcamera/color_space.h>\n> > >  #include <libcamera/framebuffer.h>\n> > >  #include <libcamera/geometry.h>\n> > > @@ -51,6 +53,12 @@ struct StreamConfiguration {\n> > >  \n> > >         std::optional<ColorSpace> colorSpace;\n> > >  \n> > > +       enum class Hint {\n> > > +               None = 0,\n> > > +               MandatoryRequestBuffer = (1 << 0),\n> > \n> > Might be bikeshedding, but reading later in the series I understand this\n> > to mean that this is a 'Mandatory Stream'.\n> > \n> > That makes me think \"MandatoryStream\" is what we're hinting at ? But\n> > even that might not convey it fully, so I'm not opposed to\n> > MandatoryRequestBuffer.\n> > \n> > I get the idea here, but I don't currently know how we might expose to\n> > applications if the hints are 'possible'/'usable'/'valid'?\n> > \n> > Or maybe it doesn't matter for hints. Applications could just set them\n> > to say \"I'm going to do this...\" ? And it doesn't matter if the pipeline\n> > supports it or not...\n> \n> And to throw in a spanner / go for discussions:\n> \n> Trying to think about this, I would expect that the 'default' case of\n> most applications handling a stream would be such that on that single\n> stream - it's expected that the stream is a mandatory stream.\n> \n> That means I'm tempted to suggest this is inverted...\n> \n> Make the stream hint 'optional' ... and only if the stream is marked as\n> optional can the buffers not be added to a request?\n> \n> That way - applications for single streams get the correct behaviour 'by\n> default' ... while more complex systems with multiple streams define\n> which stream is likely to be only provided optionally...\n\nThis way around, we can also add a check when the request is queued. If\nany stream is not marked as optional - and doesn't have a buffer, -\nfail the request ?\n\n--\nKieran\n\n\n> \n> Thoughts anyone?\n> \n> --\n> Kieran\n> \n> \n> > \n> > \n> > > +       };\n> > > +       Flags<Hint> hints;\n> > > +\n> > >         Stream *stream() const { return stream_; }\n> > >         void setStream(Stream *stream) { stream_ = stream; }\n> > >         const StreamFormats &formats() const { return formats_; }\n> > > diff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp\n> > > index 67f308157fbf..504c6d86cd04 100644\n> > > --- a/src/libcamera/stream.cpp\n> > > +++ b/src/libcamera/stream.cpp\n> > > @@ -349,6 +349,30 @@ StreamConfiguration::StreamConfiguration(const StreamFormats &formats)\n> > >   * color spaces can be supported and in what combinations.\n> > >   */\n> > >  \n> > > +/**\n> > > + * \\enum StreamConfiguration::Hint\n> > > + * \\brief List of available hint flags provided by the application for a stream\n> > > + *\n> > > + * \\var StreamConfiguration::Hint::None\n> > > + * No hints for this stream.\n> > > + * \\var StreamConfiguration::Hint::MandatoryRequestBuffer\n> > > + * Informs the pipeline handler that the application guarantee to provide a\n> > \n> > s/guarantee/guarantees/\n> > or ..\n> > will guarantee\n> > \n> > > + * buffer for the configured stream in the Request. This may allow the pipeline\n> > \n> > /in the Request/in every Request/\n> > \n> > > + * handler to allocate fewer (or no) buffers for internal use.\n> > > + */\n> > > +\n> > > +/**\n> > > + * \\var StreamConfiguration::hints\n> > > + * \\brief Application provided StreamConfiguration::Hint flags for specific\n> > > + * stream behavior\n> > > + *\n> > > + * Provides hints from the application to the pipeline handlers on how it\n> > > + * intends on handling a given configured stream. These hints may alter the\n> > > + * behavior of the pipeline handlers, for example, by allocating fewer buffers\n> > > + * for internal use if an application guarantees to always provide a buffer in\n> > > + * the Request for a stream.\n> > > + */\n> > > +\n> > >  /**\n> > >   * \\fn StreamConfiguration::stream()\n> > >   * \\brief Retrieve the stream associated with the configuration\n> > > -- \n> > > 2.25.1\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 77DFAC3240\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 16 Jan 2023 17:43:40 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D5E36625D8;\n\tMon, 16 Jan 2023 18:43:39 +0100 (CET)","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 921D861F01\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 16 Jan 2023 18:43:37 +0100 (CET)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 25AA6802;\n\tMon, 16 Jan 2023 18:43:37 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1673891019;\n\tbh=BydQbMotw7KHUmQ9n+QtdA3wIAiggm7UsjlVTA+vFvY=;\n\th=In-Reply-To:References:To:Date:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=UQ6p68uUh6UVFQKyT4i/8Cmy5Wqb5Ssb/faI8GTwz8u1l9uRjHRxScJkjuLdsxZ8v\n\tjngbFpQKPsmPV8PEo0ZafPt2vijBHfOyXI8c4D7sJPH4USorA1lVeJ0zEXco/jy09c\n\t2hVDHP3VNxA9f2nURYWvk3p5Srf0VwE4/A/34F0CrLai5HpoULqASQrAyEXZ+h/w71\n\tuR/607523V+1YJadiaWk5FzaN9IdwSDPbLkoJVCCitfSZdvIARP/vQRu1K+tqfYH3W\n\t2yVJ4LKLaIl44DkjUqGxdX+/VmH2AR4i7C77PQsxZYpa4SsNCff5r7wZTHWMi+P79L\n\tHS82JgygW72kA==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1673891017;\n\tbh=BydQbMotw7KHUmQ9n+QtdA3wIAiggm7UsjlVTA+vFvY=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=FTB713a3f6qnuKs9uNL+USmFmQDS405ORJTPXnNu81Z8M0bDCNtLE30eQwcHASWAs\n\tFheKmshyVeTPRahSg4L+nh/bw6En1SH+Q7IKlKnGkcrrvbba5Ozsg+Q3iXeOQVV6dk\n\tFdAm4a6TjQ7W+wafSEYH6yyhfcMJbG40W16X7DC4="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"FTB713a3\"; dkim-atps=neutral","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<167389089871.42371.14126090746612754535@Monstersaurus>","References":"<20221209090050.19441-1-naush@raspberrypi.com>\n\t<20221209090050.19441-2-naush@raspberrypi.com>\n\t<167388575603.42371.7911015366897654333@Monstersaurus>\n\t<167389089871.42371.14126090746612754535@Monstersaurus>","To":"Naushir Patuck <naush@raspberrypi.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Mon, 16 Jan 2023 17:43:34 +0000","Message-ID":"<167389101492.42371.8814323026565581440@Monstersaurus>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [PATCH v4 01/12] libcamera: stream: Add\n\tstream hints to StreamConfiguration","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>","From":"Kieran Bingham via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":26247,"web_url":"https://patchwork.libcamera.org/comment/26247/","msgid":"<CAEmqJPr5TDE4ameYrXwKhyYFLysXH3iNbzHUio=uhUsJo8193w@mail.gmail.com>","date":"2023-01-17T09:02:53","subject":"Re: [libcamera-devel] [PATCH v4 01/12] libcamera: stream: Add\n\tstream hints to StreamConfiguration","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"content":"Hi Kieran,\n\nThanks for your feedback!\n\nOn Mon, 16 Jan 2023 at 17:43, Kieran Bingham <\nkieran.bingham@ideasonboard.com> wrote:\n\n> Quoting Kieran Bingham (2023-01-16 17:41:38)\n> > Quoting Kieran Bingham (2023-01-16 16:15:56)\n> > > Quoting Naushir Patuck via libcamera-devel (2022-12-09 09:00:39)\n> > > > Add a new hints flags field in the StreamConfiguration structure to\n> allow the\n> > > > application to specify certain intended behavior when driving\n> libcamera.\n> > > > Pipeline handlers are expected to look at these hint flags and may\n> optimise\n> > > > internal operations based on them.\n> > > >\n> > > > Currently, only one flag is listed, MandatoryRequestBuffer, which the\n> > > > application sets to guarantee that a buffer will be provided in the\n> Request for\n> > > > each configured stream.\n> > > >\n> > > > Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> > > > ---\n> > > >  include/libcamera/stream.h |  8 ++++++++\n> > > >  src/libcamera/stream.cpp   | 24 ++++++++++++++++++++++++\n> > > >  2 files changed, 32 insertions(+)\n> > > >\n> > > > diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h\n> > > > index 29235ddf0d8a..1c5273004297 100644\n> > > > --- a/include/libcamera/stream.h\n> > > > +++ b/include/libcamera/stream.h\n> > > > @@ -13,6 +13,8 @@\n> > > >  #include <string>\n> > > >  #include <vector>\n> > > >\n> > > > +#include <libcamera/base/flags.h>\n> > > > +\n> > > >  #include <libcamera/color_space.h>\n> > > >  #include <libcamera/framebuffer.h>\n> > > >  #include <libcamera/geometry.h>\n> > > > @@ -51,6 +53,12 @@ struct StreamConfiguration {\n> > > >\n> > > >         std::optional<ColorSpace> colorSpace;\n> > > >\n> > > > +       enum class Hint {\n> > > > +               None = 0,\n> > > > +               MandatoryRequestBuffer = (1 << 0),\n> > >\n> > > Might be bikeshedding, but reading later in the series I understand\n> this\n> > > to mean that this is a 'Mandatory Stream'.\n> > >\n> > > That makes me think \"MandatoryStream\" is what we're hinting at ? But\n> > > even that might not convey it fully, so I'm not opposed to\n> > > MandatoryRequestBuffer.\n> > >\n> > > I get the idea here, but I don't currently know how we might expose to\n> > > applications if the hints are 'possible'/'usable'/'valid'?\n> > >\n> > > Or maybe it doesn't matter for hints. Applications could just set them\n> > > to say \"I'm going to do this...\" ? And it doesn't matter if the\n> pipeline\n> > > supports it or not...\n> >\n> > And to throw in a spanner / go for discussions:\n> >\n> > Trying to think about this, I would expect that the 'default' case of\n> > most applications handling a stream would be such that on that single\n> > stream - it's expected that the stream is a mandatory stream.\n> >\n> > That means I'm tempted to suggest this is inverted...\n> >\n> > Make the stream hint 'optional' ... and only if the stream is marked as\n> > optional can the buffers not be added to a request?\n> >\n> > That way - applications for single streams get the correct behaviour 'by\n> > default' ... while more complex systems with multiple streams define\n> > which stream is likely to be only provided optionally...\n>\n\nSo your suggestion would be to have the hint be inverted so perhaps called\noptionalStream, and buffers must always be passed in through the requests\nfor\nstreams where optionalStream == false?  That seems reasonable to me.\n\n\n>\n> This way around, we can also add a check when the request is queued. If\n> any stream is not marked as optional - and doesn't have a buffer, -\n> fail the request ?\n>\n\nWe do exactly this a few commits in - but for the current sense of the hint.\nIt should be trivial to flip the sense of this test.\n\nI'll wait a bit for any more feedback on the rest of the patches and post a\nv6\nwith this change soon.\n\nRegards,\nNaush\n\n\n>\n> --\n> Kieran\n>\n>\n> >\n> > Thoughts anyone?\n> >\n> > --\n> > Kieran\n> >\n> >\n> > >\n> > >\n> > > > +       };\n> > > > +       Flags<Hint> hints;\n> > > > +\n> > > >         Stream *stream() const { return stream_; }\n> > > >         void setStream(Stream *stream) { stream_ = stream; }\n> > > >         const StreamFormats &formats() const { return formats_; }\n> > > > diff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp\n> > > > index 67f308157fbf..504c6d86cd04 100644\n> > > > --- a/src/libcamera/stream.cpp\n> > > > +++ b/src/libcamera/stream.cpp\n> > > > @@ -349,6 +349,30 @@ StreamConfiguration::StreamConfiguration(const\n> StreamFormats &formats)\n> > > >   * color spaces can be supported and in what combinations.\n> > > >   */\n> > > >\n> > > > +/**\n> > > > + * \\enum StreamConfiguration::Hint\n> > > > + * \\brief List of available hint flags provided by the application\n> for a stream\n> > > > + *\n> > > > + * \\var StreamConfiguration::Hint::None\n> > > > + * No hints for this stream.\n> > > > + * \\var StreamConfiguration::Hint::MandatoryRequestBuffer\n> > > > + * Informs the pipeline handler that the application guarantee to\n> provide a\n> > >\n> > > s/guarantee/guarantees/\n> > > or ..\n> > > will guarantee\n> > >\n> > > > + * buffer for the configured stream in the Request. This may allow\n> the pipeline\n> > >\n> > > /in the Request/in every Request/\n> > >\n> > > > + * handler to allocate fewer (or no) buffers for internal use.\n> > > > + */\n> > > > +\n> > > > +/**\n> > > > + * \\var StreamConfiguration::hints\n> > > > + * \\brief Application provided StreamConfiguration::Hint flags for\n> specific\n> > > > + * stream behavior\n> > > > + *\n> > > > + * Provides hints from the application to the pipeline handlers on\n> how it\n> > > > + * intends on handling a given configured stream. These hints may\n> alter the\n> > > > + * behavior of the pipeline handlers, for example, by allocating\n> fewer buffers\n> > > > + * for internal use if an application guarantees to always provide\n> a buffer in\n> > > > + * the Request for a stream.\n> > > > + */\n> > > > +\n> > > >  /**\n> > > >   * \\fn StreamConfiguration::stream()\n> > > >   * \\brief Retrieve the stream associated with the configuration\n> > > > --\n> > > > 2.25.1\n> > > >\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 9F55EBD87C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 17 Jan 2023 09:03:11 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id DED6C625E4;\n\tTue, 17 Jan 2023 10:03:10 +0100 (CET)","from mail-yb1-xb35.google.com (mail-yb1-xb35.google.com\n\t[IPv6:2607:f8b0:4864:20::b35])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C7A1661EFE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 17 Jan 2023 10:03:09 +0100 (CET)","by mail-yb1-xb35.google.com with SMTP id c124so33135222ybb.13\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 17 Jan 2023 01:03:09 -0800 (PST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1673946190;\n\tbh=BHQoGwNjUMC6lt2MvKvDJnf2zQYbysyua4GACrEc1xY=;\n\th=References:In-Reply-To:Date:To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=IyuMjcSq6TpTqEibMcSvMIg9kejR9mfErAUC2/mFpeOuZGz+1g7SLBPgx0BZKRlee\n\tK85zBG7m5o5sC+My0xleGSwKgzYg1t+ngCC6AWPaPtfovpssXxPCAMI274+wxWs/nh\n\thi2eqPlkRNsClvTy+mkLB6OzlkGQ8uRrHP+yJeGjqtxffeKcIkjXJZS1SJosX1gu/q\n\tNTPwlWRpabUfWifX7QqzsGuWpxGFH+ONhfs8tzF+SMiJNkSfb2kInVrKqlffyUFxIV\n\t0Z3yGS+k2g+cFkFg5G6Rxk80dOZbzl8etkaie0K3CLmoakIrWAgGEYXG6mgH+ZTCvQ\n\th3PchYZdazWEg==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:from:to:cc:subject:date:message-id:reply-to;\n\tbh=E2WTddCgbGg+O6Wu7OGsrG2ykNIqr+ueZZ29Eue/XLA=;\n\tb=g2Yq+lC6rOXo2oOCc2RX5b4XWQbiLB1Ajn/nXnNZypdQJX/YL+OLQB+MyUwEqZEcw3\n\trG5tauo2D2D6RltYemnl81buNpoSqcBsLKf6pTd34B3YrEpSnE0Zw10Z8TrZSlceNmc5\n\txkBmMdxdFxBh3dh2+Jpkvj+JWxOOqVB45SX640A+Fjm4ClYHOfl+Nt8D6Ue6fSEHfPq0\n\t/cw4mXZTBIcqoZSPCh8cmnCwc8H3Pgr3rm9Vvhz7PAZIdcZaMQ5XPA0ADa+Aj/onFAgd\n\tlrnkE7IPOTf+O6EFI5Fnj3yIqRvcVpwlicF1gQUWyETxfiRiEXkPCWnSwGYSfObGIxF4\n\taBzg=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"g2Yq+lC6\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:x-gm-message-state:from:to:cc:subject:date:message-id\n\t:reply-to;\n\tbh=E2WTddCgbGg+O6Wu7OGsrG2ykNIqr+ueZZ29Eue/XLA=;\n\tb=00cn5vbuR26AvzDFyMc3dGc1iUSIZtaG5xkWt4oUErRlsu+cDnuLBuFHG0uRGRB7Ho\n\thmIyngYTxhfM6fdrqDtnNHI4/Cch58d/AZhbcW0eBLVfE9C5VV57s4sqj4dF1vTePDoa\n\tTdMlIOWgrnoLW4cVHWZAiVIx+0zKeQUz3KqpF/qdGz3e/QSB/wfuU2ljuwHmZepjQ8Yh\n\tGJiw0OCRYexwJpqxeldqYnuuHcocD/1HxYgu3hEnofoFfspjLx1Tp+KXbmGDNn2Q1FEu\n\tUNS/q0n15nMo1RCxmacgmkBiILOXmZfaAU5cTWZ937wwiBqv6ACZUnQzLSg8F9Oy8B3N\n\t7cbw==","X-Gm-Message-State":"AFqh2ko8Q2PxFzvr3E0YDs2Og9ycTwGK9b8vIYix+NEjUmixgLUCY63q\n\tbKfS4LFpo45NjxA4sgTyPsN/9T1Cg1BlBf1LR+x7HY/A7T67/vy56G0=","X-Google-Smtp-Source":"AMrXdXs9HBMgwFLYL1OXuEDYZ97rwFlNXTxmVg6dp0ofneDjPNmqNd90f+8uxXeAuntRwTjtg3owSwHo2zDrTG/wMC8=","X-Received":"by 2002:a25:2f89:0:b0:758:65d6:915f with SMTP id\n\tv131-20020a252f89000000b0075865d6915fmr222644ybv.582.1673946188549;\n\tTue, 17 Jan 2023 01:03:08 -0800 (PST)","MIME-Version":"1.0","References":"<20221209090050.19441-1-naush@raspberrypi.com>\n\t<20221209090050.19441-2-naush@raspberrypi.com>\n\t<167388575603.42371.7911015366897654333@Monstersaurus>\n\t<167389089871.42371.14126090746612754535@Monstersaurus>\n\t<167389101492.42371.8814323026565581440@Monstersaurus>","In-Reply-To":"<167389101492.42371.8814323026565581440@Monstersaurus>","Date":"Tue, 17 Jan 2023 09:02:53 +0000","Message-ID":"<CAEmqJPr5TDE4ameYrXwKhyYFLysXH3iNbzHUio=uhUsJo8193w@mail.gmail.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Content-Type":"multipart/alternative; boundary=\"000000000000f128a205f271f79f\"","Subject":"Re: [libcamera-devel] [PATCH v4 01/12] libcamera: stream: Add\n\tstream hints to StreamConfiguration","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>","From":"Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Naushir Patuck <naush@raspberrypi.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":26248,"web_url":"https://patchwork.libcamera.org/comment/26248/","msgid":"<167394750126.42371.15160310746013863236@Monstersaurus>","date":"2023-01-17T09:25:01","subject":"Re: [libcamera-devel] [PATCH v4 01/12] libcamera: stream: Add\n\tstream hints to StreamConfiguration","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Naushir Patuck (2023-01-17 09:02:53)\n> Hi Kieran,\n> \n> Thanks for your feedback!\n> \n> On Mon, 16 Jan 2023 at 17:43, Kieran Bingham <\n> kieran.bingham@ideasonboard.com> wrote:\n> \n> > Quoting Kieran Bingham (2023-01-16 17:41:38)\n> > > Quoting Kieran Bingham (2023-01-16 16:15:56)\n> > > > Quoting Naushir Patuck via libcamera-devel (2022-12-09 09:00:39)\n> > > > > Add a new hints flags field in the StreamConfiguration structure to\n> > allow the\n> > > > > application to specify certain intended behavior when driving\n> > libcamera.\n> > > > > Pipeline handlers are expected to look at these hint flags and may\n> > optimise\n> > > > > internal operations based on them.\n> > > > >\n> > > > > Currently, only one flag is listed, MandatoryRequestBuffer, which the\n> > > > > application sets to guarantee that a buffer will be provided in the\n> > Request for\n> > > > > each configured stream.\n> > > > >\n> > > > > Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> > > > > ---\n> > > > >  include/libcamera/stream.h |  8 ++++++++\n> > > > >  src/libcamera/stream.cpp   | 24 ++++++++++++++++++++++++\n> > > > >  2 files changed, 32 insertions(+)\n> > > > >\n> > > > > diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h\n> > > > > index 29235ddf0d8a..1c5273004297 100644\n> > > > > --- a/include/libcamera/stream.h\n> > > > > +++ b/include/libcamera/stream.h\n> > > > > @@ -13,6 +13,8 @@\n> > > > >  #include <string>\n> > > > >  #include <vector>\n> > > > >\n> > > > > +#include <libcamera/base/flags.h>\n> > > > > +\n> > > > >  #include <libcamera/color_space.h>\n> > > > >  #include <libcamera/framebuffer.h>\n> > > > >  #include <libcamera/geometry.h>\n> > > > > @@ -51,6 +53,12 @@ struct StreamConfiguration {\n> > > > >\n> > > > >         std::optional<ColorSpace> colorSpace;\n> > > > >\n> > > > > +       enum class Hint {\n> > > > > +               None = 0,\n> > > > > +               MandatoryRequestBuffer = (1 << 0),\n> > > >\n> > > > Might be bikeshedding, but reading later in the series I understand\n> > this\n> > > > to mean that this is a 'Mandatory Stream'.\n> > > >\n> > > > That makes me think \"MandatoryStream\" is what we're hinting at ? But\n> > > > even that might not convey it fully, so I'm not opposed to\n> > > > MandatoryRequestBuffer.\n> > > >\n> > > > I get the idea here, but I don't currently know how we might expose to\n> > > > applications if the hints are 'possible'/'usable'/'valid'?\n> > > >\n> > > > Or maybe it doesn't matter for hints. Applications could just set them\n> > > > to say \"I'm going to do this...\" ? And it doesn't matter if the\n> > pipeline\n> > > > supports it or not...\n> > >\n> > > And to throw in a spanner / go for discussions:\n> > >\n> > > Trying to think about this, I would expect that the 'default' case of\n> > > most applications handling a stream would be such that on that single\n> > > stream - it's expected that the stream is a mandatory stream.\n> > >\n> > > That means I'm tempted to suggest this is inverted...\n> > >\n> > > Make the stream hint 'optional' ... and only if the stream is marked as\n> > > optional can the buffers not be added to a request?\n> > >\n> > > That way - applications for single streams get the correct behaviour 'by\n> > > default' ... while more complex systems with multiple streams define\n> > > which stream is likely to be only provided optionally...\n> >\n> \n> So your suggestion would be to have the hint be inverted so perhaps called\n> optionalStream, and buffers must always be passed in through the requests\n> for\n> streams where optionalStream == false?  That seems reasonable to me.\n> \n> \n> >\n> > This way around, we can also add a check when the request is queued. If\n> > any stream is not marked as optional - and doesn't have a buffer, -\n> > fail the request ?\n> >\n> \n> We do exactly this a few commits in - but for the current sense of the hint.\n> It should be trivial to flip the sense of this test.\n\nThat's true, of course the test can be done in both orientations ;-)\n\n> I'll wait a bit for any more feedback on the rest of the patches and post a\n> v6\n> with this change soon.\n\nI'll highlight this to the others to see if anyone can object or\n'prefer' one way or the other sooner rather than later.\n\n--\nKieran\n\n\n> Regards,\n> Naush\n> \n> \n> >\n> > --\n> > Kieran\n> >\n> >\n> > >\n> > > Thoughts anyone?\n> > >\n> > > --\n> > > Kieran\n> > >\n> > >\n> > > >\n> > > >\n> > > > > +       };\n> > > > > +       Flags<Hint> hints;\n> > > > > +\n> > > > >         Stream *stream() const { return stream_; }\n> > > > >         void setStream(Stream *stream) { stream_ = stream; }\n> > > > >         const StreamFormats &formats() const { return formats_; }\n> > > > > diff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp\n> > > > > index 67f308157fbf..504c6d86cd04 100644\n> > > > > --- a/src/libcamera/stream.cpp\n> > > > > +++ b/src/libcamera/stream.cpp\n> > > > > @@ -349,6 +349,30 @@ StreamConfiguration::StreamConfiguration(const\n> > StreamFormats &formats)\n> > > > >   * color spaces can be supported and in what combinations.\n> > > > >   */\n> > > > >\n> > > > > +/**\n> > > > > + * \\enum StreamConfiguration::Hint\n> > > > > + * \\brief List of available hint flags provided by the application\n> > for a stream\n> > > > > + *\n> > > > > + * \\var StreamConfiguration::Hint::None\n> > > > > + * No hints for this stream.\n> > > > > + * \\var StreamConfiguration::Hint::MandatoryRequestBuffer\n> > > > > + * Informs the pipeline handler that the application guarantee to\n> > provide a\n> > > >\n> > > > s/guarantee/guarantees/\n> > > > or ..\n> > > > will guarantee\n> > > >\n> > > > > + * buffer for the configured stream in the Request. This may allow\n> > the pipeline\n> > > >\n> > > > /in the Request/in every Request/\n> > > >\n> > > > > + * handler to allocate fewer (or no) buffers for internal use.\n> > > > > + */\n> > > > > +\n> > > > > +/**\n> > > > > + * \\var StreamConfiguration::hints\n> > > > > + * \\brief Application provided StreamConfiguration::Hint flags for\n> > specific\n> > > > > + * stream behavior\n> > > > > + *\n> > > > > + * Provides hints from the application to the pipeline handlers on\n> > how it\n> > > > > + * intends on handling a given configured stream. These hints may\n> > alter the\n> > > > > + * behavior of the pipeline handlers, for example, by allocating\n> > fewer buffers\n> > > > > + * for internal use if an application guarantees to always provide\n> > a buffer in\n> > > > > + * the Request for a stream.\n> > > > > + */\n> > > > > +\n> > > > >  /**\n> > > > >   * \\fn StreamConfiguration::stream()\n> > > > >   * \\brief Retrieve the stream associated with the configuration\n> > > > > --\n> > > > > 2.25.1\n> > > > >\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 AD006C3240\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 17 Jan 2023 09:25:06 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1AB5E625D8;\n\tTue, 17 Jan 2023 10:25:06 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4B36561EFE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 17 Jan 2023 10:25:04 +0100 (CET)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id BED4310C;\n\tTue, 17 Jan 2023 10:25:03 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1673947506;\n\tbh=MtUOBuv4sOXIgNsQVFZ/v4BCPu8Kku2aN06XDnMxRZs=;\n\th=In-Reply-To:References:To:Date:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=Rpi5qgszvQ4Dq+9DUoIK+/2S1ckrSUci0MOJgJlTJos9TAyjTy9/lWGRDKgoWv3yj\n\t9IzOJ1qLjSYalTt6PWaiYAuazBFsjoz/UYDeiFZY40Isyf64cAzut6qKc+AyZGQXu5\n\tjmlTTSxrr912K5xkERnqMjA5PXT0rCYihnywKxhUMwltwF714BS541nXGnapdy/4WH\n\tTEFIDwIOFYQTD4ZempobkncRYi9Iq7e0X6h2XE8DEjQ021Vx9rQOyHWnK6LzY7rbHI\n\tP4vC8N3hbkOpq5ag4WGzUXlpD36FIqwq+YJAQV2JffiWwKOVTB28Mj97HrB3mCPqsu\n\tuw+41jjzjUe/Q==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1673947503;\n\tbh=MtUOBuv4sOXIgNsQVFZ/v4BCPu8Kku2aN06XDnMxRZs=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=aDAaEOUMo0BRfdXujdKJuADX67P6kwtUzyaYOco44xWWWv6GEyc7KAFeY9ne46wP9\n\t9ZIb51MEEIIql4Oj+dZiHaNhAJt+J5BnaCzUJOSyNqk8CSCYFgJIuvtjf93Y39ncEU\n\t962YNUbtir632AnO1XH84d1MRzgxaVOQzRNGz4KI="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"aDAaEOUM\"; dkim-atps=neutral","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<CAEmqJPr5TDE4ameYrXwKhyYFLysXH3iNbzHUio=uhUsJo8193w@mail.gmail.com>","References":"<20221209090050.19441-1-naush@raspberrypi.com>\n\t<20221209090050.19441-2-naush@raspberrypi.com>\n\t<167388575603.42371.7911015366897654333@Monstersaurus>\n\t<167389089871.42371.14126090746612754535@Monstersaurus>\n\t<167389101492.42371.8814323026565581440@Monstersaurus>\n\t<CAEmqJPr5TDE4ameYrXwKhyYFLysXH3iNbzHUio=uhUsJo8193w@mail.gmail.com>","To":"Naushir Patuck <naush@raspberrypi.com>","Date":"Tue, 17 Jan 2023 09:25:01 +0000","Message-ID":"<167394750126.42371.15160310746013863236@Monstersaurus>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [PATCH v4 01/12] libcamera: stream: Add\n\tstream hints to StreamConfiguration","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>","From":"Kieran Bingham via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]