From patchwork Wed Jan 18 08:59:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 18133 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 52ACFC3240 for ; Wed, 18 Jan 2023 09:01:26 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 17AB2625F6; Wed, 18 Jan 2023 10:01:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1674032486; bh=vuQseQL50Web6ilc98fPnTOnE7PpKyM5XiUabaPa4xo=; 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=ooUHbqq0xII44hCEuEO56EXWLi4Qf33jxeDU4yMivB50tIqZUVVVTSy4SnTEbMemo I5gKl+/2Z21y4GGoZaQAIr1xXOD+VvYgHStlRTekTko3s5FjDCdW7pdyhRc2XuyCGB PHO8Y/BdXP3uje60iFuR5k/ehYi/XhxQgjLmdAVGENOO81m636HGef6VZkXceA86lx JQ7JBTPrM992OHEx/L+26mjj9NJhbRvDBNsFNtYTICu1lnbeiB3kbgWgKmrsoPXcsq S6DFivBk1P/yZuKq/cxNyRjd1aBrPq1Zyg06FaZuP/1U8CvXmRKh1+JlrUArv6Ojs9 8EtMJpjPkWrtQ== Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E13B4625EB for ; Wed, 18 Jan 2023 10:01:20 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="Qltgl0TZ"; dkim-atps=neutral Received: by mail-wr1-x42c.google.com with SMTP id d2so13062029wrp.8 for ; Wed, 18 Jan 2023 01:01:20 -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=lnM2OXv07hslcltNdshxDVv/HvxqNMcVEFP3wRy+Ugo=; b=Qltgl0TZBMLdGafULXUJj2Hwwf+1YA9LWbkY4G4kIwnQT1TYu8JqQIMi+J80VnUWdP 5K/q0fs0Ae6pvw83FoNFbABm8pMhj4CdJopzHAZ8dVJp4zHnSpjFzbJjzmN8IeYM1ZUb TsKkcGPb9tZ8ZxRUUX/VCovGx1zgzmeL+ycGoAPsFW4OU6eJCFZK97g1QyAIw8WyhaaA eKkO7V5vm5wCIBfzrPrPTYs2bzqFP8oLt9lKN17TJacDVmSs1gdPUpksgpDREumVyVpa I52BOVWUXjq6lhhHvlQQG8MJ9cLq4+yIvUHM/GL2Bs8WMYZADuWKJsVEcosy3MKDnKDb HS0Q== 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=lnM2OXv07hslcltNdshxDVv/HvxqNMcVEFP3wRy+Ugo=; b=Adw34kM/1LPPxIo0KaxF6EVTHst6wF5jfcDErozzM0GHB+Ec6p0GbChlzSFexGCxOg q/Y+BdNXx9Sz8C9Yp9eewP1ADU5/3getwzCvGGCgox5SjhgkQYWki0FeEI37Hwu9RPnm 8lZHYUSnRIgtvPHzxegxLHcs2lOIMTYE+5Mq2b6WuBz7OcfnPYacEv5YB+xGaqDmPr59 6grWlbmClRwBvUUQPP/0LSnoRlzOv6QXoC6eBrvKGETEBuf5ZlSkz6n4g+zGhe09HlYZ 5/Xg1lo9XN62wD7UhuD3n2j0zdr/5463RnHEdob5hh3TXvpKT54k37Ipu6W7fn7zvC7A 01+A== X-Gm-Message-State: AFqh2kpryh0B5k5zLECPoRjjhvaFmktUtF5XSIedwNxuxVStDe5Y9UOI DTmN88ctnyVxLObaD+AWmbzacDYXih+IyM91R6Q= X-Google-Smtp-Source: AMrXdXt9suwAefXVlT10YNjWMX7lLwygBytFKPsrv5eJbh/NRdHDt8frAZc1xBsDWMG3STqZ2e1axw== X-Received: by 2002:adf:ffc3:0:b0:2bb:ede4:5dd4 with SMTP id x3-20020adfffc3000000b002bbede45dd4mr15286388wrs.34.1674032480448; Wed, 18 Jan 2023 01:01:20 -0800 (PST) Received: from localhost.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id i6-20020adfe486000000b002423dc3b1a9sm30312464wrm.52.2023.01.18.01.01.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Jan 2023 01:01:20 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Wed, 18 Jan 2023 08:59:49 +0000 Message-Id: <20230118085953.7027-9-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230118085953.7027-1-naush@raspberrypi.com> References: <20230118085953.7027-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v5 08/12] pipeline: raspberrypi: Handle OptionalStream 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 OptionalStream flag in the hints field of the ISP Output0 StreamConfiguration structure. If this flag is not 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 2b396f1db9b6..13d0ab4c4968 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -1453,7 +1453,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()) { @@ -1477,8 +1477,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::OptionalStream) && + !data->dropFrameCount_) + minIspBuffers = 0; } } @@ -1514,12 +1527,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; }