From patchwork Fri Jan 27 15:43:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 18208 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 9A602BDC71 for ; Fri, 27 Jan 2023 15:43:47 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 645B2625FF; Fri, 27 Jan 2023 16:43:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1674834227; bh=xK2wcpQnZCDzyHE/dpHSFOEbJ7h/9g8/6FWAzLqHuw8=; 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=rHNM/Eb0BHpFxU5ORTw1wUfZFQdkTSepKKAI6YQTxvVGAZ4g4VgSs/aqQWasxFien 6MqCp5bV+/egYuebnM9FAF5ZEgE3oi359CGU7mnXYapBe6kuS2ET4mOJSCbx6NEmUl STlTZnrQJVFrGNa3RrYS9revwpZhlR/OVg/sIySEprcKEjkVepXPCMC6EmYqgcrIfB 8OHVKPu+E9zzTZBkvmLoV25PHor2fpGqP1TvbOtmEc5SWinPdck1MFFcXxLtLmXBGa W+qDV749zzS457E/ZrH816A9QWx9FDTn45ZYrhZwtP4WpzegAiVeCWa7INLpW6OTQG hSsUFwbnbdXUg== Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id AE795625E4 for ; Fri, 27 Jan 2023 16:43:40 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="j3pipNP9"; dkim-atps=neutral Received: by mail-wm1-x32b.google.com with SMTP id iv8-20020a05600c548800b003db04a0a46bso5849988wmb.0 for ; Fri, 27 Jan 2023 07:43:40 -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=afcKaE04BexTLMjLTfmnTqFdQC6rwFUactfLih+k2m0=; b=j3pipNP9e8NgOlCfqM1GmAJoGNaqryXd+zfLdAWQIz1iPV+9V5/6EvZZ1XvkNzaWRV Fm6fQEXdCOogNJatj8N5CBpr3ej9/o2pqtOfOVg/9+PGVJ/dnsiJ4J6CPyT0cEkC2SN0 ebnOJFRnccD6lUfYpRH9ARR8rxc7NtIek8v5eX2xSyT+7UYjMWfwd8z/lTmRqfLiEZ5k H8m8SMnCdRCq0T//z5Dx4F2EUzW/4vkE+ybc4fPR4ssl/EnjYfgNNV9x49gADeBk6yKf +H3n+XKPsrJl08lVCy5yEE5yhqhCECadqyToc8E7rpWBXcawHY1BN8V6gIoOC9qT+Fxx ys/w== 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=afcKaE04BexTLMjLTfmnTqFdQC6rwFUactfLih+k2m0=; b=OIUaGpR1trMI1Sq5TQHIgi8KPh1q4YgBoIN6xkljtp2dbJC596WcVPW9+TUeV3KJxi utcLE4rE2QxSL/MxCb/02rADEx+Zfs10uyTQHdFDsbCM+R4EH8tQHlhuEgpuGIc5sgil OLp13Wllc8BpIfd/BmIkxZuND802F3Z2C6kDG+7WAbasYGJmq91xFuL4p5TALc5pFMtO CugnN2lGWUCDIXDV5aBWEofYuCy4isE1PpYabcZD2LzmbHNSiEBhft9pAirF3agT/9K4 2ry8p15jY3um+wvDptLv50XquLsdJoZwDxZobeqDFb5osijt6/fyj+VFQ/dzRbV+sV+w Gprw== X-Gm-Message-State: AFqh2krEP0r3k99yP52v/Ok/v6+7pXvozZxxgJ+m35qmC/AhvRJzMSBZ 7t6ub0kpEI0SUKkcshY2y3Qo4zx/XgQ7TdyJclY= X-Google-Smtp-Source: AMrXdXuq6Rirle1AEUwL9n6Ez1fQEwcOewprFfESaYF/AhFf0c5+dKL7UWY1lZkGYjm62SsB2uJxDQ== X-Received: by 2002:a1c:cc11:0:b0:3da:1d52:26b5 with SMTP id h17-20020a1ccc11000000b003da1d5226b5mr47332010wmb.14.1674834220207; Fri, 27 Jan 2023 07:43:40 -0800 (PST) Received: from localhost.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id h18-20020a05600c30d200b003c21ba7d7d6sm4549566wmn.44.2023.01.27.07.43.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Jan 2023 07:43:39 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Fri, 27 Jan 2023 15:43:15 +0000 Message-Id: <20230127154322.29019-9-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230127154322.29019-1-naush@raspberrypi.com> References: <20230127154322.29019-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v6 08/15] 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 83e82bd2880d..7c6db070dfc0 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -1457,7 +1457,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()) { @@ -1481,8 +1481,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; } } @@ -1518,12 +1531,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; }