[{"id":36897,"web_url":"https://patchwork.libcamera.org/comment/36897/","msgid":"<20251119042720.GR10711@pendragon.ideasonboard.com>","date":"2025-11-19T04:27:20","subject":"Re: [PATCH v3 04/19] ipa: mali: Move exposure limits to sensor\n\tconfig","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Fri, Nov 14, 2025 at 03:16:59PM +0100, Jacopo Mondi wrote:\n> Move the exposure limits (shutter time and gains) in the IPAContext\n> sensor configuration and not in the 'agc' member.\n> \n> This aligns the Mali IPA with the RkISP1 and will help unifying the\n> handling of sensor configuration data through a common type.\n> \n> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n> ---\n>  src/ipa/mali-c55/algorithms/agc.cpp | 12 ++++++------\n>  src/ipa/mali-c55/ipa_context.h      |  8 ++++----\n>  src/ipa/mali-c55/mali-c55.cpp       |  9 +++++----\n>  3 files changed, 15 insertions(+), 14 deletions(-)\n> \n> diff --git a/src/ipa/mali-c55/algorithms/agc.cpp b/src/ipa/mali-c55/algorithms/agc.cpp\n> index f60fddac3f04fd6f09dc782e929ff1593758c29b..4fa00769d201d906be357809f5af02c71201a4f1 100644\n> --- a/src/ipa/mali-c55/algorithms/agc.cpp\n> +++ b/src/ipa/mali-c55/algorithms/agc.cpp\n> @@ -160,20 +160,20 @@ int Agc::configure(IPAContext &context,\n>  \t * minimum analogue gain. AEGC is _active_ by default.\n>  \t */\n>  \tcontext.activeState.agc.autoEnabled = true;\n> -\tcontext.activeState.agc.automatic.sensorGain = context.configuration.agc.minAnalogueGain;\n> +\tcontext.activeState.agc.automatic.sensorGain = context.configuration.sensor.minAnalogueGain;\n>  \tcontext.activeState.agc.automatic.exposure = context.configuration.agc.defaultExposure;\n>  \tcontext.activeState.agc.automatic.ispGain = kMinDigitalGain;\n> -\tcontext.activeState.agc.manual.sensorGain = context.configuration.agc.minAnalogueGain;\n> +\tcontext.activeState.agc.manual.sensorGain = context.configuration.sensor.minAnalogueGain;\n>  \tcontext.activeState.agc.manual.exposure = context.configuration.agc.defaultExposure;\n>  \tcontext.activeState.agc.manual.ispGain = kMinDigitalGain;\n>  \tcontext.activeState.agc.constraintMode = constraintModes().begin()->first;\n>  \tcontext.activeState.agc.exposureMode = exposureModeHelpers().begin()->first;\n>  \n>  \t/* \\todo Run this again when FrameDurationLimits is passed in */\n> -\tsetLimits(context.configuration.agc.minShutterSpeed,\n> -\t\t  context.configuration.agc.maxShutterSpeed,\n> -\t\t  context.configuration.agc.minAnalogueGain,\n> -\t\t  context.configuration.agc.maxAnalogueGain,\n> +\tsetLimits(context.configuration.sensor.minShutterSpeed,\n> +\t\t  context.configuration.sensor.maxShutterSpeed,\n> +\t\t  context.configuration.sensor.minAnalogueGain,\n> +\t\t  context.configuration.sensor.maxAnalogueGain,\n>  \t\t  {});\n>  \n>  \tresetFrameCount();\n> diff --git a/src/ipa/mali-c55/ipa_context.h b/src/ipa/mali-c55/ipa_context.h\n> index bfa805c7b93f313dda2497365e83542bbc39e291..fe75590ec93302e61a31e4832f5c497aab80cf4d 100644\n> --- a/src/ipa/mali-c55/ipa_context.h\n> +++ b/src/ipa/mali-c55/ipa_context.h\n> @@ -21,17 +21,17 @@ namespace ipa::mali_c55 {\n>  \n>  struct IPASessionConfiguration {\n>  \tstruct {\n> -\t\tutils::Duration minShutterSpeed;\n> -\t\tutils::Duration maxShutterSpeed;\n>  \t\tuint32_t defaultExposure;\n> -\t\tdouble minAnalogueGain;\n> -\t\tdouble maxAnalogueGain;\n>  \t} agc;\n>  \n>  \tstruct {\n>  \t\tBayerFormat::Order bayerOrder;\n>  \t\tutils::Duration lineDuration;\n>  \t\tuint32_t blackLevel;\n> +\t\tutils::Duration minShutterSpeed;\n> +\t\tutils::Duration maxShutterSpeed;\n\nIt would be nice to rename this to minExposureTime and maxExposureTime\nto align the names with rkisp1. Maybe that's done later in this series.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> +\t\tdouble minAnalogueGain;\n> +\t\tdouble maxAnalogueGain;\n>  \t} sensor;\n>  };\n>  \n> diff --git a/src/ipa/mali-c55/mali-c55.cpp b/src/ipa/mali-c55/mali-c55.cpp\n> index 0751513dc584ca84dd212bf8c1469dd4b40c053d..9375facf7ab559853986f66634d4e36b896361c8 100644\n> --- a/src/ipa/mali-c55/mali-c55.cpp\n> +++ b/src/ipa/mali-c55/mali-c55.cpp\n> @@ -185,11 +185,12 @@ void IPAMaliC55::updateSessionConfiguration(const IPACameraSensorInfo &info,\n>  \t * \\todo take VBLANK into account for maximum shutter speed\n>  \t */\n>  \tcontext_.configuration.sensor.lineDuration = info.minLineLength * 1.0s / info.pixelRate;\n> -\tcontext_.configuration.agc.minShutterSpeed = minExposure * context_.configuration.sensor.lineDuration;\n> -\tcontext_.configuration.agc.maxShutterSpeed = maxExposure * context_.configuration.sensor.lineDuration;\n> +\tcontext_.configuration.sensor.minShutterSpeed = minExposure * context_.configuration.sensor.lineDuration;\n> +\tcontext_.configuration.sensor.maxShutterSpeed = maxExposure * context_.configuration.sensor.lineDuration;\n> +\tcontext_.configuration.sensor.minAnalogueGain = context_.camHelper->gain(minGain);\n> +\tcontext_.configuration.sensor.maxAnalogueGain = context_.camHelper->gain(maxGain);\n> +\n>  \tcontext_.configuration.agc.defaultExposure = defExposure;\n> -\tcontext_.configuration.agc.minAnalogueGain = context_.camHelper->gain(minGain);\n> -\tcontext_.configuration.agc.maxAnalogueGain = context_.camHelper->gain(maxGain);\n>  \n>  \tif (context_.camHelper->blackLevel().has_value()) {\n>  \t\t/*","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 EAC6EC0F1B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 19 Nov 2025 04:29:38 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E2BF660A8B;\n\tWed, 19 Nov 2025 05:29:37 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0499A60856\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 19 Nov 2025 05:29:35 +0100 (CET)","from pendragon.ideasonboard.com (unknown [205.220.129.225])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 03447DD9;\n\tWed, 19 Nov 2025 05:27:27 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"kptEMOkZ\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1763526451;\n\tbh=zeCSXuXHUo/S1B527kvO6oJ02rb6YPbNIfuvjVcR4Hg=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=kptEMOkZLLuq16ttoKf1JuNzet6Tb2v3gOQ1JtIJDYMSt9OYAfhGivKQxP6YjAzS8\n\tu7YRqnA0M/5iADXGRk6LavUkqTun1aMFSx+1k7ueGRLK5octSdyuuo5PoUrgOnN2na\n\tAKLnBf1hE01L1XPwe/832BSRAUxFohERuphao8C0=","Date":"Wed, 19 Nov 2025 13:27:20 +0900","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","Cc":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>,\n\tRobert Mader <robert.mader@collabora.com>, \n\tlibcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v3 04/19] ipa: mali: Move exposure limits to sensor\n\tconfig","Message-ID":"<20251119042720.GR10711@pendragon.ideasonboard.com>","References":"<20251114-exposure-limits-v3-0-b7c07feba026@ideasonboard.com>\n\t<20251114-exposure-limits-v3-4-b7c07feba026@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20251114-exposure-limits-v3-4-b7c07feba026@ideasonboard.com>","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>"}},{"id":36925,"web_url":"https://patchwork.libcamera.org/comment/36925/","msgid":"<sgkee4ojp4c3fv4bpn25alkatvit3psctvamzfqvb2vfh3yiss@ywdvsj7qn26d>","date":"2025-11-19T18:54:35","subject":"Re: [PATCH v3 04/19] ipa: mali: Move exposure limits to sensor\n\tconfig","submitter":{"id":143,"url":"https://patchwork.libcamera.org/api/people/143/","name":"Jacopo Mondi","email":"jacopo.mondi@ideasonboard.com"},"content":"Hi Laurent\n\nOn Wed, Nov 19, 2025 at 01:27:20PM +0900, Laurent Pinchart wrote:\n> On Fri, Nov 14, 2025 at 03:16:59PM +0100, Jacopo Mondi wrote:\n> > Move the exposure limits (shutter time and gains) in the IPAContext\n> > sensor configuration and not in the 'agc' member.\n> >\n> > This aligns the Mali IPA with the RkISP1 and will help unifying the\n> > handling of sensor configuration data through a common type.\n> >\n> > Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n> > ---\n> >  src/ipa/mali-c55/algorithms/agc.cpp | 12 ++++++------\n> >  src/ipa/mali-c55/ipa_context.h      |  8 ++++----\n> >  src/ipa/mali-c55/mali-c55.cpp       |  9 +++++----\n> >  3 files changed, 15 insertions(+), 14 deletions(-)\n> >\n> > diff --git a/src/ipa/mali-c55/algorithms/agc.cpp b/src/ipa/mali-c55/algorithms/agc.cpp\n> > index f60fddac3f04fd6f09dc782e929ff1593758c29b..4fa00769d201d906be357809f5af02c71201a4f1 100644\n> > --- a/src/ipa/mali-c55/algorithms/agc.cpp\n> > +++ b/src/ipa/mali-c55/algorithms/agc.cpp\n> > @@ -160,20 +160,20 @@ int Agc::configure(IPAContext &context,\n> >  \t * minimum analogue gain. AEGC is _active_ by default.\n> >  \t */\n> >  \tcontext.activeState.agc.autoEnabled = true;\n> > -\tcontext.activeState.agc.automatic.sensorGain = context.configuration.agc.minAnalogueGain;\n> > +\tcontext.activeState.agc.automatic.sensorGain = context.configuration.sensor.minAnalogueGain;\n> >  \tcontext.activeState.agc.automatic.exposure = context.configuration.agc.defaultExposure;\n> >  \tcontext.activeState.agc.automatic.ispGain = kMinDigitalGain;\n> > -\tcontext.activeState.agc.manual.sensorGain = context.configuration.agc.minAnalogueGain;\n> > +\tcontext.activeState.agc.manual.sensorGain = context.configuration.sensor.minAnalogueGain;\n> >  \tcontext.activeState.agc.manual.exposure = context.configuration.agc.defaultExposure;\n> >  \tcontext.activeState.agc.manual.ispGain = kMinDigitalGain;\n> >  \tcontext.activeState.agc.constraintMode = constraintModes().begin()->first;\n> >  \tcontext.activeState.agc.exposureMode = exposureModeHelpers().begin()->first;\n> >\n> >  \t/* \\todo Run this again when FrameDurationLimits is passed in */\n> > -\tsetLimits(context.configuration.agc.minShutterSpeed,\n> > -\t\t  context.configuration.agc.maxShutterSpeed,\n> > -\t\t  context.configuration.agc.minAnalogueGain,\n> > -\t\t  context.configuration.agc.maxAnalogueGain,\n> > +\tsetLimits(context.configuration.sensor.minShutterSpeed,\n> > +\t\t  context.configuration.sensor.maxShutterSpeed,\n> > +\t\t  context.configuration.sensor.minAnalogueGain,\n> > +\t\t  context.configuration.sensor.maxAnalogueGain,\n> >  \t\t  {});\n> >\n> >  \tresetFrameCount();\n> > diff --git a/src/ipa/mali-c55/ipa_context.h b/src/ipa/mali-c55/ipa_context.h\n> > index bfa805c7b93f313dda2497365e83542bbc39e291..fe75590ec93302e61a31e4832f5c497aab80cf4d 100644\n> > --- a/src/ipa/mali-c55/ipa_context.h\n> > +++ b/src/ipa/mali-c55/ipa_context.h\n> > @@ -21,17 +21,17 @@ namespace ipa::mali_c55 {\n> >\n> >  struct IPASessionConfiguration {\n> >  \tstruct {\n> > -\t\tutils::Duration minShutterSpeed;\n> > -\t\tutils::Duration maxShutterSpeed;\n> >  \t\tuint32_t defaultExposure;\n> > -\t\tdouble minAnalogueGain;\n> > -\t\tdouble maxAnalogueGain;\n> >  \t} agc;\n> >\n> >  \tstruct {\n> >  \t\tBayerFormat::Order bayerOrder;\n> >  \t\tutils::Duration lineDuration;\n> >  \t\tuint32_t blackLevel;\n> > +\t\tutils::Duration minShutterSpeed;\n> > +\t\tutils::Duration maxShutterSpeed;\n>\n> It would be nice to rename this to minExposureTime and maxExposureTime\n> to align the names with rkisp1. Maybe that's done later in this series.\n\nYou know, Stefan pointed out the same, and I really thought we were\ngoing into the opposite direction: replacing ExposureTime with\nShutterTime! I actually started converting the AgcMeanLuminance class,\nfortunately I stopped and thought I could have done on top of this series...\n\nI'll add a patch on the next version to s/ShutterSpeed/ExposureTime in\nthe Mali IPA.\n\nThanks\n  j\n\n>\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n>\n> > +\t\tdouble minAnalogueGain;\n> > +\t\tdouble maxAnalogueGain;\n> >  \t} sensor;\n> >  };\n> >\n> > diff --git a/src/ipa/mali-c55/mali-c55.cpp b/src/ipa/mali-c55/mali-c55.cpp\n> > index 0751513dc584ca84dd212bf8c1469dd4b40c053d..9375facf7ab559853986f66634d4e36b896361c8 100644\n> > --- a/src/ipa/mali-c55/mali-c55.cpp\n> > +++ b/src/ipa/mali-c55/mali-c55.cpp\n> > @@ -185,11 +185,12 @@ void IPAMaliC55::updateSessionConfiguration(const IPACameraSensorInfo &info,\n> >  \t * \\todo take VBLANK into account for maximum shutter speed\n> >  \t */\n> >  \tcontext_.configuration.sensor.lineDuration = info.minLineLength * 1.0s / info.pixelRate;\n> > -\tcontext_.configuration.agc.minShutterSpeed = minExposure * context_.configuration.sensor.lineDuration;\n> > -\tcontext_.configuration.agc.maxShutterSpeed = maxExposure * context_.configuration.sensor.lineDuration;\n> > +\tcontext_.configuration.sensor.minShutterSpeed = minExposure * context_.configuration.sensor.lineDuration;\n> > +\tcontext_.configuration.sensor.maxShutterSpeed = maxExposure * context_.configuration.sensor.lineDuration;\n> > +\tcontext_.configuration.sensor.minAnalogueGain = context_.camHelper->gain(minGain);\n> > +\tcontext_.configuration.sensor.maxAnalogueGain = context_.camHelper->gain(maxGain);\n> > +\n> >  \tcontext_.configuration.agc.defaultExposure = defExposure;\n> > -\tcontext_.configuration.agc.minAnalogueGain = context_.camHelper->gain(minGain);\n> > -\tcontext_.configuration.agc.maxAnalogueGain = context_.camHelper->gain(maxGain);\n> >\n> >  \tif (context_.camHelper->blackLevel().has_value()) {\n> >  \t\t/*\n>\n> --\n> Regards,\n>\n> Laurent Pinchart","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 B73DBC0F1B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 19 Nov 2025 18:54:42 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id F178D60A8B;\n\tWed, 19 Nov 2025 19:54:41 +0100 (CET)","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 16547606A0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 19 Nov 2025 19:54:40 +0100 (CET)","from ideasonboard.com (mob-5-90-141-194.net.vodafone.it\n\t[5.90.141.194])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E9350DD9;\n\tWed, 19 Nov 2025 19:52:34 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"rSEfoI5M\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1763578355;\n\tbh=CzjZmhaxipKH3BFnzIvPBOq1wm3o2hlZCYv4bZXLaAs=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=rSEfoI5MeDewWR6zOcNN5YUF4OWxtY9fV5Gui9sJGHvMb5zLY/JQ41tw9neinlQPF\n\tiD1mqIsseDSvGERd3wV7ZZuiusDo5A0NoewUSj5J2pSR/Yjb4xhTandahVM/MS2nUf\n\t+Zu+NjmjbvGGTp5Bd/1RNkWfPue4siP8arkBGixs=","Date":"Wed, 19 Nov 2025 19:54:35 +0100","From":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>,  Niklas =?utf-8?b?U8O2?=\n\t=?utf-8?q?derlund?= <niklas.soderlund@ragnatech.se>, Robert Mader\n\t<robert.mader@collabora.com>,  libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v3 04/19] ipa: mali: Move exposure limits to sensor\n\tconfig","Message-ID":"<sgkee4ojp4c3fv4bpn25alkatvit3psctvamzfqvb2vfh3yiss@ywdvsj7qn26d>","References":"<20251114-exposure-limits-v3-0-b7c07feba026@ideasonboard.com>\n\t<20251114-exposure-limits-v3-4-b7c07feba026@ideasonboard.com>\n\t<20251119042720.GR10711@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20251119042720.GR10711@pendragon.ideasonboard.com>","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>"}}]