From patchwork Tue Dec 6 13:54:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 17944 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 5EE13BE08B for ; Tue, 6 Dec 2022 13:55:10 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 84E4C63344; Tue, 6 Dec 2022 14:55:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1670334908; 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=KL16v4OTKQbdsyFFG1C7h7javm1MuXbg8MmSN7/ntAQtvWF1GEa86JxxpN03JBMqR S3NdO8aD+TztRkTE+y7Z+PXXo1182B1y2WETl+CZPtm+44Bsb9SJ96fb/eQNlTcwrA 021HBXI+klyT/GpNAHM67TtZH/wsrd/NPhQxRZ8JkLGp/YtlDuJX5WP6kOZQr8m9U/ yApQHRnN6rJGbv3pPWc65xK98TtB8zM+bmKqPV6AyY8s0s4Zd4ww/eHGaZnPoXZgcV DLhOUoiTxd6vrPNR8pE2fUVBC4WK0PzYc0OVQcdEApXuHM6FGAFObkSeDru2Ax+PX1 L/0vHOvU4J36w== Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8B14063331 for ; Tue, 6 Dec 2022 14:55:06 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="reTMIBef"; dkim-atps=neutral Received: by mail-wm1-x336.google.com with SMTP id l26so5001163wms.4 for ; Tue, 06 Dec 2022 05:55:06 -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=reTMIBefKEXPWQjKL012biBubEyT6uYfbOAGwaHBAujBYnzFsT4dDFahoobWXuN/Y5 DBsZTZ+ANzOrH0Rp5qzl5qtE2BK/MGyhr9dtVie1/B23MgmtA0mu3iIc3+oPNjiEZV1Z zkJzxd6EHDbpJL18Elo2B0N9ba/n9nnKCqQseTYF35BjZRzDAlqe5VM0EdFrJ42vbYTN 4rgURch2lb7GFJox1klOoACNLdIw2Ix1MuomMqZVgo9I3cpr2JlNgjt6Qf2pwMXhMH/9 WFIHhiBiJIOsaNL5hzJjfCgW/zl7Zp/D8os7Wyj9I5hC4JTmu1xDqI8zUXxO/8M/uiih PV4Q== 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=3v7Uq0ZY74B1ogyX1ld5tVHVaAC3ntp5kSE0w0Gqf8aJUweWshNDDdZ6cRzVytnE25 AZYhV+ZJWqJo/Qnp/NSh4Z/NVwnrpTZrRszylHnT1dr4XvJFRBfYFd0oSxDqLnwhKjGK EOZr5P8613DTFHbx0Co3zH4AaPuQasZq6/5pgVxSPXxjP5jRuDM+qxQsHvAv74HurwI7 w1gUFwA1YivzgEvaKIPBkUjC/aj50WdxH7w2S7334/z5lGRSDCx76uZUkfE2oTcxObLN EcyTsN4yLE1FmXsCCLICGa5LKtgYSIRlVDOTLeVzVJaHoRHdTTarcGvNp8s1O+G7dRbb 3+2Q== X-Gm-Message-State: ANoB5pnPwji3iTvDeATdR/t8ckgXzWKLC6urxSOSVH3IxSrwH97cLXPW 4apS4j5NbWZGyVUHa2lTlAj/OeUxr+oD6L7U X-Google-Smtp-Source: AA0mqf59LzXAMKHHcA3affymZr/l18lG6hS0wjJS7Q4FMgKlwHAuAu8C015eJvTVTi+DgEaPci9fnw== X-Received: by 2002:a05:600c:3ba1:b0:3d0:47c:9ff5 with SMTP id n33-20020a05600c3ba100b003d0047c9ff5mr56847197wms.121.1670334905894; Tue, 06 Dec 2022 05:55:05 -0800 (PST) Received: from naush-laptop.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id q6-20020a05600c2e4600b003c6bd91caa5sm19444059wmf.17.2022.12.06.05.55.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Dec 2022 05:55:05 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Tue, 6 Dec 2022 13:54:47 +0000 Message-Id: <20221206135459.25521-2-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221206135459.25521-1-naush@raspberrypi.com> References: <20221206135459.25521-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 01/13] 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