[{"id":34966,"web_url":"https://patchwork.libcamera.org/comment/34966/","msgid":"<175309690046.50296.11285615609618936195@ping.linuxembedded.co.uk>","date":"2025-07-21T11:21:40","subject":"Re: [PATCH v2 4/7] ipa: rpi: Advance the delay context counter even\n\twhen IPAs don't run","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Naushir Patuck (2025-07-21 08:47:24)\n> From: David Plowman <david.plowman@raspberrypi.com>\n> \n> The delay context counter must be advanced even when we decide not to\n> run prepare/process. Otherwise, when we skip them at higher\n> framerates, the current IPA context counter will catch up and\n> overwrite the delay context.\n> \n> It's safe to advance the counter because the metadata is always copied\n> forward a slot when we decide not to run the IPAs.\n> \n> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>\n> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> Reviewed-by: Naushir Patuck <naush@raspberrypi.com>\n> ---\n>  src/ipa/rpi/common/ipa_base.cpp | 19 ++++++++++---------\n>  1 file changed, 10 insertions(+), 9 deletions(-)\n> \n> diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp\n> index 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>         unsigned int ipaContext = params.ipaContext % rpiMetadata_.size();\n> +       RPiController::Metadata &rpiMetadata = rpiMetadata_[ipaContext];\n>  \n> -       if (processPending_ && frameCount_ >= mistrustCount_) {\n> -               RPiController::Metadata &rpiMetadata = rpiMetadata_[ipaContext];\n> +       Duration offset(0s);\n\nThis is never used as far as I can see - and it's breaking CI:\n\n[389/648] Compiling C++ object src/ipa/rpi/common/librpi_ipa_common.a.p/ipa_base.cpp.o\nFAILED: src/ipa/rpi/common/librpi_ipa_common.a.p/ipa_base.cpp.o\nclang++ -Isrc/ipa/rpi/common/librpi_ipa_common.a.p -Isrc/ipa/rpi/common -I../src/ipa/rpi/common -Isrc/ipa/rpi -I../src/ipa/rpi -Iinclude -I../include -Iinclude/libcamera/ipa -Iinclude/libcamera -fcolor-diagnostics -fsanitize=address -fno-omit-frame-pointer -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Werror -std=c++17 -O0 -g -Wnon-virtual-dtor -stdlib=libc++ -Wextra-semi -Wthread-safety -Wmissing-declarations -Wshadow -include /builds/camera/libcamera/build/config.h -Wno-c99-designator -fPIC -DLIBCAMERA_BASE_PRIVATE -MD -MQ src/ipa/rpi/common/librpi_ipa_common.a.p/ipa_base.cpp.o -MF src/ipa/rpi/common/librpi_ipa_common.a.p/ipa_base.cpp.o.d -o src/ipa/rpi/common/librpi_ipa_common.a.p/ipa_base.cpp.o -c ../src/ipa/rpi/common/ipa_base.cpp\n../src/ipa/rpi/common/ipa_base.cpp:511:11: error: unused variable 'offset' [-Werror,-Wunused-variable]\n        Duration offset(0s);\n                 ^\n1 error generated.\n\n\nI think it's safe to remove so I'll try that and repush to gitlab.\n\n\nOk - now it's through:\nhttps://gitlab.freedesktop.org/camera/libcamera/-/jobs/80899046\n\n\nI'll also fix this up and then push:\n\n---------------------------------------------------------------------------------------------------\n70a9f8917e0166cba04429f07010caf51c709188 ipa: rpi: agc: Change handling of colour gains less than 1\n---------------------------------------------------------------------------------------------------\n--- src/ipa/rpi/controller/rpi/agc_channel.cpp\n+++ src/ipa/rpi/controller/rpi/agc_channel.cpp\n@@ -711,7 +710,7 @@\n \t}\n\n \t/* Factor in the AWB correction if needed. */\n-\tif (stats->agcStatsPos == Statistics::AgcStatsPos::PreWb)  {\n+\tif (stats->agcStatsPos == Statistics::AgcStatsPos::PreWb) {\n \t\tdouble minColourGain = std::min({ awb.gainR, awb.gainG, awb.gainB, 1.0 });\n \t\tminColourGain = std::max(minColourGain, 1.0);\n \t\tRGB<double> colourGains{ { awb.gainR, awb.gainG, awb.gainB } };\n---\n\n--\nKieran\n\n\n>  \n> +       if (processPending_ && frameCount_ >= mistrustCount_) {\n>                 auto it = buffers_.find(params.buffers.stats);\n>                 if (it == buffers_.end()) {\n>                         LOG(IPARPI, Error) << \"Could not find stats buffer!\";\n> @@ -518,14 +519,14 @@ void IpaBase::processStats(const ProcessParams &params)\n>  \n>                 helper_->process(statistics, rpiMetadata);\n>                 controller_.process(statistics, &rpiMetadata);\n> +       }\n>  \n> -               struct AgcStatus agcStatus;\n> -               if (rpiMetadata.get(\"agc.status\", agcStatus) == 0) {\n> -                       ControlList ctrls(sensorCtrls_);\n> -                       applyAGC(&agcStatus, ctrls);\n> -                       setDelayedControls.emit(ctrls, ipaContext);\n> -                       setCameraTimeoutValue();\n> -               }\n> +       struct AgcStatus agcStatus;\n> +       if (rpiMetadata.get(\"agc.status\", agcStatus) == 0) {\n> +               ControlList ctrls(sensorCtrls_);\n> +               applyAGC(&agcStatus, ctrls);\n> +               setDelayedControls.emit(ctrls, ipaContext);\n> +               setCameraTimeoutValue();\n>         }\n>  \n>         /*\n> -- \n> 2.43.0\n>","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 7D5E7C3237\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 21 Jul 2025 11:21:50 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CC16468FE1;\n\tMon, 21 Jul 2025 13:21:49 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B744D68FD0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 21 Jul 2025 13:21:48 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id CBC22111F;\n\tMon, 21 Jul 2025 13:21:08 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"r4V0GC0V\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1753096869;\n\tbh=z6VLY1+bmvWfsSleqgE47VFRbgG0RlE5M3oDc3UTNzc=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=r4V0GC0ViO148LdmX33sDvs7ofGfCtr2qhdu5peKsFGeK9bef+c76zU31ah1K0ik3\n\tkr1hfgQ8Yu08m1+r/cVpKyJxZthIZDJadt4j9DC4/lM6+VLSnw5aDxCsAx83ySi3p4\n\tO++9BEK7L164VuIq24hggZcKl3kPmu17JeGauTio=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20250721074853.1463358-5-naush@raspberrypi.com>","References":"<20250721074853.1463358-1-naush@raspberrypi.com>\n\t<20250721074853.1463358-5-naush@raspberrypi.com>","Subject":"Re: [PATCH v2 4/7] ipa: rpi: Advance the delay context counter even\n\twhen IPAs don't run","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"David Plowman <david.plowman@raspberrypi.com>,\n\tNaushir Patuck <naush@raspberrypi.com>","To":"Naushir Patuck <naush@raspberrypi.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Mon, 21 Jul 2025 12:21:40 +0100","Message-ID":"<175309690046.50296.11285615609618936195@ping.linuxembedded.co.uk>","User-Agent":"alot/0.9.1","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>"}}]