From patchwork Fri Oct 13 07:48:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 19131 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 3F605BD808 for ; Fri, 13 Oct 2023 07:48:59 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id DB3E26299D; Fri, 13 Oct 2023 09:48:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1697183338; bh=AMtoncnlfTKf3q8Duk6hCk/4s3cQdb6NPrRw2NSrYwA=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=vyFs9PYDu468DTcmUeKtutesaz/HskmGQZFjtMKMwFPn1Wia5bkKRHw10vuQLMnAv giWd59Y4DDro0ITELFi826osUGtS7aDXU3MEaGg7Q8znoHfawUSB0YxWpFH6sW7iJ8 TS1n2mhdo+moxYu3t3Sx8MotuGwAA53AO8s6acsZQ8iiB4zfzkGeeFoZ8BJQvgqczc 61WtUxXvoMabH3Qey6SuyC6m3l3dyT3WLSBKC0RfRb4rBxJm4/tw2ZgLwlei2k7nY1 4zIUeFZAECD+AScDrFiBMTia2N6MF8BoSuasEb4Svo1F4wmGQGj4hg1OSnvjMxjrkW RU0CpePoT8SVA== Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5E67D62989 for ; Fri, 13 Oct 2023 09:48:52 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="nIloUCWO"; dkim-atps=neutral Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-405524e6769so11286925e9.1 for ; Fri, 13 Oct 2023 00:48:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1697183331; x=1697788131; 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=7U80zkN/M8+3OGgpgvJfple7vo+jwEOA04kNzWBIb3g=; b=nIloUCWOrFJkei4VtPMASFFPkd+vv14DGrni4kGjNddDGALKQ/IEHCr+eZx6jHg0q2 937DrX919VXtajFhaeW4Fz8FSwVO9avO/0NjG+J8XGLiAt4fTMYWPFEh0nRz3k+fytyq 8Xy3YAf78zYkpkQ64fGzDlD1+TueVriZwup9vNDj6Cago5ehmi1xZuhnxV8cZ8K9CBR5 KgF+RytjzQ+Ws1Grvc3dMfhNeu8zOKCjUn5ak5Eey1xjL0Z4KPuCiZdY1EtEbeYrOiiV dAHS6eMOnxNhZIZn/LCG6Rse/gBjJfcKVddM9fFnxMD3Hu4KJq4rICmQAymokQF8jsiF X4wA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697183331; x=1697788131; 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=7U80zkN/M8+3OGgpgvJfple7vo+jwEOA04kNzWBIb3g=; b=kiq639ehjAWO1+u0qAgr8glxm78TOO4DSI9vGwd+UZMZMAB8PDSvDDj1L/TCL13QPf Q4mOPEW7mQh8S+9NZMouulzrv2Ze+IYdwtZtYaPT2aJ3+Kjdg9T/ktJ7vZ+KUEVnFH5N EzIhQLxl6uCa97O5O6sd3rd7UENAosdq5c1ARoyaNXHQsREOKlj6OGmcdd3V+tehVnqT QkA1L8hlckAK3pUzC1x/hKZpofLgHuoXxgYZEqgWk8xlaveW2kLI/EI+hH8TS113qGXP BcvngCM0523W4yDdTwmnXj2BcI8CL5ysiRpsNYT7E+v65jb9j9awaHl0azFCzs+H4ThA yMMA== X-Gm-Message-State: AOJu0YxvyBmMM/q5DXirKFnkHzztqKWb7L4RygR07oF4yUeML1aHJgIZ d+DMHKCrKq345jAeoID+sfKdiTC3ufSR53G9rc3gaw== X-Google-Smtp-Source: AGHT+IFJm37FHYT3+61JBQmKthTxYIK21j+jsK0yj+WB2g2w1/2+oSxMBHXQ2R4dkheSM33ia7/jhA== X-Received: by 2002:a7b:c4cc:0:b0:402:f91e:df80 with SMTP id g12-20020a7bc4cc000000b00402f91edf80mr19174648wmk.3.1697183331610; Fri, 13 Oct 2023 00:48:51 -0700 (PDT) Received: from localhost.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id m16-20020a7bca50000000b003fee6e170f9sm1791890wml.45.2023.10.13.00.48.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 00:48:51 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Fri, 13 Oct 2023 08:48:28 +0100 Message-Id: <20231013074841.16972-8-naush@raspberrypi.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231013074841.16972-1-naush@raspberrypi.com> References: <20231013074841.16972-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 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 Cc: Jacopo Mondi 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();