From patchwork Fri Feb 3 09:44:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 18248 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 EA3A4C3243 for ; Fri, 3 Feb 2023 09:44:33 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 953A0625F0; Fri, 3 Feb 2023 10:44:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1675417473; bh=q0n+bsQd9y0IXZxkCQPhfDQxPM/SW3RNIbYmUmff3aw=; 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=AIzwJsfHjPocDcXpkbDT/t05e6Dqekz84nig4aCDJSNafmP4mmvAoPXYjpCoSAbbe 6lKCXILImQ98VRmRB6WfJYHDWgSbJ1cpAtj1V0DJ+44ITT0NvYunkKO2Ntvb/aKa0P FIbhESwq5O7cAnDxzeTyhdgYL+iEmOgPmWSYN+0GxM88oEwTCejjbn36O3Q/ukso3U 5GU35yGoQv/7SwR0P72SNn4j/kE+8h6sphryQtUVeKXx7yjTvoQ9X8aE4LEtjGJOp6 6VFFcJFBBeOvNz4iWYtdFo3kL7fot65cjqSRh/DqC8hKFZjShtj98j9jhaXTO0gzGy f/y6N0VtHoMXQ== Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9E51F625E6 for ; Fri, 3 Feb 2023 10:44:29 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="a6+TTmIw"; dkim-atps=neutral Received: by mail-wr1-x435.google.com with SMTP id q5so4149665wrv.0 for ; Fri, 03 Feb 2023 01:44: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=n81f6GVEXqXm46yv+qRxoawmXUIHe4ldi9NYE18ruYg=; b=a6+TTmIwCSkgwpXi8MGi/y5HBLFZqkOQZg8CwuCihfS3ipmO4Scd9lTBpkJjeTJBQ0 MnUnIXxSompSvVJJutoEk9VU76nBcfo9uoUkpzlI/l2tsbHS4Fu3fEZ0d27aK68H33rS dVf24pEi1paA9E7uWRf7cGSONhYWWrMDVH2nML23iK1EPevH6emoClywrl+PRXTyjxnS e+KLXF3oQnyBcOxYJR6iWOaWQmTcPB/5NYp8LLddkTvSxOfXIEqoPBlxfIfPTurWeSQt a3nfmTKNkw7u7o8qL0x0DtUMZmbREuRBWIiyj7TxTzuZ1q/jz1wUc08SCEuusBfHdVI+ hKkg== 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=n81f6GVEXqXm46yv+qRxoawmXUIHe4ldi9NYE18ruYg=; b=m6qyePb5D0K8B/AKDQlREAnAwpwoLzM21ELZkUtQLVJhY2/dAbsA9jYbLpI2Dy9Uju U7aCgfgq1UUHg1YQLFudaYHWj/ZJtRUPFNpAurorArKU8dOmBVJRrA0MJ/uNfnnZWTJS j6/ppGvsFBihwghzvuk2jfYbLiBIaEBx1DORxYLErNUx2KAJR07HNwxSco8dw4y1oNsH BT15Isay+7FQF768a1Flq0lwVud0YBMDG6MRG2VK0Plv8SuImtUqcDRY4GEYjZllTMSx 6a9VuYntphJfR6AKr5ijtUh2tJ4/WJSWb46frKihPo1W2KHaIVIcwe9LGLC0ql53Z6rV Z8qA== X-Gm-Message-State: AO0yUKXK0C0YHc1hXlW42bEeNpbFZ69f4eBTBjFyu0OX+ye2z6vMTA+U e1ZcauebEn9FtUouE8fcr++4uEG4MYvXdGYb3+bHWQ== X-Google-Smtp-Source: AK7set/qxFvRB9WwmvTdbaoGiJ0RVJv1/yoYj85uq6n5mVkTAacIW82y4DrXAwe94FTYAdaOiE1vhQ== X-Received: by 2002:a5d:6512:0:b0:2be:5ca0:a7f9 with SMTP id x18-20020a5d6512000000b002be5ca0a7f9mr7915543wru.33.1675417469116; Fri, 03 Feb 2023 01:44:29 -0800 (PST) Received: from localhost.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id f17-20020a5d50d1000000b002bfe266d710sm1562503wrt.90.2023.02.03.01.44.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 01:44:28 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Fri, 3 Feb 2023 09:44:19 +0000 Message-Id: <20230203094424.25243-4-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230203094424.25243-1-naush@raspberrypi.com> References: <20230203094424.25243-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v1 3/8] pipeline: raspberrypi: Handle MandatoryStream hints for ISP Output0 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" Look for MandatoryStream flag in the hints field of the ISP Output0 StreamConfiguration structure. If this flag is set, it guarantees that the application will provide buffers for the ISP, do not allocate any internal buffers for the device. Signed-off-by: Naushir Patuck Reviewed-by: Kieran Bingham --- .../pipeline/raspberrypi/raspberrypi.cpp | 29 ++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 7d786fe839f7..b6ed66a1cf46 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -1522,7 +1522,7 @@ int PipelineHandlerRPi::prepareBuffers(Camera *camera) RPiCameraData *data = cameraData(camera); unsigned int minUnicamBuffers = data->config_.minUnicamBuffers; unsigned int minTotalUnicamBuffers = data->config_.minTotalUnicamBuffers; - unsigned int numRawBuffers = 0; + unsigned int numRawBuffers = 0, minIspBuffers = 1; int ret; for (Stream *s : camera->streams()) { @@ -1546,8 +1546,21 @@ int PipelineHandlerRPi::prepareBuffers(Camera *camera) minTotalUnicamBuffers = 0; } } - - break; + } else if (s == &data->isp_[Isp::Output0]) { + /* + * Since the ISP runs synchronous with the IPA and requests, + * we only ever need a maximum of one internal buffer. Any + * buffers the application wants to hold onto will already + * be exported through PipelineHandlerRPi::exportFrameBuffers(). + * + * However, as above, if the application provides a guarantee + * that the buffer will always be provided for the ISP Output0 + * stream in a Request, we don't need any internal buffers + * allocated. + */ + if (!data->dropFrameCount_ && + s->configuration().hints & StreamConfiguration::Hint::MandatoryStream) + minIspBuffers = 0; } } @@ -1583,12 +1596,14 @@ int PipelineHandlerRPi::prepareBuffers(Camera *camera) * so allocate the minimum required to avoid frame drops. */ numBuffers = data->config_.minTotalUnicamBuffers; + } else if (stream == &data->isp_[Isp::Output0]) { + /* Buffer count for this is handled in the earlier loop above. */ + numBuffers = minIspBuffers; } else { /* - * Since the ISP runs synchronous with the IPA and requests, - * we only ever need one set of internal buffers. Any buffers - * the application wants to hold onto will already be exported - * through PipelineHandlerRPi::exportFrameBuffers(). + * Same reasoning as for ISP Output 0, we only ever need + * a maximum of one internal buffer for Output1 (required + * for colour denoise) and ISP statistics. */ numBuffers = 1; }