[{"id":26376,"web_url":"https://patchwork.libcamera.org/comment/26376/","msgid":"<167508616440.42371.3692729332602009799@Monstersaurus>","date":"2023-01-30T13:42:44","subject":"Re: [libcamera-devel] [PATCH v6 01/15] 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 (2023-01-27 15:43:08)\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, MandatoryStream, which the application can\n> set to inform the pipeline handler that a buffer will always be provided on\n> every Request for a given stream.\n> \n> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n\nWell I think this sounds reasonable now, and I've better understood the\nuse cases so I'll give this.\n\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n\n> ---\n>  include/libcamera/stream.h |  8 ++++++++\n>  src/libcamera/stream.cpp   | 25 +++++++++++++++++++++++++\n>  2 files changed, 33 insertions(+)\n> \n> diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h\n> index 29235ddf0d8a..56e5a74b2aab 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> +               MandatoryStream = (1 << 0),\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..9b0e8dd548cf 100644\n> --- a/src/libcamera/stream.cpp\n> +++ b/src/libcamera/stream.cpp\n> @@ -349,6 +349,31 @@ 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::MandatoryStream\n> + * Informs the pipeline handler that the application will always provide a\n> + * buffer for the configured stream in every Request. This may ensure the\n> + * pipeline handler does not need any additional stream buffer allocations for\n> + * 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 not allocating additional\n> + * buffers for internal use if an application guarantees buffers will be\n> + * provided in every 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 1B575BDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 30 Jan 2023 13:42:49 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 67D81625D8;\n\tMon, 30 Jan 2023 14:42:48 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3F53460482\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 30 Jan 2023 14:42:47 +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 CF0798B8;\n\tMon, 30 Jan 2023 14:42:46 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1675086168;\n\tbh=bBfbqwDvGujtHkowaCne9dlrAFXITq+QqGVDI+4HXFw=;\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=tSYKt40NDArVr1NEk5ZOoeoO2/zvYF7m66buCNxYRYic3xGueO5PZzw0+r1t6z8Fo\n\tzigEkSwCK6537/HmrrHRd9H7un1FqF+CYTBMo6DxdDfyu0FwJWhlEMtdBWQV/El/1y\n\tK6bhNMf8ctkFpAXxTS3ilirnla06+ts+j21b/SniNmJ6suZ5Z/JFgkEi1eiyYN13d2\n\tiVxWET+QVSU+EipY8aUwdxaergh0YKoa5u+DnmqMN4xYO7ziEYleH30ZuLxv0sz44X\n\t5QeEVDE2IuR1ruwzWJMKOVvIugfraIn4oZHNxOocjOivTgKLNMpSN792Uuwk5NSr29\n\tuKY51tSioj9Qw==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1675086166;\n\tbh=bBfbqwDvGujtHkowaCne9dlrAFXITq+QqGVDI+4HXFw=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=Ru9+AOrheUlkK+fKaCoa/zXogvS2c70TCCgb8nCGLygYlWCpj6ciLXWEx8pL5lLwU\n\trGhuWymbT7vEb5Bb4dGVWaIN6npmDox+82juqDUqPgQyFZdprLL914VQchX+aMMgPk\n\tsfhCtcvsrfKuR66WzuuRxffGW24erfe+E9Zx07ao="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"Ru9+AOrh\"; dkim-atps=neutral","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20230127154322.29019-2-naush@raspberrypi.com>","References":"<20230127154322.29019-1-naush@raspberrypi.com>\n\t<20230127154322.29019-2-naush@raspberrypi.com>","To":"Naushir Patuck <naush@raspberrypi.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Mon, 30 Jan 2023 13:42:44 +0000","Message-ID":"<167508616440.42371.3692729332602009799@Monstersaurus>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [PATCH v6 01/15] 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>"}}]