From patchwork Mon Jul 21 07:47:24 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 23863 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 4B366BDCC1 for ; Mon, 21 Jul 2025 07:49:09 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 795C168FD9; Mon, 21 Jul 2025 09:49:07 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="f3Tda5Du"; dkim-atps=neutral Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 85BE768FCA for ; Mon, 21 Jul 2025 09:48:58 +0200 (CEST) Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-3a4eed70f24so639362f8f.0 for ; Mon, 21 Jul 2025 00:48:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1753084138; x=1753688938; 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=pJO3YyGYylLhkVR5hB/KZwH6SyR+HghyeB4hoxooCns=; b=f3Tda5Du4Dpi3pUZ2zgYvIgyooPUisHc8chubC6k1iYuSJ2BfrdhbY8O3Ur6sYpar+ DFTpMZMwxutNOQp/z8ux9IAfNzMNefEME73QcwIbm22nXPNZ22j6gsx/tQdoAB/kWPJq 56gma7riuX7WhuxV2p0ejOwpRoH18LAHxv7k7yWCTgF6T+Y6/7gSlj//gZGUwUJ5c7KI r4P85yE6Sj2HbKrd4jDqTdT0aBzixjhKxVarJP9W7LMwx4T60iqBnPb+p1/OhbDpn8yZ XdbCwPpoCAXsiwIZSVWPGonPPFK5L/88OBLkuss/+nZP5FJPFFopKIcOZH4bekzr2Rq2 /23w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753084138; x=1753688938; 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=pJO3YyGYylLhkVR5hB/KZwH6SyR+HghyeB4hoxooCns=; b=DFVaBDvb78IWcIvojDIw2BNJHCRbAZ7os+Xz4ExDa2npkpe5jG2f+pwGAsUfz8fBN7 5f8aJxG9xcutWI/iL+Sa7UupK0djorqlHB54bD3ydl90s4aIp+maBJqgHVovFuv8OcQy Cu9ueniy3SkBRJ7fRfTX1DG/QS+8f5Hc8xYxawZ+We7pRYLbqvAy5DxOzKl5nkn5qfkQ o9DUjFMWdPt1n0YtIq91TWDaU+HnFWftD7qVz4drdJGz0lB8MOkRwESjz2ZG5s4vyllR lK7AeDLhtk6e7si06/OebvAZGmTTTIbdQkISI5YKLeg1cpzZObESlsafI47g1B8qiNed 2udA== X-Gm-Message-State: AOJu0YwcvjYFPs9QkRLdzncV3AEQscWSQgmdVPrWCvEL327tPt0gDu0F J8wCx9x66HVgtrvQU9PFSIaJ8azPVyBbqojC5pYJaRPI0ykkwsiSzRpjLoErNzzQVNg3GsbfZg3 vUa9ncXI= X-Gm-Gg: ASbGncvBXlR3QKRaDwX0LG+qhf7NyCQI0uoAu0cQ7R3DNAeFHlFCN+9HH0Y4wNqxJOb W9/6IrRJaMX0BCevcYQZQy0X2gkTZI9cgU9mWj7FU3TJD2kDUIOHROhobAR44+hzcXtejNcNnPE N4NZvj7tLoJFTor9rDVKYR6+hb6rk8QN87F+8eZpHRi7LNcTZ1qXEPNdZs+YbcvZGLRcCv6S1CZ 3coKNz2wZu18adOHQDIh7SBgK1fwjVlUs4freNekyiiH1yxJGqCUYJCYxh3zOwD5WojLXYjVpsw wEGCTZ9Shd7nB5nFwTL9X9G52CJQNFUq1GJMrr/e63zpEIU3SnoKIr18EEMLyinTSJ6fVosOZkc Qr5sBbMeBDOdXKtijTok3kc/L/iXTpsEKjbHmeE/9GQ== X-Google-Smtp-Source: AGHT+IEHcjDWNX8N0MkqJ2yMUlOKWR6zeSeibUBHGiURmFAaLEh2Hhstw85jAdVQJaHC0RENYs/M9Q== X-Received: by 2002:a5d:5f87:0:b0:3a3:63d3:368e with SMTP id ffacd0b85a97d-3b60dd14839mr6562931f8f.0.1753084137779; Mon, 21 Jul 2025 00:48:57 -0700 (PDT) Received: from NAUSH-P-DELL.pitowers.org ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4562e802afasm151101765e9.12.2025.07.21.00.48.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Jul 2025 00:48:57 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Cc: David Plowman , Naushir Patuck Subject: [PATCH v2 4/7] ipa: rpi: Advance the delay context counter even when IPAs don't run Date: Mon, 21 Jul 2025 08:47:24 +0100 Message-ID: <20250721074853.1463358-5-naush@raspberrypi.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250721074853.1463358-1-naush@raspberrypi.com> References: <20250721074853.1463358-1-naush@raspberrypi.com> MIME-Version: 1.0 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" From: David Plowman The delay context counter must be advanced even when we decide not to run prepare/process. Otherwise, when we skip them at higher framerates, the current IPA context counter will catch up and overwrite the delay context. It's safe to advance the counter because the metadata is always copied forward a slot when we decide not to run the IPAs. Signed-off-by: David Plowman Signed-off-by: Naushir Patuck Reviewed-by: Naushir Patuck --- src/ipa/rpi/common/ipa_base.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp index 8b4eb75e7e6b..98690b80d5d3 100644 --- a/src/ipa/rpi/common/ipa_base.cpp +++ b/src/ipa/rpi/common/ipa_base.cpp @@ -501,10 +501,11 @@ void IpaBase::prepareIsp(const PrepareParams ¶ms) void IpaBase::processStats(const ProcessParams ¶ms) { unsigned int ipaContext = params.ipaContext % rpiMetadata_.size(); + RPiController::Metadata &rpiMetadata = rpiMetadata_[ipaContext]; - if (processPending_ && frameCount_ >= mistrustCount_) { - RPiController::Metadata &rpiMetadata = rpiMetadata_[ipaContext]; + Duration offset(0s); + if (processPending_ && frameCount_ >= mistrustCount_) { auto it = buffers_.find(params.buffers.stats); if (it == buffers_.end()) { LOG(IPARPI, Error) << "Could not find stats buffer!"; @@ -518,14 +519,14 @@ void IpaBase::processStats(const ProcessParams ¶ms) helper_->process(statistics, rpiMetadata); controller_.process(statistics, &rpiMetadata); + } - struct AgcStatus agcStatus; - if (rpiMetadata.get("agc.status", agcStatus) == 0) { - ControlList ctrls(sensorCtrls_); - applyAGC(&agcStatus, ctrls); - setDelayedControls.emit(ctrls, ipaContext); - setCameraTimeoutValue(); - } + struct AgcStatus agcStatus; + if (rpiMetadata.get("agc.status", agcStatus) == 0) { + ControlList ctrls(sensorCtrls_); + applyAGC(&agcStatus, ctrls); + setDelayedControls.emit(ctrls, ipaContext); + setCameraTimeoutValue(); } /*