[{"id":23094,"web_url":"https://patchwork.libcamera.org/comment/23094/","msgid":"<77b346ba-42ab-cd45-a84b-508c1a6f3732@ideasonboard.com>","date":"2022-05-19T16:02:29","subject":"Re: [libcamera-devel] [RFC PATCH] ipa: ipu3: Retain request\n\tcontrols in the IPA","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/people/86/","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"content":"Hi Kieran,\n\nOn 5/19/22 16:16, Kieran Bingham via libcamera-devel wrote:\n> To ensure consistency in processing control lists, an application does\n> not have to continually set controls that were already set, but not\n> expected to change.\n\n\nSo what is this implying...\n\nIf application sends in manual-exposure=100 just for frame 25th, what is \nit expected to do to \"unset\" it from frame 26th?\n\n- Send in manual-exposure = 0 ?\n\n- send in no manual-exposure, in that case, I assume that the retained \ncontrol list (purpose of this patch) is to set exposure=100 for frame \n26th, which is probably right thing to do?, I am not sure...\n\n\n>\n> To ensure we keep that state, merge incoming request control lists with\n> a stored ControlList that is owned by the IPA and store the state of\n> that merged list to the per frame FrameContext so that algorithms know\n> the full expected control state at that time.\n>\n> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n>\n> ---\n>\n> RFC:\n>\n> 1)\n>\n> If ControlList.update() were implemented like .merge, but with\n> overriding existing values, instead of leaving them then this could be\n> simplified to :\n>\n> +\tretainedControls_.update(controls);\n> +\tcontext_.frameContexts[frame % kMaxFrameContexts] = { frame, std::copy(retainedControls_) };\n>\n> Not yet sure if that's more efficient or if it doesn't make much\n> difference.\n>\n> 2)\n>\n> This will not support triggered controls that are set once to\n> 'fire'... Do we have / plan to have any of those?\n>\n> 3)\n>\n> Do we want to keep both a delta control list (the incoming controls) as\n> well as the merged/retained list for full state so IPA's can know if\n> something was changed?\n\n\nI think so yes. Algorithms might need to look up the delta to know in \nadvance whether or not a manual control is set for a frame or not. \nAccordingly, they might decide the relevant parameter(s)\nFor e.g. manual exposure but automatic gain.\n\n>\n> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> ---\n>   src/ipa/ipu3/ipu3.cpp | 23 ++++++++++++++++++++++-\n>   1 file changed, 22 insertions(+), 1 deletion(-)\n>\n> diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp\n> index 2f6bb672f7bb..89fc34f86e46 100644\n> --- a/src/ipa/ipu3/ipu3.cpp\n> +++ b/src/ipa/ipu3/ipu3.cpp\n> @@ -176,6 +176,9 @@ private:\n>   \n>   \t/* Local parameter storage */\n>   \tstruct IPAContext context_;\n> +\n> +\t/* Control retention to maintain mode states */\n> +\tControlList retainedControls_;\n>   };\n>   \n>   /**\n> @@ -456,6 +459,8 @@ int IPAIPU3::configure(const IPAConfigInfo &configInfo,\n>   \n>   \t/* Clean IPAActiveState at each reconfiguration. */\n>   \tcontext_.activeState = {};\n> +\tretainedControls_.clear();\n> +\n>   \tIPAFrameContext initFrameContext;\n>   \tcontext_.frameContexts.fill(initFrameContext);\n>   \n> @@ -617,8 +622,24 @@ void IPAIPU3::processStatsBuffer(const uint32_t frame,\n>    */\n>   void IPAIPU3::queueRequest(const uint32_t frame, const ControlList &controls)\n>   {\n> +\t/*\n> +\t * Controls are retained, to ensure any mode updates are persistant.\n> +\t * We merge them into our class control storage before assigning to\n> +\t * the frame context.\n> +\t *\n> +\t * \\todo This will not support trigger controls and may need rework if\n> +\t *\t we add any to prevent continually retriggering.\n> +\t *\n> +\t * \\todo We may wish to store both the full merged control list, as well\n> +\t *\t as the delta (\\a controls) to facilitate algorithms identifying\n> +\t *\t when things have changed.\n> +\t */\n> +\tControlList mergeControls = controls;\n> +\tmergeControls.merge(retainedControls_);\n> +\tretainedControls_ = mergeControls;\n> +\n>   \t/* \\todo Start processing for 'frame' based on 'controls'. */\n> -\tcontext_.frameContexts[frame % kMaxFrameContexts] = { frame, controls };\n> +\tcontext_.frameContexts[frame % kMaxFrameContexts] = { frame, std::move(mergeControls) };\n>   }\n>   \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 101ACC3256\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 19 May 2022 16:02:34 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4235A65663;\n\tThu, 19 May 2022 18:02:33 +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 60AB360420\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 19 May 2022 18:02:32 +0200 (CEST)","from [192.168.1.164] (unknown [45.131.31.124])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E4C28576;\n\tThu, 19 May 2022 18:02:31 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1652976153;\n\tbh=dn5/YvdmUUlhWqew9cLq33vj11KB3cfrS98CNm+oRhw=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=CkMCQ+EGPSAjI9xCDAbfcrq2NQQ3RVirAvFnMVIF+qpp8KYW19EJWrq+hMFiNyxQk\n\tXEdOEAoFIK9vBrM+YTYjgvOO3LyU3hp04l7UbTDdZe9ArFoAj4IJbOeShY5EiKnH1b\n\tmM4YD4c6ymYVwNTD0H9W4Xb+zDW7cfDMl3jD2smV/eFPdRFnO4JRoZ6ukoYd205xbC\n\tKDjlJrPchH9iSF81iMSwODt80DOVxuh88C6xHcEg6sTvFYZAt4UIGk8O5W5LghUEPo\n\t8kXe9SdYCISTgl9yKDXOYFAgzCfjiiC51QFitt7pqyJUdsMF2H7t2Ium7kN6jhaZN4\n\tYMhgCZOyKuc+w==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1652976152;\n\tbh=dn5/YvdmUUlhWqew9cLq33vj11KB3cfrS98CNm+oRhw=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=ZaQUdjt4qRhv9AyWDk28q6vncXu2CCaOb7+xLTe9/uKGU7CzzRQmL+nR5qLD4AevX\n\tDBxd0mHbFjHqJT2ygDILosJKvHpbscts3bVBG8iLiGXx/AeUdwaokwWGrmlFh1Kt7Y\n\tdeG+FA5uNxpGb4srfA7dsAVnKyAc7CYp3mvrUF54="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"ZaQUdjt4\"; dkim-atps=neutral","Message-ID":"<77b346ba-42ab-cd45-a84b-508c1a6f3732@ideasonboard.com>","Date":"Thu, 19 May 2022 18:02:29 +0200","MIME-Version":"1.0","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101\n\tThunderbird/91.4.1","Content-Language":"en-US","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>,\n\tlibcamera devel <libcamera-devel@lists.libcamera.org>","References":"<20220519141642.1043792-1-kieran.bingham@ideasonboard.com>","In-Reply-To":"<20220519141642.1043792-1-kieran.bingham@ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [RFC PATCH] ipa: ipu3: Retain request\n\tcontrols in the IPA","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>","From":"Umang Jain via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Umang Jain <umang.jain@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":23106,"web_url":"https://patchwork.libcamera.org/comment/23106/","msgid":"<20220520091255.GG1875478@pyrite.rasen.tech>","date":"2022-05-20T09:12:55","subject":"Re: [libcamera-devel] [RFC PATCH] ipa: ipu3: Retain request\n\tcontrols in the IPA","submitter":{"id":97,"url":"https://patchwork.libcamera.org/api/people/97/","name":"Nicolas Dufresne via libcamera-devel","email":"libcamera-devel@lists.libcamera.org"},"content":"Hello,\n\nOn Thu, May 19, 2022 at 06:02:29PM +0200, Umang Jain via libcamera-devel wrote:\n> Hi Kieran,\n> \n> On 5/19/22 16:16, Kieran Bingham via libcamera-devel wrote:\n> > To ensure consistency in processing control lists, an application does\n> > not have to continually set controls that were already set, but not\n> > expected to change.\n> \n> \n> So what is this implying...\n> \n> If application sends in manual-exposure=100 just for frame 25th, what is it\n> expected to do to \"unset\" it from frame 26th?\n\nimo it depends on what the desired effect is by \"unsetting\" it. If the\ndesire is to revert to the default value, then it's not possible (unless\nthe application saves it and re-applies it). If the desire is to revert\nto auto then just set auto mode back on.\n\n> \n> - Send in manual-exposure = 0 ?\n\nThat'll just set exposure to 0 :D\n\n> \n> - send in no manual-exposure, in that case, I assume that the retained\n> control list (purpose of this patch) is to set exposure=100 for frame 26th,\n> which is probably right thing to do?, I am not sure...\n\nYeah, that's what should happen (what this patch enables).\n\n> \n> \n> > \n> > To ensure we keep that state, merge incoming request control lists with\n> > a stored ControlList that is owned by the IPA and store the state of\n> > that merged list to the per frame FrameContext so that algorithms know\n> > the full expected control state at that time.\n> > \n> > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> > \n> > ---\n> > \n> > RFC:\n> > \n> > 1)\n> > \n> > If ControlList.update() were implemented like .merge, but with\n> > overriding existing values, instead of leaving them then this could be\n> > simplified to :\n> > \n> > +\tretainedControls_.update(controls);\n> > +\tcontext_.frameContexts[frame % kMaxFrameContexts] = { frame, std::copy(retainedControls_) };\n> > \n> > Not yet sure if that's more efficient or if it doesn't make much\n> > difference.\n\nIt makes the code look nicer :p\n\n> > \n> > 2)\n> > \n> > This will not support triggered controls that are set once to\n> > 'fire'... Do we have / plan to have any of those?\n\nYeah that's kind of a big deal for AE.\n\nAlthough the solution could be as simple (read: hacky) as having the IPA\noverwrite the ExposureValue/AnalogueGain values at control application\ntime to the values calculated by AE when in auto mode. Those controls\nneed to report in metadata the actual values that were used anyway, so\nit might actually be a viable solution.\n\nThen, when the mode is switched from auto -> disabled and the control\nisn't resubmitted, it'll retain the value that it had from the last time\nauto was on (because the IPA overwrote them).\n\ntl;dr, If the mode is auto and the manual controls are supplied, IPA\nshould overwrite the requested manual control values in the retained\nrequested contols probably at the same time as it reports them in\nmetadata. This is reationalized as \"submitting manual controls is\ninvalid if the mode is auto\" anyway, plus \"the manual controls in\nmetadata are used to report the actual values that were used\".\n\n> > \n> > 3)\n> > \n> > Do we want to keep both a delta control list (the incoming controls) as\n> > well as the merged/retained list for full state so IPA's can know if\n> > something was changed?\n> \n> I think so yes. Algorithms might need to look up the delta to know in\n> advance whether or not a manual control is set for a frame or not.\n> Accordingly, they might decide the relevant parameter(s)\n> For e.g. manual exposure but automatic gain.\n\nI actually don't think this is necessary. If a control doesn't change,\nit doesn't need to be resubmitted and it'll take the most recently set\nvalue. From the IPA's point of view (with retention), every control will\nbe set every request. So it's not important to see the delta.\n\nThe exception of course is with trigger controls, which we don't want to\nallow. AE almost had this, but I think we can rationalize it as\nmentioned above: submitting manual controls during auto is invalid, so\nwe can do whatever we want, thus we don't even have to treat it as a\ntrigger, we can just overwrite it.\n\n\nPaul\n\n> > \n> > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> > ---\n> >   src/ipa/ipu3/ipu3.cpp | 23 ++++++++++++++++++++++-\n> >   1 file changed, 22 insertions(+), 1 deletion(-)\n> > \n> > diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp\n> > index 2f6bb672f7bb..89fc34f86e46 100644\n> > --- a/src/ipa/ipu3/ipu3.cpp\n> > +++ b/src/ipa/ipu3/ipu3.cpp\n> > @@ -176,6 +176,9 @@ private:\n> >   \t/* Local parameter storage */\n> >   \tstruct IPAContext context_;\n> > +\n> > +\t/* Control retention to maintain mode states */\n> > +\tControlList retainedControls_;\n> >   };\n> >   /**\n> > @@ -456,6 +459,8 @@ int IPAIPU3::configure(const IPAConfigInfo &configInfo,\n> >   \t/* Clean IPAActiveState at each reconfiguration. */\n> >   \tcontext_.activeState = {};\n> > +\tretainedControls_.clear();\n> > +\n> >   \tIPAFrameContext initFrameContext;\n> >   \tcontext_.frameContexts.fill(initFrameContext);\n> > @@ -617,8 +622,24 @@ void IPAIPU3::processStatsBuffer(const uint32_t frame,\n> >    */\n> >   void IPAIPU3::queueRequest(const uint32_t frame, const ControlList &controls)\n> >   {\n> > +\t/*\n> > +\t * Controls are retained, to ensure any mode updates are persistant.\n> > +\t * We merge them into our class control storage before assigning to\n> > +\t * the frame context.\n> > +\t *\n> > +\t * \\todo This will not support trigger controls and may need rework if\n> > +\t *\t we add any to prevent continually retriggering.\n> > +\t *\n> > +\t * \\todo We may wish to store both the full merged control list, as well\n> > +\t *\t as the delta (\\a controls) to facilitate algorithms identifying\n> > +\t *\t when things have changed.\n> > +\t */\n> > +\tControlList mergeControls = controls;\n> > +\tmergeControls.merge(retainedControls_);\n> > +\tretainedControls_ = mergeControls;\n> > +\n> >   \t/* \\todo Start processing for 'frame' based on 'controls'. */\n> > -\tcontext_.frameContexts[frame % kMaxFrameContexts] = { frame, controls };\n> > +\tcontext_.frameContexts[frame % kMaxFrameContexts] = { frame, std::move(mergeControls) };\n> >   }\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 096A9C0F2A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 20 May 2022 09:13:03 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 548EC65665;\n\tFri, 20 May 2022 11:13:02 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C8BB265653\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 20 May 2022 11:13:00 +0200 (CEST)","from pyrite.rasen.tech (unknown [45.131.31.124])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 188315A9;\n\tFri, 20 May 2022 11:13:00 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1653037982;\n\tbh=c8ZnhTDo7B/uOlQ8BxY3/Ruk6tU76UJpuSWGg6KmMC4=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=QcortAKjaaB/LsniiseOcpI7bk8UJ/YP6LFrmrKD6EwaGP/Bgth4xm6J+HRUTTr7o\n\tjQrbKsZI7IFOfpBQ54L01Ngzn5TVVJiolBH1SLl/TREMV6ANJazRS7Ub2tlVSZcMTW\n\ta1ZYrqXUoEWbU9EL8xfc3uSB3msBBW3Yrq/vYLEXQq1aW/8cCGm27ZD4ngTYzD9tgO\n\tibTpILg1h4RMPHOGVIDFHC4xMH1Bl04FwSkb+NYx9GoRWXUGsaiivBWDfTm+5KRrVv\n\t4ZF5AQuJ0ZNjyRLzc1q7nveBgsK6pvufoxRdRrF2UcMJNQIV6cDeDyeEWT36xqrsjb\n\teZeTRlegw2+dg==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1653037980;\n\tbh=c8ZnhTDo7B/uOlQ8BxY3/Ruk6tU76UJpuSWGg6KmMC4=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=lEIYVLZX68b31fDDXz2YGm5WHwbyCQUxKQnXo2kK6t39XRqJQM2LLNq+Oj9ARvFTe\n\trxlJQ5X0SELIEFwuzeOkPJF3MBKXHL4Plalu1NR2P88duYRJOI7NBDVrg5umoHIcMW\n\t4Q7p/pcMc292kZHR71AP72edSyAcN/hjzRUP4Tak="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"lEIYVLZX\"; dkim-atps=neutral","Date":"Fri, 20 May 2022 11:12:55 +0200","To":"Umang Jain <umang.jain@ideasonboard.com>","Message-ID":"<20220520091255.GG1875478@pyrite.rasen.tech>","References":"<20220519141642.1043792-1-kieran.bingham@ideasonboard.com>\n\t<77b346ba-42ab-cd45-a84b-508c1a6f3732@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<77b346ba-42ab-cd45-a84b-508c1a6f3732@ideasonboard.com>","Subject":"Re: [libcamera-devel] [RFC PATCH] ipa: ipu3: Retain request\n\tcontrols in the IPA","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>","From":"Paul Elder via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"paul.elder@ideasonboard.com","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":23107,"web_url":"https://patchwork.libcamera.org/comment/23107/","msgid":"<20220520091456.GH1875478@pyrite.rasen.tech>","date":"2022-05-20T09:14:56","subject":"Re: [libcamera-devel] [RFC PATCH] ipa: ipu3: Retain request\n\tcontrols in the IPA","submitter":{"id":97,"url":"https://patchwork.libcamera.org/api/people/97/","name":"Nicolas Dufresne via libcamera-devel","email":"libcamera-devel@lists.libcamera.org"},"content":"On Thu, May 19, 2022 at 04:16:42PM +0200, Kieran Bingham via libcamera-devel wrote:\n> To ensure consistency in processing control lists, an application does\n> not have to continually set controls that were already set, but not\n> expected to change.\n> \n> To ensure we keep that state, merge incoming request control lists with\n> a stored ControlList that is owned by the IPA and store the state of\n> that merged list to the per frame FrameContext so that algorithms know\n> the full expected control state at that time.\n> \n> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\nOops, I forgot:\n\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\nI think this patch as-is is totally fine. Assuming merge() behaves\nproperly, this does exactly what we want. The \"trigger\" (though not\nreally trigger) controls for AE we can implement them\ndifferently/separately/on top, so this patch is fine.\n\n> \n> ---\n> \n> RFC:\n> \n> 1)\n> \n> If ControlList.update() were implemented like .merge, but with\n> overriding existing values, instead of leaving them then this could be\n> simplified to :\n> \n> +\tretainedControls_.update(controls);\n> +\tcontext_.frameContexts[frame % kMaxFrameContexts] = { frame, std::copy(retainedControls_) };\n> \n> Not yet sure if that's more efficient or if it doesn't make much\n> difference.\n> \n> 2)\n> \n> This will not support triggered controls that are set once to\n> 'fire'... Do we have / plan to have any of those?\n> \n> 3)\n> \n> Do we want to keep both a delta control list (the incoming controls) as\n> well as the merged/retained list for full state so IPA's can know if\n> something was changed?\n> \n> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> ---\n>  src/ipa/ipu3/ipu3.cpp | 23 ++++++++++++++++++++++-\n>  1 file changed, 22 insertions(+), 1 deletion(-)\n> \n> diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp\n> index 2f6bb672f7bb..89fc34f86e46 100644\n> --- a/src/ipa/ipu3/ipu3.cpp\n> +++ b/src/ipa/ipu3/ipu3.cpp\n> @@ -176,6 +176,9 @@ private:\n>  \n>  \t/* Local parameter storage */\n>  \tstruct IPAContext context_;\n> +\n> +\t/* Control retention to maintain mode states */\n> +\tControlList retainedControls_;\n>  };\n>  \n>  /**\n> @@ -456,6 +459,8 @@ int IPAIPU3::configure(const IPAConfigInfo &configInfo,\n>  \n>  \t/* Clean IPAActiveState at each reconfiguration. */\n>  \tcontext_.activeState = {};\n> +\tretainedControls_.clear();\n> +\n>  \tIPAFrameContext initFrameContext;\n>  \tcontext_.frameContexts.fill(initFrameContext);\n>  \n> @@ -617,8 +622,24 @@ void IPAIPU3::processStatsBuffer(const uint32_t frame,\n>   */\n>  void IPAIPU3::queueRequest(const uint32_t frame, const ControlList &controls)\n>  {\n> +\t/*\n> +\t * Controls are retained, to ensure any mode updates are persistant.\n> +\t * We merge them into our class control storage before assigning to\n> +\t * the frame context.\n> +\t *\n> +\t * \\todo This will not support trigger controls and may need rework if\n> +\t *\t we add any to prevent continually retriggering.\n> +\t *\n> +\t * \\todo We may wish to store both the full merged control list, as well\n> +\t *\t as the delta (\\a controls) to facilitate algorithms identifying\n> +\t *\t when things have changed.\n> +\t */\n> +\tControlList mergeControls = controls;\n> +\tmergeControls.merge(retainedControls_);\n> +\tretainedControls_ = mergeControls;\n> +\n>  \t/* \\todo Start processing for 'frame' based on 'controls'. */\n> -\tcontext_.frameContexts[frame % kMaxFrameContexts] = { frame, controls };\n> +\tcontext_.frameContexts[frame % kMaxFrameContexts] = { frame, std::move(mergeControls) };\n>  }\n>  \n>  /**\n> -- \n> 2.25.1\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 09BFAC0F2A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 20 May 2022 09:15:03 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3E1EA65663;\n\tFri, 20 May 2022 11:15:03 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0086565653\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 20 May 2022 11:15:00 +0200 (CEST)","from pyrite.rasen.tech (unknown [45.131.31.124])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 6C1FB5A9;\n\tFri, 20 May 2022 11:15:00 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1653038103;\n\tbh=BaBHzXQyzNZoOZlfjFoMwQsBOxFu09rOygDgSr2HxPY=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=zHvvFRFYS3zmNRdm/M7gJFBgl597/rE50SdwaRHC1h/JR8ATS+U+Csg0S4JkAqAlE\n\tfkkriJF7huyWGEElKOw4rikxmx34scbwNedHdIbDhbtKsIjhZFgOS0fFBHgVBKYUZn\n\tYDucV6MwGzK4a3/8EPA9NaYUsIc0l8Fbo9V80LiftXBEHU1TCVb8Z8jVLeStR+5M+0\n\tNDPvIaRounuIosR0ytGSJntQo88+W8BTA8hGz9M6tSZEwgw6tC+wRb05smHqwL6L9K\n\t9QYxtK8eqL8MUMQTYgAU+pMpEby1JK1haQEjak3VqWbPhso2rfFBnMG/6DA6gg5Na7\n\tI3tD3a0EjaKCw==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1653038100;\n\tbh=BaBHzXQyzNZoOZlfjFoMwQsBOxFu09rOygDgSr2HxPY=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=EkGsogCSZQ6YguMIS9enrB2YauHwjk18BSAAuZRHLIzFiWzaGyg5iHbeZh0QMF0Qj\n\tn3I9BVFrDT/dI+5J5MKHprwLsvLu50Lc3boDljGyY2dVc597mWUgr82FxFHfGoXYUw\n\tPwFNliXXH0pfGPAZoo6ywKFP9+SIwwCgNIlpfZ5o="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"EkGsogCS\"; dkim-atps=neutral","Date":"Fri, 20 May 2022 11:14:56 +0200","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Message-ID":"<20220520091456.GH1875478@pyrite.rasen.tech>","References":"<20220519141642.1043792-1-kieran.bingham@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20220519141642.1043792-1-kieran.bingham@ideasonboard.com>","Subject":"Re: [libcamera-devel] [RFC PATCH] ipa: ipu3: Retain request\n\tcontrols in the IPA","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>","From":"Paul Elder via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"paul.elder@ideasonboard.com","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":23108,"web_url":"https://patchwork.libcamera.org/comment/23108/","msgid":"<165304110347.368702.15410267717631554738@Monstersaurus>","date":"2022-05-20T10:05:03","subject":"Re: [libcamera-devel] [RFC PATCH] ipa: ipu3: Retain request\n\tcontrols in the IPA","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting paul.elder@ideasonboard.com (2022-05-20 10:12:55)\n> Hello,\n> \n> On Thu, May 19, 2022 at 06:02:29PM +0200, Umang Jain via libcamera-devel wrote:\n> > Hi Kieran,\n> > \n> > On 5/19/22 16:16, Kieran Bingham via libcamera-devel wrote:\n> > > To ensure consistency in processing control lists, an application does\n> > > not have to continually set controls that were already set, but not\n> > > expected to change.\n> > \n> > \n> > So what is this implying...\n> > \n> > If application sends in manual-exposure=100 just for frame 25th, what is it\n> > expected to do to \"unset\" it from frame 26th?\n> \n> imo it depends on what the desired effect is by \"unsetting\" it. If the\n> desire is to revert to the default value, then it's not possible (unless\n> the application saves it and re-applies it). If the desire is to revert\n> to auto then just set auto mode back on.\n> \n> > \n> > - Send in manual-exposure = 0 ?\n> \n> That'll just set exposure to 0 :D\n> \n> > \n> > - send in no manual-exposure, in that case, I assume that the retained\n> > control list (purpose of this patch) is to set exposure=100 for frame 26th,\n> > which is probably right thing to do?, I am not sure...\n> \n> Yeah, that's what should happen (what this patch enables).\n> \n> > \n> > \n> > > \n> > > To ensure we keep that state, merge incoming request control lists with\n> > > a stored ControlList that is owned by the IPA and store the state of\n> > > that merged list to the per frame FrameContext so that algorithms know\n> > > the full expected control state at that time.\n> > > \n> > > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> > > \n> > > ---\n> > > \n> > > RFC:\n> > > \n> > > 1)\n> > > \n> > > If ControlList.update() were implemented like .merge, but with\n> > > overriding existing values, instead of leaving them then this could be\n> > > simplified to :\n> > > \n> > > +   retainedControls_.update(controls);\n> > > +   context_.frameContexts[frame % kMaxFrameContexts] = { frame, std::copy(retainedControls_) };\n> > > \n> > > Not yet sure if that's more efficient or if it doesn't make much\n> > > difference.\n> \n> It makes the code look nicer :p\n\nThis patch also has a bug as the ControlList is not initialized with\n(controls::controls) so the Info map is invalid.\n\nI almost wish we had more explicitly typed ControlLists for 'libcamera\ncontrols' and 'v4l2 controls' (and properties ...) which I think Laurent\nstarted to work on but didn't like quite some time ago.\n\n\n> > > \n> > > 2)\n> > > \n> > > This will not support triggered controls that are set once to\n> > > 'fire'... Do we have / plan to have any of those?\n> \n> Yeah that's kind of a big deal for AE.\n> \n> Although the solution could be as simple (read: hacky) as having the IPA\n> overwrite the ExposureValue/AnalogueGain values at control application\n> time to the values calculated by AE when in auto mode. Those controls\n> need to report in metadata the actual values that were used anyway, so\n> it might actually be a viable solution.\n> \n> Then, when the mode is switched from auto -> disabled and the control\n> isn't resubmitted, it'll retain the value that it had from the last time\n> auto was on (because the IPA overwrote them).\n> \n> tl;dr, If the mode is auto and the manual controls are supplied, IPA\n> should overwrite the requested manual control values in the retained\n> requested contols probably at the same time as it reports them in\n> metadata. This is reationalized as \"submitting manual controls is\n> invalid if the mode is auto\" anyway, plus \"the manual controls in\n> metadata are used to report the actual values that were used\".\n\nHrm. ... I'll think more about this. The problem there is that the\n'retainedControls' can be duplicated from two sequentially queued\nRequests which have not yet been processed by the algorithms themselves.\n\n--\nKieran\n\n\n\n\n> \n> > > \n> > > 3)\n> > > \n> > > Do we want to keep both a delta control list (the incoming controls) as\n> > > well as the merged/retained list for full state so IPA's can know if\n> > > something was changed?\n> > \n> > I think so yes. Algorithms might need to look up the delta to know in\n> > advance whether or not a manual control is set for a frame or not.\n> > Accordingly, they might decide the relevant parameter(s)\n> > For e.g. manual exposure but automatic gain.\n> \n> I actually don't think this is necessary. If a control doesn't change,\n> it doesn't need to be resubmitted and it'll take the most recently set\n> value. From the IPA's point of view (with retention), every control will\n> be set every request. So it's not important to see the delta.\n> \n> The exception of course is with trigger controls, which we don't want to\n> allow. AE almost had this, but I think we can rationalize it as\n> mentioned above: submitting manual controls during auto is invalid, so\n> we can do whatever we want, thus we don't even have to treat it as a\n> trigger, we can just overwrite it.\n> \n> \n> Paul\n> \n> > > \n> > > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> > > ---\n> > >   src/ipa/ipu3/ipu3.cpp | 23 ++++++++++++++++++++++-\n> > >   1 file changed, 22 insertions(+), 1 deletion(-)\n> > > \n> > > diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp\n> > > index 2f6bb672f7bb..89fc34f86e46 100644\n> > > --- a/src/ipa/ipu3/ipu3.cpp\n> > > +++ b/src/ipa/ipu3/ipu3.cpp\n> > > @@ -176,6 +176,9 @@ private:\n> > >     /* Local parameter storage */\n> > >     struct IPAContext context_;\n> > > +\n> > > +   /* Control retention to maintain mode states */\n> > > +   ControlList retainedControls_;\n> > >   };\n> > >   /**\n> > > @@ -456,6 +459,8 @@ int IPAIPU3::configure(const IPAConfigInfo &configInfo,\n> > >     /* Clean IPAActiveState at each reconfiguration. */\n> > >     context_.activeState = {};\n> > > +   retainedControls_.clear();\n> > > +\n> > >     IPAFrameContext initFrameContext;\n> > >     context_.frameContexts.fill(initFrameContext);\n> > > @@ -617,8 +622,24 @@ void IPAIPU3::processStatsBuffer(const uint32_t frame,\n> > >    */\n> > >   void IPAIPU3::queueRequest(const uint32_t frame, const ControlList &controls)\n> > >   {\n> > > +   /*\n> > > +    * Controls are retained, to ensure any mode updates are persistant.\n> > > +    * We merge them into our class control storage before assigning to\n> > > +    * the frame context.\n> > > +    *\n> > > +    * \\todo This will not support trigger controls and may need rework if\n> > > +    *       we add any to prevent continually retriggering.\n> > > +    *\n> > > +    * \\todo We may wish to store both the full merged control list, as well\n> > > +    *       as the delta (\\a controls) to facilitate algorithms identifying\n> > > +    *       when things have changed.\n> > > +    */\n> > > +   ControlList mergeControls = controls;\n> > > +   mergeControls.merge(retainedControls_);\n> > > +   retainedControls_ = mergeControls;\n> > > +\n> > >     /* \\todo Start processing for 'frame' based on 'controls'. */\n> > > -   context_.frameContexts[frame % kMaxFrameContexts] = { frame, controls };\n> > > +   context_.frameContexts[frame % kMaxFrameContexts] = { frame, std::move(mergeControls) };\n> > >   }\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 E7CCCC3256\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 20 May 2022 10:05:07 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E771A65660;\n\tFri, 20 May 2022 12:05:06 +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 3B66560440\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 20 May 2022 12:05:06 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id CA5A93E4;\n\tFri, 20 May 2022 12:05:05 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1653041106;\n\tbh=krCs2vmNWwJvTPK/SWh6+kKtsf2vkKnXNmpOvO/xySc=;\n\th=In-Reply-To:References:To:Date:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=qN0lNKkz2n3WaxYeeDEpipa8vDJUYyLJRKkyA6VGD5kpGW+NN2Jh+GHM8clJC6R19\n\t6rreHl3V2+acxwK7DoQDZZ9AqTXkodRoRFTSJQBLSw4WgtCCiRsfVz1rMxAxVtvpyI\n\t6qHulzM6fg2gt3RmFC8MELg2Cc27VHaWSbRYv6dQKQD0Zb2a/Yr0sYcJoGnAya9Yil\n\t1+aRhpdn/1+QquZml+kENkGxYL3cRi2e7/OvNE9/2OOkcDs8ySaknF98jfwCoKNNgQ\n\tTXhFnMme8fhzZsymN3BBZsHTYwdCsrtnd2UkyDOTqLGQkcAVXG9RkWkWNvZjFHAKgG\n\tVIX0xAjl/7bPQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1653041105;\n\tbh=krCs2vmNWwJvTPK/SWh6+kKtsf2vkKnXNmpOvO/xySc=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=IUOqbGoPTp51Bb3MeMSQcH7l0Z/yAeCf9vsm0sDd/9wqMM2Fpb+mP6UJ114kbVuBH\n\tOxsiF1bFhTgD7qduKU6TY7+6Y2ffFt1Fsjh2Lbe/CDfuTwiPX+N+PEcoy8bvKIPoy9\n\tHQT+sNhnzWFMn/rBTxF2ZSN7W6tGHEbyhfKzLoMk="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"IUOqbGoP\"; dkim-atps=neutral","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20220520091255.GG1875478@pyrite.rasen.tech>","References":"<20220519141642.1043792-1-kieran.bingham@ideasonboard.com>\n\t<77b346ba-42ab-cd45-a84b-508c1a6f3732@ideasonboard.com>\n\t<20220520091255.GG1875478@pyrite.rasen.tech>","To":"Umang Jain <umang.jain@ideasonboard.com>, paul.elder@ideasonboard.com","Date":"Fri, 20 May 2022 11:05:03 +0100","Message-ID":"<165304110347.368702.15410267717631554738@Monstersaurus>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [RFC PATCH] ipa: ipu3: Retain request\n\tcontrols in the IPA","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>","From":"Kieran Bingham via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":23141,"web_url":"https://patchwork.libcamera.org/comment/23141/","msgid":"<ac91e74c-cc54-9450-6ead-6f3c53422743@ideasonboard.com>","date":"2022-05-25T06:37:54","subject":"Re: [libcamera-devel] [RFC PATCH] ipa: ipu3: Retain request\n\tcontrols in the IPA","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/people/86/","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"content":"Hi Paul\n\nOn 5/20/22 11:14, Paul Elder via libcamera-devel wrote:\n> On Thu, May 19, 2022 at 04:16:42PM +0200, Kieran Bingham via libcamera-devel wrote:\n>> To ensure consistency in processing control lists, an application does\n>> not have to continually set controls that were already set, but not\n>> expected to change.\n>>\n>> To ensure we keep that state, merge incoming request control lists with\n>> a stored ControlList that is owned by the IPA and store the state of\n>> that merged list to the per frame FrameContext so that algorithms know\n>> the full expected control state at that time.\n>>\n>> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> Oops, I forgot:\n>\n> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n>\n> I think this patch as-is is totally fine. Assuming merge() behaves\n> properly, this does exactly what we want. The \"trigger\" (though not\n> really trigger) controls for AE we can implement them\n> differently/separately/on top, so this patch is fine.\n\n\nAck.\n\nAs long as we are on the same page design-wise, I don't have any \nobjections to the patch, but I'll hold my R-B for now since the design \nwork needs to be solidified in coming days.\n\n>\n>> ---\n>>\n>> RFC:\n>>\n>> 1)\n>>\n>> If ControlList.update() were implemented like .merge, but with\n>> overriding existing values, instead of leaving them then this could be\n>> simplified to :\n>>\n>> +\tretainedControls_.update(controls);\n>> +\tcontext_.frameContexts[frame % kMaxFrameContexts] = { frame, std::copy(retainedControls_) };\n>>\n>> Not yet sure if that's more efficient or if it doesn't make much\n>> difference.\n>>\n>> 2)\n>>\n>> This will not support triggered controls that are set once to\n>> 'fire'... Do we have / plan to have any of those?\n>>\n>> 3)\n>>\n>> Do we want to keep both a delta control list (the incoming controls) as\n>> well as the merged/retained list for full state so IPA's can know if\n>> something was changed?\n>>\n>> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n>> ---\n>>   src/ipa/ipu3/ipu3.cpp | 23 ++++++++++++++++++++++-\n>>   1 file changed, 22 insertions(+), 1 deletion(-)\n>>\n>> diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp\n>> index 2f6bb672f7bb..89fc34f86e46 100644\n>> --- a/src/ipa/ipu3/ipu3.cpp\n>> +++ b/src/ipa/ipu3/ipu3.cpp\n>> @@ -176,6 +176,9 @@ private:\n>>   \n>>   \t/* Local parameter storage */\n>>   \tstruct IPAContext context_;\n>> +\n>> +\t/* Control retention to maintain mode states */\n>> +\tControlList retainedControls_;\n>>   };\n>>   \n>>   /**\n>> @@ -456,6 +459,8 @@ int IPAIPU3::configure(const IPAConfigInfo &configInfo,\n>>   \n>>   \t/* Clean IPAActiveState at each reconfiguration. */\n>>   \tcontext_.activeState = {};\n>> +\tretainedControls_.clear();\n>> +\n>>   \tIPAFrameContext initFrameContext;\n>>   \tcontext_.frameContexts.fill(initFrameContext);\n>>   \n>> @@ -617,8 +622,24 @@ void IPAIPU3::processStatsBuffer(const uint32_t frame,\n>>    */\n>>   void IPAIPU3::queueRequest(const uint32_t frame, const ControlList &controls)\n>>   {\n>> +\t/*\n>> +\t * Controls are retained, to ensure any mode updates are persistant.\n>> +\t * We merge them into our class control storage before assigning to\n>> +\t * the frame context.\n>> +\t *\n>> +\t * \\todo This will not support trigger controls and may need rework if\n>> +\t *\t we add any to prevent continually retriggering.\n>> +\t *\n>> +\t * \\todo We may wish to store both the full merged control list, as well\n>> +\t *\t as the delta (\\a controls) to facilitate algorithms identifying\n>> +\t *\t when things have changed.\n>> +\t */\n>> +\tControlList mergeControls = controls;\n>> +\tmergeControls.merge(retainedControls_);\n>> +\tretainedControls_ = mergeControls;\n>> +\n>>   \t/* \\todo Start processing for 'frame' based on 'controls'. */\n>> -\tcontext_.frameContexts[frame % kMaxFrameContexts] = { frame, controls };\n>> +\tcontext_.frameContexts[frame % kMaxFrameContexts] = { frame, std::move(mergeControls) };\n>>   }\n>>   \n>>   /**\n>> -- \n>> 2.25.1\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 E02AEBD160\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 25 May 2022 06:37:59 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 38FC865663;\n\tWed, 25 May 2022 08:37:59 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E85AA60413\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 25 May 2022 08:37:57 +0200 (CEST)","from [192.168.219.240] (167.red-37-10-198.dynamicip.rima-tde.net\n\t[37.10.198.167])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 51EAA963;\n\tWed, 25 May 2022 08:37:57 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1653460679;\n\tbh=LP+w2CQe5pgqsFe3hLJiY+1QWAMmF2nR0l/6SY/irlo=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=gUgSBqPV/WOrEiX/cRdSjNvvyKXqeud7uFAzi+SHLKCAT0Yr4bd84u7/z1/xzhSDH\n\tjOG+19NH7rabdw7EvDLBG+2hDtotMUxehRW0jW5A8ocu7/tAVjnTk5UT4PhQtaqdDt\n\taFuwe5cCUGBQqBdC8gMVSqx9XX70ca8WIvSnWlpYYk9Q2ZKVGHH/1XQRK03pC9iBL3\n\tKzyjGhIgOQLZWp3HLGTHxBQ19mcSqI8vaw/X3Hx0wCXYboiyvfPIURHfBb2L0Qj483\n\tb+pFyn1V4o4htZT7hUmfxK7wow40dgm7gZRgHzQ5p95qWUn29Z55i7B6otnBwSRz0y\n\tYaPxSjK4zpurQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1653460677;\n\tbh=LP+w2CQe5pgqsFe3hLJiY+1QWAMmF2nR0l/6SY/irlo=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=tAlyC0XjXGbvDH60ZYmRzGb06b0v6tkI3oaktnxHV5gqkSKal6B6w5tHK6M7pYLrw\n\t6CdWtWcxabqQwHTwttb6z3OiNzVZ6qYE7JOpff8EK2ZmrPCZL73aVAW6wm7juYNV+7\n\t6uFyHqJMkRcwud+8zCA7MrssYX1+JnFowwopEHu4="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"tAlyC0Xj\"; dkim-atps=neutral","Message-ID":"<ac91e74c-cc54-9450-6ead-6f3c53422743@ideasonboard.com>","Date":"Wed, 25 May 2022 08:37:54 +0200","MIME-Version":"1.0","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101\n\tThunderbird/91.4.1","Content-Language":"en-US","To":"paul.elder@ideasonboard.com,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>","References":"<20220519141642.1043792-1-kieran.bingham@ideasonboard.com>\n\t<20220520091456.GH1875478@pyrite.rasen.tech>","In-Reply-To":"<20220520091456.GH1875478@pyrite.rasen.tech>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [RFC PATCH] ipa: ipu3: Retain request\n\tcontrols in the IPA","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>","From":"Umang Jain via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Umang Jain <umang.jain@ideasonboard.com>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]