From patchwork Fri Dec 9 09:00:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 17965 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 9DB55BDE6B for ; Fri, 9 Dec 2022 09:01:32 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E201363356; Fri, 9 Dec 2022 10:01:30 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1670576490; bh=6TPR2QHCOzSmsRgML58GJeHoEheaiRbUfY1Sp25II2M=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=NEirU1zKsPhFz0yWxm5uXOgIkpfRn/7P9Aq+9Hrv3kgdMH3bxIOcCemumBiNarp4q DSb7643GsdT40QlEFM5ssy9qRfRij9X3nKeVCPkyzlErhqbfcXjuX/ArjQQqbIoIIE 7oHRxo2280rwNRkSzt/jZ1vr+hJ2k74TqO6mITqUp643Beo2jvYv9eDoXp2QKsqcuv kBOpyXu8MaeSrs5e3k+JJOQeMkX1aQvsPZ3+IwTqgnwGJhTY62Y+PYxZQGUjEBvLcA Un+ZPrS6H/UeRPBxzhNuJ/fM168DIs2kzQo4ZykSZ4zahrVNq0qMZxMPzZCMLbd/vb /k53zXufh9hfA== Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5D9B561F1E for ; Fri, 9 Dec 2022 10:01:29 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="aKdXRz0i"; dkim-atps=neutral Received: by mail-wm1-x333.google.com with SMTP id h8-20020a1c2108000000b003d1efd60b65so5289981wmh.0 for ; Fri, 09 Dec 2022 01:01:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+2T3ZLVGJwVrydTkz6iNKwj5oO6lQf9kYT88gPluNzs=; b=aKdXRz0iNekVqSnj1JMh6iqn53I32dcR+aAowJgBq30JZuVizyrEw/KPZttRjajyaG d3vjVG3JkgU6M9qfce2Skr4Dn2UP0y2EouQZvu/J4zzXpgvUPAi8ddsZCPbWkxGHymL2 JnKE/BOIKSzi6yLJ1Iw9ZbHEbTr2BL3QlEQu76w94cDpainVxutsrVKVt0N5iWn0YK+5 WnKoln2VNrphXp14j+VLNhkp2cvgzwo+IchNKSdfwhn/MA244+Zz31qlRDiQR8VGT1O3 OfQXiw3AaREG4Tlq7vGC2Qdv/4KXThP327nV3gHptsnvveGEI06iC7rD8wG1tI7FMczU GPAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+2T3ZLVGJwVrydTkz6iNKwj5oO6lQf9kYT88gPluNzs=; b=1XWt3xruI7dDFb1n37G+QykWidA6B4yJcb14vJFzvBUZTI4WZJOdfCNA1utJDv5tyo GPczzfc5q8UT3spbuFrJN/9VUJWGZ5CErxDhG5bkxSI6vWIkvsjFOzPCyemUxEGUOtoW w/in4reH9sMyC6K3+tP6P1Cdu4Of/zfbvOYg9KbhBbYK5uvlfcXPkXeSZwXsWd1a+TZ6 bn6O9uz1YfBj0O5uqpKRjaKStYstPCiTqNWWwO39NOVZBSvW67+q8rV/Chok7ifUDHUF lsZhJbyLbdvtLfJSKV/rjQ5l7waXLnaChqx1DVguYbw+uQYgkX/Tju7DQdysWZ4pSgIg hqDQ== X-Gm-Message-State: ANoB5pmaxgeKBVRSa6KQ1vvWsMkpz9eVpDLYoGJDqt4jkzOhVKvFzlF3 V7mmyCsGT4jHtdOZ1OYQnG2aVt5fEmWbhZbD X-Google-Smtp-Source: AA0mqf7APrhALFxz3tBarLWzO9se3SjrXXYUOBsaxe6mPhOUTsA4rFAsHeFAsOo7lBKctrLPyUaZoQ== X-Received: by 2002:a05:600c:5546:b0:3d1:f6b3:2ce3 with SMTP id iz6-20020a05600c554600b003d1f6b32ce3mr4821034wmb.35.1670576488710; Fri, 09 Dec 2022 01:01:28 -0800 (PST) Received: from naush-laptop.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id bd10-20020a05600c1f0a00b003cf774c31a0sm7773674wmb.16.2022.12.09.01.01.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Dec 2022 01:01:28 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Fri, 9 Dec 2022 09:00:39 +0000 Message-Id: <20221209090050.19441-2-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221209090050.19441-1-naush@raspberrypi.com> References: <20221209090050.19441-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 01/12] libcamera: stream: Add stream hints to StreamConfiguration X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Naushir Patuck via libcamera-devel From: Naushir Patuck Reply-To: Naushir Patuck Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add a new hints flags field in the StreamConfiguration structure to allow the application to specify certain intended behavior when driving libcamera. Pipeline handlers are expected to look at these hint flags and may optimise internal operations based on them. Currently, only one flag is listed, MandatoryRequestBuffer, which the application sets to guarantee that a buffer will be provided in the Request for each configured stream. Signed-off-by: Naushir Patuck --- include/libcamera/stream.h | 8 ++++++++ src/libcamera/stream.cpp | 24 ++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h index 29235ddf0d8a..1c5273004297 100644 --- a/include/libcamera/stream.h +++ b/include/libcamera/stream.h @@ -13,6 +13,8 @@ #include #include +#include + #include #include #include @@ -51,6 +53,12 @@ struct StreamConfiguration { std::optional colorSpace; + enum class Hint { + None = 0, + MandatoryRequestBuffer = (1 << 0), + }; + Flags hints; + Stream *stream() const { return stream_; } void setStream(Stream *stream) { stream_ = stream; } const StreamFormats &formats() const { return formats_; } diff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp index 67f308157fbf..504c6d86cd04 100644 --- a/src/libcamera/stream.cpp +++ b/src/libcamera/stream.cpp @@ -349,6 +349,30 @@ StreamConfiguration::StreamConfiguration(const StreamFormats &formats) * color spaces can be supported and in what combinations. */ +/** + * \enum StreamConfiguration::Hint + * \brief List of available hint flags provided by the application for a stream + * + * \var StreamConfiguration::Hint::None + * No hints for this stream. + * \var StreamConfiguration::Hint::MandatoryRequestBuffer + * Informs the pipeline handler that the application guarantee to provide a + * buffer for the configured stream in the Request. This may allow the pipeline + * handler to allocate fewer (or no) buffers for internal use. + */ + +/** + * \var StreamConfiguration::hints + * \brief Application provided StreamConfiguration::Hint flags for specific + * stream behavior + * + * Provides hints from the application to the pipeline handlers on how it + * intends on handling a given configured stream. These hints may alter the + * behavior of the pipeline handlers, for example, by allocating fewer buffers + * for internal use if an application guarantees to always provide a buffer in + * the Request for a stream. + */ + /** * \fn StreamConfiguration::stream() * \brief Retrieve the stream associated with the configuration