From patchwork Fri Dec 9 09:00:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 17972 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 77CA0C3284 for ; Fri, 9 Dec 2022 09:01:41 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1DB9A63366; Fri, 9 Dec 2022 10:01:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1670576501; bh=BiHLTGRIZrIxROdmyYa5tRAbZuIiIL1LaiHBSzWJ660=; 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=IATLDTL3+vv0TcWQ5MrODlRsP+3o/kFqD6e7e8NJQ2vbRY5qqi6h4+XcC9knTnHDA eV6rQw7pbr507L37qEdNZkKl6HBqbTL13uUpyNcDEcszJ7jko7xghob3dLwTODZSsj u5uj72Y44aLIj7d8aw75S9iIuNOyCJw3wmo9Wn8vHdCPkGKk+fH+RmhUZuKEIJpSQ3 JPVcbSuwTB7Tx8XiMnx4Ymtzq0PRTTnvNPb1XDDSmGPddCAk0B9cgMzkSX6LvVg2rW 8xsVeAvIdXpAn18Eg3lyXHeMxDFjbiLMWoHDoViN6fH4BbQUqJ8hccWrZ1F/E3EM+N ERon4pQhAOI7w== 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 6094D61F1E for ; Fri, 9 Dec 2022 10:01:35 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="JKQQaj+F"; dkim-atps=neutral Received: by mail-wm1-x333.google.com with SMTP id ay40so3070343wmb.2 for ; Fri, 09 Dec 2022 01:01:35 -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=aoZyfBtUFeCD/JFLmCZNa14e1yWfA5Pwc8ENXkV9xSs=; b=JKQQaj+Fi+YP5LTOH3yvFlDTYbY5Cqa10SoQIsV+TPvNJZ7TsDE6saTue13agX6LtM tTf31fRIOMRCxkisLwzf7ydMDMqSFsPYiUJ8H4glXyde6NjNQYuPYhbuCpv4+hNSeopQ Nc6V03kPp8KxMs9IL0+lvHx4g5FKl0vFu5GFssHVG8vfg5VvT7vs6Tm5ENArgHn6GQGC t5d4CmaUJ+2V6l2r6PKnEbyWoIG/6BKHUzbMiRngE3GRE1vkWHsdoZZ7mWWuH+IddvXU kuLhrbuZQcIqnCQjok/1kLEZgm+hIHWq3K9Zm5v+PrNGapikcTqoSRn/+ullX8vjPKeY vTWw== 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=aoZyfBtUFeCD/JFLmCZNa14e1yWfA5Pwc8ENXkV9xSs=; b=WKW82AorOLw4osZluLhFCiznoUdzYcaJiDzlUb4imO8EyUsFPkY0B0F00mvl0DHJgH K7w9Uo95ZQL1m/V//cwnVnDWRk1O/De0+DKUeZfTSYUc7TLRZs3bobaVbjt71mQR+n/L Ipa4kF3Jp/eWZ0Nc40AdMURfB7HNnucZAxEI8PvkZIf0KBf30i+7bmDDuPOYlc3OulzX tlxhsoNBJlIqnP50VcCZ2bWw7BvhKXZOU7KihZ6xQvqvE687kezmTpNZ/Zu2CsbgAHwf dhAErH6HWhMs//b9KsfL1JR5ec2IGPsXx4KWWquK2sXG/E1IPk7ro8Mdyhe0PVNAEH5M qzUw== X-Gm-Message-State: ANoB5pkhB98GQsHr4FjRGgVyN4Id5WvmUKl38GY3/4dG28jzIhaUNkRE by63Hvq2euGuXrzUOuHOou8P6FW3C35Kb/PF X-Google-Smtp-Source: AA0mqf7eZKYJgrIT1KGg+M8cvb66z3AshP1P0FukkOkBulyK32sWzJ+dytS3+P/Y5EEbNuUHMIGjHQ== X-Received: by 2002:a05:600c:1f09:b0:3d0:7d89:2256 with SMTP id bd9-20020a05600c1f0900b003d07d892256mr4387226wmb.13.1670576494621; Fri, 09 Dec 2022 01:01:34 -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.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Dec 2022 01:01:34 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Fri, 9 Dec 2022 09:00:46 +0000 Message-Id: <20221209090050.19441-9-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 08/12] 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 9a316eda6fea..45e66839efb9 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -1452,7 +1452,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()) { @@ -1476,8 +1476,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::MandatoryRequestBuffer) + minIspBuffers = 0; } } @@ -1513,12 +1526,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; }