From patchwork Tue Dec 6 13:54:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 17952 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 12FC9BE08B for ; Tue, 6 Dec 2022 13:55:18 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A7CD063356; Tue, 6 Dec 2022 14:55:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1670334917; bh=SLhgGrpHJFQMhrTxEFNQhmxANozPE8v+5FMHPLX9wts=; 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=ASb+rqYFFEU4FmsFo4s4FlVRTJKTNSzaZnzyApFDZp7MMd0M6PvCb+Wa8wrhCRqX5 I18RN082gmoA1lHUFfrTGU6PLf/2DKifTS+sWqsGPDM8Pg7Sk3Iugk5iGUzEPyVEzB ewlwVdneL2D0k/c9rU1v3450NygOt9eJgyzpjm/vsXPab1QkPKXr8bePyGGCdVp5tB zUc5l0EZ9CvT4QJvoLUYRL7EGIT3s7qPQDedG3x/acxsR/iJpad82jP2MsKvR0rhpV +HXEafTNs+UbKFcIQglr376g0saU9tu43TXi9tgvTfg3AIzcK/rqSWyOppcwyvAJiS g2e8ed+OYJ0vw== Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id BDAD86334A for ; Tue, 6 Dec 2022 14:55:12 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="bl/gTEI7"; dkim-atps=neutral Received: by mail-wr1-x42f.google.com with SMTP id y16so23574303wrm.2 for ; Tue, 06 Dec 2022 05:55:12 -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=Ccy7ljO79JZF7M7m8/PMAoKlgfWygspiQx69DEnlU1k=; b=bl/gTEI79dt0mrJ2vKtEJbzF0mdMJW6amKQMd2Nrjn2eazx9xMFdOEMItiXIs8MO21 T/5Ra05QDRct8pXVn2K1aNCDn9AjORaHnEjMMsYvdZEQoI0yf+VNwIie2Z5bd/Nh3UUH 1/tSNAKI/1+SM0rjg9UXTGtFhBwGNLmllJ//2rbembKZt1Nxz28qIqfI0h+KuR1Dj/zG oTB1zpf8zXhQ+2crhqX0CJB1We4VP0zROcK1IKhf+3f7GZHiDhBx2DshlyA5A/mhbHyM eCWK4iqPClJMSaaVdVjbR50H+944OfRPJmaN39iw3NNVtWlQFDaCn6gqshEhbd/dELQx OCng== 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=Ccy7ljO79JZF7M7m8/PMAoKlgfWygspiQx69DEnlU1k=; b=stfWAlzjkVpxMHFQI9rrKLIjkFrLxZzU8yO6VrOjBIriioz8NmkIQ/zX/lPf740xGZ OHHfSEekXHPyBOcpaHODirKdCyyQ4q72wQh4r+O4JtduxKm7Sv+yq6j2y5wMKvdeRFp2 753a0Q0m+pRI0DHg7FeUqF9PcTpXPZ8TVn0jD2l+0GoQS7NyCkYrzDDx4n97ucrQZU5E oWqeR8FecUsgEpKoPguRDS7ccskBn9x6rdbsJr3bNiGXQEsuNiiPwEvFLrkeUq7jPTbK gV4CH46no1/wZVpgHwcor2nN6AGO9kbrudBXjFlVbAkeQz1BtgRd25WQE7rXc/0LKoLF kzFA== X-Gm-Message-State: ANoB5pnrLM10fWmPsiSu12azCydhEObN/qcAR9VcB8pcUV0vwBndQNRC 3IN7veNJTHevXcYx7bYRqX0RC6wLjciU88GM X-Google-Smtp-Source: AA0mqf5pLE9HtTKcbCLKW/tSkOszWRG5HZR+FNJo1toM6LaCif6gA1Xdbq1bLPe3w9dqdhkm5UEC5A== X-Received: by 2002:a5d:5545:0:b0:242:3207:c516 with SMTP id g5-20020a5d5545000000b002423207c516mr14668167wrw.243.1670334912025; Tue, 06 Dec 2022 05:55:12 -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.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Dec 2022 05:55:11 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Tue, 6 Dec 2022 13:54:55 +0000 Message-Id: <20221206135459.25521-10-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 09/13] pipeline: raspberrypi: Handle MandatoryRequestBuffer 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 MandatoryRequestBuffer 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 --- .../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 302279ac5e01..371610be649a 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -1470,7 +1470,7 @@ int PipelineHandlerRPi::prepareBuffers(Camera *camera) RPiCameraData *data = cameraData(camera); unsigned int minUnicamBuffers = data->config_.minUnicamBuffers, minTotalUnicamBuffers = data->config_.minTotalUnicamBuffers, - numRawBuffers = 0; + numRawBuffers = 0, minIspBuffers = 1; int ret; for (Stream *s : camera->streams()) { @@ -1494,8 +1494,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 (s->configuration().hints & + StreamConfiguration::Hint::MandatoryRequestBuffer) + minIspBuffers = 0; } } @@ -1531,12 +1544,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; }