{"id":23863,"url":"https://patchwork.libcamera.org/api/patches/23863/?format=json","web_url":"https://patchwork.libcamera.org/patch/23863/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20250721074853.1463358-5-naush@raspberrypi.com>","date":"2025-07-21T07:47:24","name":"[v2,4/7] ipa: rpi: Advance the delay context counter even when IPAs don't run","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"b439718849d31e2c693d16ce853dc42e2cad6248","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/23863/mbox/","series":[{"id":5303,"url":"https://patchwork.libcamera.org/api/series/5303/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5303","date":"2025-07-21T07:47:20","name":"Raspberry Pi AEC/AGC update","version":2,"mbox":"https://patchwork.libcamera.org/series/5303/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/23863/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/23863/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 4B366BDCC1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 21 Jul 2025 07:49:09 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 795C168FD9;\n\tMon, 21 Jul 2025 09:49:07 +0200 (CEST)","from mail-wr1-x432.google.com (mail-wr1-x432.google.com\n\t[IPv6:2a00:1450:4864:20::432])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 85BE768FCA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 21 Jul 2025 09:48:58 +0200 (CEST)","by mail-wr1-x432.google.com with SMTP id\n\tffacd0b85a97d-3a4eed70f24so639362f8f.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 21 Jul 2025 00:48:58 -0700 (PDT)","from NAUSH-P-DELL.pitowers.org ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\t5b1f17b1804b1-4562e802afasm151101765e9.12.2025.07.21.00.48.57\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 21 Jul 2025 00:48:57 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"f3Tda5Du\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1753084138; x=1753688938;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=pJO3YyGYylLhkVR5hB/KZwH6SyR+HghyeB4hoxooCns=;\n\tb=f3Tda5Du4Dpi3pUZ2zgYvIgyooPUisHc8chubC6k1iYuSJ2BfrdhbY8O3Ur6sYpar+\n\tDFTpMZMwxutNOQp/z8ux9IAfNzMNefEME73QcwIbm22nXPNZ22j6gsx/tQdoAB/kWPJq\n\t56gma7riuX7WhuxV2p0ejOwpRoH18LAHxv7k7yWCTgF6T+Y6/7gSlj//gZGUwUJ5c7KI\n\tr4P85yE6Sj2HbKrd4jDqTdT0aBzixjhKxVarJP9W7LMwx4T60iqBnPb+p1/OhbDpn8yZ\n\tXdbCwPpoCAXsiwIZSVWPGonPPFK5L/88OBLkuss/+nZP5FJPFFopKIcOZH4bekzr2Rq2\n\t/23w==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1753084138; x=1753688938;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=pJO3YyGYylLhkVR5hB/KZwH6SyR+HghyeB4hoxooCns=;\n\tb=DFVaBDvb78IWcIvojDIw2BNJHCRbAZ7os+Xz4ExDa2npkpe5jG2f+pwGAsUfz8fBN7\n\t5f8aJxG9xcutWI/iL+Sa7UupK0djorqlHB54bD3ydl90s4aIp+maBJqgHVovFuv8OcQy\n\tCu9ueniy3SkBRJ7fRfTX1DG/QS+8f5Hc8xYxawZ+We7pRYLbqvAy5DxOzKl5nkn5qfkQ\n\to9DUjFMWdPt1n0YtIq91TWDaU+HnFWftD7qVz4drdJGz0lB8MOkRwESjz2ZG5s4vyllR\n\tlK7AeDLhtk6e7si06/OebvAZGmTTTIbdQkISI5YKLeg1cpzZObESlsafI47g1B8qiNed\n\t2udA==","X-Gm-Message-State":"AOJu0YwcvjYFPs9QkRLdzncV3AEQscWSQgmdVPrWCvEL327tPt0gDu0F\n\tJ8wCx9x66HVgtrvQU9PFSIaJ8azPVyBbqojC5pYJaRPI0ykkwsiSzRpjLoErNzzQVNg3GsbfZg3\n\tvUa9ncXI=","X-Gm-Gg":"ASbGncvBXlR3QKRaDwX0LG+qhf7NyCQI0uoAu0cQ7R3DNAeFHlFCN+9HH0Y4wNqxJOb\n\tW9/6IrRJaMX0BCevcYQZQy0X2gkTZI9cgU9mWj7FU3TJD2kDUIOHROhobAR44+hzcXtejNcNnPE\n\tN4NZvj7tLoJFTor9rDVKYR6+hb6rk8QN87F+8eZpHRi7LNcTZ1qXEPNdZs+YbcvZGLRcCv6S1CZ\n\t3coKNz2wZu18adOHQDIh7SBgK1fwjVlUs4freNekyiiH1yxJGqCUYJCYxh3zOwD5WojLXYjVpsw\n\twEGCTZ9Shd7nB5nFwTL9X9G52CJQNFUq1GJMrr/e63zpEIU3SnoKIr18EEMLyinTSJ6fVosOZkc\n\tQr5sBbMeBDOdXKtijTok3kc/L/iXTpsEKjbHmeE/9GQ==","X-Google-Smtp-Source":"AGHT+IEHcjDWNX8N0MkqJ2yMUlOKWR6zeSeibUBHGiURmFAaLEh2Hhstw85jAdVQJaHC0RENYs/M9Q==","X-Received":"by 2002:a5d:5f87:0:b0:3a3:63d3:368e with SMTP id\n\tffacd0b85a97d-3b60dd14839mr6562931f8f.0.1753084137779; \n\tMon, 21 Jul 2025 00:48:57 -0700 (PDT)","From":"Naushir Patuck <naush@raspberrypi.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"David Plowman <david.plowman@raspberrypi.com>,\n\tNaushir Patuck <naush@raspberrypi.com>","Subject":"[PATCH v2 4/7] ipa: rpi: Advance the delay context counter even when\n\tIPAs 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","Content-Transfer-Encoding":"8bit","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"From: David Plowman <david.plowman@raspberrypi.com>\n\nThe delay context counter must be advanced even when we decide not to\nrun prepare/process. Otherwise, when we skip them at higher\nframerates, the current IPA context counter will catch up and\noverwrite the delay context.\n\nIt's safe to advance the counter because the metadata is always copied\nforward a slot when we decide not to run the IPAs.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: Naushir Patuck <naush@raspberrypi.com>\n---\n src/ipa/rpi/common/ipa_base.cpp | 19 ++++++++++---------\n 1 file changed, 10 insertions(+), 9 deletions(-)","diff":"diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp\nindex 8b4eb75e7e6b..98690b80d5d3 100644\n--- a/src/ipa/rpi/common/ipa_base.cpp\n+++ b/src/ipa/rpi/common/ipa_base.cpp\n@@ -501,10 +501,11 @@ void IpaBase::prepareIsp(const PrepareParams &params)\n void IpaBase::processStats(const ProcessParams &params)\n {\n \tunsigned int ipaContext = params.ipaContext % rpiMetadata_.size();\n+\tRPiController::Metadata &rpiMetadata = rpiMetadata_[ipaContext];\n \n-\tif (processPending_ && frameCount_ >= mistrustCount_) {\n-\t\tRPiController::Metadata &rpiMetadata = rpiMetadata_[ipaContext];\n+\tDuration offset(0s);\n \n+\tif (processPending_ && frameCount_ >= mistrustCount_) {\n \t\tauto it = buffers_.find(params.buffers.stats);\n \t\tif (it == buffers_.end()) {\n \t\t\tLOG(IPARPI, Error) << \"Could not find stats buffer!\";\n@@ -518,14 +519,14 @@ void IpaBase::processStats(const ProcessParams &params)\n \n \t\thelper_->process(statistics, rpiMetadata);\n \t\tcontroller_.process(statistics, &rpiMetadata);\n+\t}\n \n-\t\tstruct AgcStatus agcStatus;\n-\t\tif (rpiMetadata.get(\"agc.status\", agcStatus) == 0) {\n-\t\t\tControlList ctrls(sensorCtrls_);\n-\t\t\tapplyAGC(&agcStatus, ctrls);\n-\t\t\tsetDelayedControls.emit(ctrls, ipaContext);\n-\t\t\tsetCameraTimeoutValue();\n-\t\t}\n+\tstruct AgcStatus agcStatus;\n+\tif (rpiMetadata.get(\"agc.status\", agcStatus) == 0) {\n+\t\tControlList ctrls(sensorCtrls_);\n+\t\tapplyAGC(&agcStatus, ctrls);\n+\t\tsetDelayedControls.emit(ctrls, ipaContext);\n+\t\tsetCameraTimeoutValue();\n \t}\n \n \t/*\n","prefixes":["v2","4/7"]}