From patchwork Fri Oct 6 13:19:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 19109 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 9C5DCC32BA for ; Fri, 6 Oct 2023 13:20:06 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4B3F36297E; Fri, 6 Oct 2023 15:20:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1696598406; bh=LHz8u37OwGI/wuTVdZF3yv9dmJRF0tMBAMBIG9SMWzI=; 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=xiBnsElYYxlNdIUKx+1oOZBONZxXLCooAhrzxUlyluDIjv2cDN+xe8U9b7DM9ai1A GT4EqML5J7XceWzYRxLbmumWdqqX1g5zk2oiJZmLtWBgmxLpbHNX51OiKzpN8MdSQU d4e7hHEkC1LqCnseRqq87iQMpUOFbC/V1/tyR+vU56a4Am25awdYH3bNzpbeaOM6rg D8Hg+/ilZLlADF7wOx2kZTa5t2YrATi1EalRwvt+PMp2oeij8tKCRnX4x4TF0G/0Tm kzGzY42W7tbovkZ07QPJnzOM/NOaonmF3gctE9IJD9yM+lSrOdB39GxTxHrYnkdtJZ VAkIWCqgRm1Aw== Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9144262975 for ; Fri, 6 Oct 2023 15:20:04 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="ON1SKNZs"; dkim-atps=neutral Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-3231d6504e1so1917682f8f.2 for ; Fri, 06 Oct 2023 06:20:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1696598404; x=1697203204; darn=lists.libcamera.org; 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=Gfnf3eFrGWi5BuX3QgWJhR2IgqMg0A06aPgA4jJrFJ4=; b=ON1SKNZsihWpluDpxJOMTRMhpPCfSGgDWS9Kd5OLqEB/OM+RXY/KyysvV/KD+j8jX1 jhktZLEnrwpnHts9jK3JIh4aIoFpbc2yQM+KuB6Vfu26lmZhU6sJLT99wTiolFKo8jLr GvgX04HSn7peiiinzRCtX0gRJlWF1fJS84qV20ddQt43whhnbvbQw0859wNeKadaSOEG ULatF4q1TVcj8Si41TvpnoG6sxorz3SF0anE72H8BhwhcXE6ZJUUa55JYbjTXuhZY4zd zrul0Z7v9m3jFHvdg7pdP9F6ubsC0KVILVRG50X8DyFpmBzPe3AJsQtAdQ/defoAEhfo R7uQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696598404; x=1697203204; 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=Gfnf3eFrGWi5BuX3QgWJhR2IgqMg0A06aPgA4jJrFJ4=; b=uTVQ99/sO4QUW5bpNjhSvy1MoxKdyzow0RN+ZJSxW3ywQRjujxj0k/iYBXQkaVcaIj ak0LmGGQZYmT5zQB4qSEksN1Wa3+IBviYaGUOiH+s2U9kza9VI+k3YxcgUMqljVjzAnw oW0cI4K3olFrMl0l55PWRmavJB5YymlcFdxZs54TJAUw+9JhD9wJoM2m0moAoP9Nx/LB 6go+gzSLHqhG+9it4v+vRMAAlb/cDag8zwbG2acPK+uIwyh84GQTl+3EwsxnyjimT9l4 QzWnxlT2xUHslH2irOl/MaO6Dq3MRJ+IXCS4EFxVBl915z5Yx6YnsK4kWqlVx43s5Sec 5CYQ== X-Gm-Message-State: AOJu0YwhBrCE+YetEz9wXNUWUEDELfWQQUW7gWoahzOeDsv4z/MIOCRr scoB69khLzgzmnRL2UPu2Wf7nVDvCHysQR/GpiOGrg== X-Google-Smtp-Source: AGHT+IE41HKWRTBpaXXgTmzkoElLh+4FGquUI/13kX1PvR2p+6+3PDvZmOaiw8Z2vPZxQd8oUR4h6g== X-Received: by 2002:a5d:5448:0:b0:320:7fa:c71e with SMTP id w8-20020a5d5448000000b0032007fac71emr7815787wrv.15.1696598403916; Fri, 06 Oct 2023 06:20:03 -0700 (PDT) Received: from localhost.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id m8-20020a056000180800b00321773bb933sm1639478wrh.77.2023.10.06.06.20.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Oct 2023 06:20:03 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Fri, 6 Oct 2023 14:19:47 +0100 Message-Id: <20231006132000.23504-8-naush@raspberrypi.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231006132000.23504-1-naush@raspberrypi.com> References: <20231006132000.23504-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 07/20] ipa: rpi: Add statsInline to the Controller hardware description 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" Add a new boolean field (statsInline) to Controller::HardwareConfigMap. This field indicates where the statistics are generated in the hardware ISP pipeline. For statsInline == true, statistics are generated before the frame is processed (e.g. the PiSP case), and statsInline == false indicates statistics are generated after the frame is processed (e.g. the VC4 case). Signed-off-by: Naushir Patuck Reviewed-by: David Plowman Reviewed-by: Jacopo Mondi --- src/ipa/rpi/common/ipa_base.cpp | 19 ++++++++++++++----- src/ipa/rpi/controller/controller.cpp | 3 ++- src/ipa/rpi/controller/controller.h | 1 + 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp index 97f647a9e53e..f28eb36b7a44 100644 --- a/src/ipa/rpi/common/ipa_base.cpp +++ b/src/ipa/rpi/common/ipa_base.cpp @@ -429,11 +429,10 @@ void IpaBase::prepareIsp(const PrepareParams ¶ms) } /* - * If a statistics buffer has been passed in, call processStats - * directly now before prepare() since the statistics are available in-line - * with the Bayer frame. + * If the statistics are inline (i.e. already available with the Bayer + * frame), call processStats() now before prepare(). */ - if (params.buffers.stats) + if (controller_.getHardwareConfig().statsInline) processStats({ params.buffers, params.ipaContext }); /* Do we need/want to call prepare? */ @@ -445,6 +444,10 @@ void IpaBase::prepareIsp(const PrepareParams ¶ms) frameCount_++; + /* If the statistics are inline the metadata can be returned early. */ + if (controller_.getHardwareConfig().statsInline) + reportMetadata(ipaContext); + /* Ready to push the input buffer into the ISP. */ prepareIspComplete.emit(params.buffers, false); } @@ -479,7 +482,13 @@ void IpaBase::processStats(const ProcessParams ¶ms) } } - reportMetadata(ipaContext); + /* + * If the statistics are not inline the metadata must be returned now, + * before the processStatsComplete signal. + */ + if (!controller_.getHardwareConfig().statsInline) + reportMetadata(ipaContext); + processStatsComplete.emit(params.buffers); } diff --git a/src/ipa/rpi/controller/controller.cpp b/src/ipa/rpi/controller/controller.cpp index 14d245da2ce7..4b6f82b41916 100644 --- a/src/ipa/rpi/controller/controller.cpp +++ b/src/ipa/rpi/controller/controller.cpp @@ -34,7 +34,8 @@ static const std::map HardwareConfigMap .focusRegions = { 4, 3 }, .numHistogramBins = 128, .numGammaPoints = 33, - .pipelineWidth = 13 + .pipelineWidth = 13, + .statsInline = false, } }, }; diff --git a/src/ipa/rpi/controller/controller.h b/src/ipa/rpi/controller/controller.h index c6af5cd6c7d4..a8bc61880ab4 100644 --- a/src/ipa/rpi/controller/controller.h +++ b/src/ipa/rpi/controller/controller.h @@ -45,6 +45,7 @@ public: unsigned int numHistogramBins; unsigned int numGammaPoints; unsigned int pipelineWidth; + bool statsInline; }; Controller();