[{"id":24932,"web_url":"https://patchwork.libcamera.org/comment/24932/","msgid":"<4e9da811-ea4a-f9f5-7b23-ae39bccfb58d@ideasonboard.com>","date":"2022-09-05T09:09:13","subject":"Re: [libcamera-devel] [PATCH v2 2/7] delayed_controls: Add user\n\tcookie to DelayedControls","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/people/86/","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"content":"Hi Naushir,\n\nThank you for the patch. Few clarifications questions below...\n\nOn 9/5/22 1:09 PM, Naushir Patuck via libcamera-devel wrote:\n> Allow the caller to provide a cookie value to DelayedControls::reset and\n> DelayedControls::push. This cookie value is returned from DelayedControls::get\n> for the frame that has the control values applied to it.\n>\n> The cookie value is useful in tracking when a set of controls has been applied\n> to a frame. In a subsequent commit, it will be used by the Raspberry Pi IPA to\n> track the IPA context used when setting the control values.\n\n\nDo you mean that the latest controls applied on the sensor are \nrepresented by the cookie? Meaning the sequence parameter in \nDelayedControls::get(sequence)  has no co-relation with cookie being \nreturned?\n\nThis brings me to a follow up question that, if \nDelayedControls::get(sequence) being called multiple times on same \nsequence number - does it mean the cookie returned, will get changed \neverytime? Will that be expected behavior?\n\n> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> ---\n>   include/libcamera/internal/delayed_controls.h   |  8 +++++---\n>   src/libcamera/delayed_controls.cpp              | 17 +++++++++++------\n>   src/libcamera/pipeline/ipu3/ipu3.cpp            |  3 ++-\n>   .../pipeline/raspberrypi/raspberrypi.cpp        |  2 +-\n>   src/libcamera/pipeline/rkisp1/rkisp1.cpp        |  3 ++-\n>   test/delayed_controls.cpp                       |  8 ++++----\n>   6 files changed, 25 insertions(+), 16 deletions(-)\n>\n> diff --git a/include/libcamera/internal/delayed_controls.h b/include/libcamera/internal/delayed_controls.h\n> index f6e622f1dfba..fa222bb17d23 100644\n> --- a/include/libcamera/internal/delayed_controls.h\n> +++ b/include/libcamera/internal/delayed_controls.h\n> @@ -9,6 +9,7 @@\n>   \n>   #include <stdint.h>\n>   #include <unordered_map>\n> +#include <utility>\n>   \n>   #include <libcamera/controls.h>\n>   \n> @@ -27,10 +28,10 @@ public:\n>   \tDelayedControls(V4L2Device *device,\n>   \t\t\tconst std::unordered_map<uint32_t, ControlParams> &controlParams);\n>   \n> -\tvoid reset();\n> +\tvoid reset(unsigned int cookie = 0);\n>   \n> -\tbool push(const ControlList &controls);\n> -\tControlList get(uint32_t sequence);\n> +\tbool push(const ControlList &controls, unsigned int cookie = 0);\n> +\tstd::pair<ControlList, unsigned int> get(uint32_t sequence);\n>   \n>   \tvoid applyControls(uint32_t sequence);\n>   \n> @@ -77,6 +78,7 @@ private:\n>   \tuint32_t writeCount_;\n>   \t/* \\todo Evaluate if we should index on ControlId * or unsigned int */\n>   \tstd::unordered_map<const ControlId *, ControlRingBuffer<Info>> values_;\n> +\tControlRingBuffer<unsigned int> cookies_;\n\nMaybe some level of naming bikeshedding is required on \n\"ControlRingBuffer\", since now it's templated (1/7) But that can be later...\n>   };\n>   \n>   } /* namespace libcamera */\n> diff --git a/src/libcamera/delayed_controls.cpp b/src/libcamera/delayed_controls.cpp\n> index 777441e8222a..c2198d0e8d77 100644\n> --- a/src/libcamera/delayed_controls.cpp\n> +++ b/src/libcamera/delayed_controls.cpp\n> @@ -109,14 +109,16 @@ DelayedControls::DelayedControls(V4L2Device *device,\n>   \n>   /**\n>    * \\brief Reset state machine\n> + * \\param[in] cookie User supplied reset cookie value\n>    *\n>    * Resets the state machine to a starting position based on control values\n>    * retrieved from the device.\n>    */\n> -void DelayedControls::reset()\n> +void DelayedControls::reset(unsigned int cookie)\n>   {\n>   \tqueueCount_ = 1;\n>   \twriteCount_ = 0;\n> +\tcookies_[0] = cookie;\n>   \n>   \t/* Retrieve control as reported by the device. */\n>   \tstd::vector<uint32_t> ids;\n> @@ -140,13 +142,14 @@ void DelayedControls::reset()\n>   /**\n>    * \\brief Push a set of controls on the queue\n>    * \\param[in] controls List of controls to add to the device queue\n> + * \\param[in] cookie User supplied cookie value for \\a controls\n>    *\n>    * Push a set of controls to the control queue. This increases the control queue\n>    * depth by one.\n>    *\n\nMaybe its worth to clarify here that the cookie is returned back as part \nof ::get() mechanism, to know the controls have been applied.\n>    * \\returns true if \\a controls are accepted, or false otherwise\n>    */\n> -bool DelayedControls::push(const ControlList &controls)\n> +bool DelayedControls::push(const ControlList &controls, const unsigned int cookie)\n>   {\n>   \t/* Copy state from previous frame. */\n>   \tfor (auto &ctrl : values_) {\n> @@ -180,6 +183,7 @@ bool DelayedControls::push(const ControlList &controls)\n>   \t\t\t<< \" at index \" << queueCount_;\n>   \t}\n>   \n> +\tcookies_[queueCount_] = cookie;\n>   \tqueueCount_++;\n>   \n>   \treturn true;\n> @@ -198,9 +202,10 @@ bool DelayedControls::push(const ControlList &controls)\n>    * push(). The max history from the current sequence number that yields valid\n>    * values are thus 16 minus number of controls pushed.\n>    *\n> - * \\return The controls at \\a sequence number\n> + * \\return The controls at \\a sequence number and associated user supplied\n> + * cookie value.\n\nIs the sequence number of cookie returned, 'associated' ? I have asked a \nsimilar question above so apologies for repeating.\n\nMy understanding is that the ControlList returned here corresponds to \nsequence parameter and cookie corresponds to  a frame whose's controls \nhave been applied on the sensor. The sequence's and cookie's frame \nnumber differ, no ? In that case, I would repharse it to:\n\n+ * \\return The controls at \\a sequence number and user supplied cookie\n+ * value representing the latest controls applied for it's associated\n+ * sequence.\n\n>    */\n> -ControlList DelayedControls::get(uint32_t sequence)\n> +std::pair<ControlList, unsigned int> DelayedControls::get(uint32_t sequence)\n>   {\n>   \tunsigned int index = std::max<int>(0, sequence - maxDelay_);\n>   \n> @@ -217,7 +222,7 @@ ControlList DelayedControls::get(uint32_t sequence)\n>   \t\t\t<< \" at index \" << index;\n>   \t}\n>   \n> -\treturn out;\n> +\treturn { out, cookies_[index] };\n>   }\n>   \n>   /**\n> @@ -276,7 +281,7 @@ void DelayedControls::applyControls(uint32_t sequence)\n>   \twhile (writeCount_ > queueCount_) {\n>   \t\tLOG(DelayedControls, Debug)\n>   \t\t\t<< \"Queue is empty, auto queue no-op.\";\n> -\t\tpush({});\n> +\t\tpush({}, cookies_[queueCount_ - 1]);\n>   \t}\n>   \n>   \tdevice_->setControls(&out);\n> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> index 93219a6c1134..b0f0b22c5298 100644\n> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> @@ -1385,7 +1385,8 @@ void IPU3CameraData::cio2BufferReady(FrameBuffer *buffer)\n>   \trequest->metadata().set(controls::SensorTimestamp,\n>   \t\t\t\tbuffer->metadata().timestamp);\n>   \n> -\tinfo->effectiveSensorControls = delayedCtrls_->get(buffer->metadata().sequence);\n> +\tauto [controls, cookie] = delayedCtrls_->get(buffer->metadata().sequence);\n> +\tinfo->effectiveSensorControls = std::move(controls);\n>   \n>   \tif (request->findBuffer(&rawStream_))\n>   \t\tpipe()->completeBuffer(request, buffer);\n> diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> index b4094898ca6c..d34a906c3cea 100644\n> --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> @@ -1848,7 +1848,7 @@ void RPiCameraData::unicamBufferDequeue(FrameBuffer *buffer)\n>   \t\t * Lookup the sensor controls used for this frame sequence from\n>   \t\t * DelayedControl and queue them along with the frame buffer.\n>   \t\t */\n> -\t\tControlList ctrl = delayedCtrls_->get(buffer->metadata().sequence);\n> +\t\tauto [ctrl, cookie] = delayedCtrls_->get(buffer->metadata().sequence);\n\nI would grab this opportunity to rename s/ctrl/ctrls/\n>   \t\t/*\n>   \t\t * Add the frame timestamp to the ControlList for the IPA to use\n>   \t\t * as it does not receive the FrameBuffer object.\n> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> index 03bbe6b467ae..cec90810ff95 100644\n> --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> @@ -1159,8 +1159,9 @@ void PipelineHandlerRkISP1::statReady(FrameBuffer *buffer)\n>   \tif (data->frame_ <= buffer->metadata().sequence)\n>   \t\tdata->frame_ = buffer->metadata().sequence + 1;\n>   \n> +\tauto [controls, cooke] = data->delayedCtrls_->get(buffer->metadata().sequence);\n\ns/cooke/cookie/\n>   \tdata->ipa_->processStatsBuffer(info->frame, info->statBuffer->cookie(),\n> -\t\t\t\t       data->delayedCtrls_->get(buffer->metadata().sequence));\n> +\t\t\t\t       controls);\n>   }\n>   \n>   REGISTER_PIPELINE_HANDLER(PipelineHandlerRkISP1)\n> diff --git a/test/delayed_controls.cpp b/test/delayed_controls.cpp\n> index a8ce9828d73d..322c545998b2 100644\n> --- a/test/delayed_controls.cpp\n> +++ b/test/delayed_controls.cpp\n> @@ -96,7 +96,7 @@ protected:\n>   \n>   \t\t\tdelayed->applyControls(i);\n>   \n> -\t\t\tControlList result = delayed->get(i);\n> +\t\t\tauto [result, cookie] = delayed->get(i);\n>   \t\t\tint32_t brightness = result.get(V4L2_CID_BRIGHTNESS).get<int32_t>();\n>   \t\t\tif (brightness != value) {\n>   \t\t\t\tcerr << \"Failed single control without delay\"\n> @@ -138,7 +138,7 @@ protected:\n>   \n>   \t\t\tdelayed->applyControls(i);\n>   \n> -\t\t\tControlList result = delayed->get(i);\n> +\t\t\tauto [result, cookie] = delayed->get(i);\n>   \t\t\tint32_t brightness = result.get(V4L2_CID_BRIGHTNESS).get<int32_t>();\n>   \t\t\tif (brightness != expected) {\n>   \t\t\t\tcerr << \"Failed single control with delay\"\n> @@ -187,7 +187,7 @@ protected:\n>   \n>   \t\t\tdelayed->applyControls(i);\n>   \n> -\t\t\tControlList result = delayed->get(i);\n> +\t\t\tauto [result, cookie] = delayed->get(i);\n>   \t\t\tint32_t brightness = result.get(V4L2_CID_BRIGHTNESS).get<int32_t>();\n>   \t\t\tint32_t contrast = result.get(V4L2_CID_CONTRAST).get<int32_t>();\n>   \t\t\tif (brightness != expected || contrast != expected + 1) {\n> @@ -247,7 +247,7 @@ protected:\n>   \n>   \t\t\tdelayed->applyControls(i);\n>   \n> -\t\t\tControlList result = delayed->get(i);\n> +\t\t\tauto [result, cookie] = delayed->get(i);\n>   \n>   \t\t\tint32_t brightness = result.get(V4L2_CID_BRIGHTNESS).get<int32_t>();\n>   \t\t\tint32_t contrast = result.get(V4L2_CID_CONTRAST).get<int32_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 AD623C0DA4\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  5 Sep 2022 09:09:22 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E370662059;\n\tMon,  5 Sep 2022 11:09:21 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id F0DED62054\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  5 Sep 2022 11:09:19 +0200 (CEST)","from [IPV6:2401:4900:1f3f:3b55:213a:3c32:c7d0:be1e] (unknown\n\t[IPv6:2401:4900:1f3f:3b55:213a:3c32:c7d0:be1e])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id DF2AF4A8;\n\tMon,  5 Sep 2022 11:09:18 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1662368961;\n\tbh=pOybQ18l7slj3UjXbb7nFa5t/4skhki/JZ0HiGpAI5E=;\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=PkB21eMVVNcEOnXKzzoBpK09DMsWAvlPdmObmR1ynCXdsVBZGuPm9TtGRmys89RHJ\n\tqAp/2GKalte3H93IyZb/O9rJUdXg2+70FGe+/jIACyeMwLUvQ0e7fBk5MA4LukPFpk\n\tudoxgiuAaTGxbyCv0uHt7P09bLZlmG7ZldcvQnOrchcyAjaFhShh95HRV2aRnY7zKG\n\tyOcwAxy4XqWyw7XexrwlWHqKiCNzEvQ/d2DdDCyswZmChmEDkQRjBRtMHc9rS4BbZ4\n\t4E5sJuxnVK4bif8/+AAnu1pNFmRrA2zhdjWXMLpESDpaVFoyNvHs5b5xocsTZmmmq+\n\td5dXwYY7xCRDA==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1662368959;\n\tbh=pOybQ18l7slj3UjXbb7nFa5t/4skhki/JZ0HiGpAI5E=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=p2zVvp+m8K4RgJ27VCP2PyPNGn+FELXqNn4UOjY8z4GHvFRmiM72rQZm7euh0ijZk\n\tR1GFmMFlIsaK7CAlFwspUHZdcCwaY9gWcm+HD3CLTIDrJm9MAXMsdB4nIutGEG5jjP\n\tCX1qswQ2wbyKUP4IVs38SPkfn9FaM5PXs8rqfhkA="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"p2zVvp+m\"; dkim-atps=neutral","Message-ID":"<4e9da811-ea4a-f9f5-7b23-ae39bccfb58d@ideasonboard.com>","Date":"Mon, 5 Sep 2022 14:39:13 +0530","MIME-Version":"1.0","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101\n\tThunderbird/91.12.0","Content-Language":"en-US","To":"Naushir Patuck <naush@raspberrypi.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20220905073956.7342-1-naush@raspberrypi.com>\n\t<20220905073956.7342-3-naush@raspberrypi.com>","In-Reply-To":"<20220905073956.7342-3-naush@raspberrypi.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"8bit","Subject":"Re: [libcamera-devel] [PATCH v2 2/7] delayed_controls: Add user\n\tcookie to DelayedControls","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":24934,"web_url":"https://patchwork.libcamera.org/comment/24934/","msgid":"<CAEmqJPqUnZ6MDKsgqfURpLDgF7frx5vn50fptYS599T9eXwFhg@mail.gmail.com>","date":"2022-09-05T09:32:27","subject":"Re: [libcamera-devel] [PATCH v2 2/7] delayed_controls: Add user\n\tcookie to DelayedControls","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"content":"Hi Umang,\n\nOn Mon, 5 Sept 2022 at 10:09, Umang Jain <umang.jain@ideasonboard.com>\nwrote:\n\n> Hi Naushir,\n>\n> Thank you for the patch. Few clarifications questions below...\n>\n> On 9/5/22 1:09 PM, Naushir Patuck via libcamera-devel wrote:\n> > Allow the caller to provide a cookie value to DelayedControls::reset and\n> > DelayedControls::push. This cookie value is returned from\n> DelayedControls::get\n> > for the frame that has the control values applied to it.\n> >\n> > The cookie value is useful in tracking when a set of controls has been\n> applied\n> > to a frame. In a subsequent commit, it will be used by the Raspberry Pi\n> IPA to\n> > track the IPA context used when setting the control values.\n>\n>\n> Do you mean that the latest controls applied on the sensor are\n> represented by the cookie? Meaning the sequence parameter in\n> DelayedControls::get(sequence)  has no co-relation with cookie being\n> returned?\n>\n\nDelayedControls staggers sensor writes so that all controls in the\nControlList\npassed into push() are applied on the same frame, and the cookie is returned\nout on that particular frame. In that sense, the cookie does have a relation\nto the (future) frame sequence number.\n\n\n>\n> This brings me to a follow up question that, if\n> DelayedControls::get(sequence) being called multiple times on same\n> sequence number - does it mean the cookie returned, will get changed\n> everytime? Will that be expected behavior?\n>\n\nIf you call get(sequence) multiple times with the same sequence number,\nyou will get back the same cookie value as the latter corresponds with\nthe frame controls, not the internal state of the DelayedControls. This of\ncourse\nassumes that we don't overrun the DelayedControls queue of 16 values,\nbut that is not likely to happen...\n\nHope that makes sense, if not I'm happy to provide more details.\n\nRegards,\nNaush\n\n\n\n>\n> > Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> > ---\n> >   include/libcamera/internal/delayed_controls.h   |  8 +++++---\n> >   src/libcamera/delayed_controls.cpp              | 17 +++++++++++------\n> >   src/libcamera/pipeline/ipu3/ipu3.cpp            |  3 ++-\n> >   .../pipeline/raspberrypi/raspberrypi.cpp        |  2 +-\n> >   src/libcamera/pipeline/rkisp1/rkisp1.cpp        |  3 ++-\n> >   test/delayed_controls.cpp                       |  8 ++++----\n> >   6 files changed, 25 insertions(+), 16 deletions(-)\n> >\n> > diff --git a/include/libcamera/internal/delayed_controls.h\n> b/include/libcamera/internal/delayed_controls.h\n> > index f6e622f1dfba..fa222bb17d23 100644\n> > --- a/include/libcamera/internal/delayed_controls.h\n> > +++ b/include/libcamera/internal/delayed_controls.h\n> > @@ -9,6 +9,7 @@\n> >\n> >   #include <stdint.h>\n> >   #include <unordered_map>\n> > +#include <utility>\n> >\n> >   #include <libcamera/controls.h>\n> >\n> > @@ -27,10 +28,10 @@ public:\n> >       DelayedControls(V4L2Device *device,\n> >                       const std::unordered_map<uint32_t, ControlParams>\n> &controlParams);\n> >\n> > -     void reset();\n> > +     void reset(unsigned int cookie = 0);\n> >\n> > -     bool push(const ControlList &controls);\n> > -     ControlList get(uint32_t sequence);\n> > +     bool push(const ControlList &controls, unsigned int cookie = 0);\n> > +     std::pair<ControlList, unsigned int> get(uint32_t sequence);\n> >\n> >       void applyControls(uint32_t sequence);\n> >\n> > @@ -77,6 +78,7 @@ private:\n> >       uint32_t writeCount_;\n> >       /* \\todo Evaluate if we should index on ControlId * or unsigned\n> int */\n> >       std::unordered_map<const ControlId *, ControlRingBuffer<Info>>\n> values_;\n> > +     ControlRingBuffer<unsigned int> cookies_;\n>\n> Maybe some level of naming bikeshedding is required on\n> \"ControlRingBuffer\", since now it's templated (1/7) But that can be\n> later...\n> >   };\n> >\n> >   } /* namespace libcamera */\n> > diff --git a/src/libcamera/delayed_controls.cpp\n> b/src/libcamera/delayed_controls.cpp\n> > index 777441e8222a..c2198d0e8d77 100644\n> > --- a/src/libcamera/delayed_controls.cpp\n> > +++ b/src/libcamera/delayed_controls.cpp\n> > @@ -109,14 +109,16 @@ DelayedControls::DelayedControls(V4L2Device\n> *device,\n> >\n> >   /**\n> >    * \\brief Reset state machine\n> > + * \\param[in] cookie User supplied reset cookie value\n> >    *\n> >    * Resets the state machine to a starting position based on control\n> values\n> >    * retrieved from the device.\n> >    */\n> > -void DelayedControls::reset()\n> > +void DelayedControls::reset(unsigned int cookie)\n> >   {\n> >       queueCount_ = 1;\n> >       writeCount_ = 0;\n> > +     cookies_[0] = cookie;\n> >\n> >       /* Retrieve control as reported by the device. */\n> >       std::vector<uint32_t> ids;\n> > @@ -140,13 +142,14 @@ void DelayedControls::reset()\n> >   /**\n> >    * \\brief Push a set of controls on the queue\n> >    * \\param[in] controls List of controls to add to the device queue\n> > + * \\param[in] cookie User supplied cookie value for \\a controls\n> >    *\n> >    * Push a set of controls to the control queue. This increases the\n> control queue\n> >    * depth by one.\n> >    *\n>\n> Maybe its worth to clarify here that the cookie is returned back as part\n> of ::get() mechanism, to know the controls have been applied.\n> >    * \\returns true if \\a controls are accepted, or false otherwise\n> >    */\n> > -bool DelayedControls::push(const ControlList &controls)\n> > +bool DelayedControls::push(const ControlList &controls, const unsigned\n> int cookie)\n> >   {\n> >       /* Copy state from previous frame. */\n> >       for (auto &ctrl : values_) {\n> > @@ -180,6 +183,7 @@ bool DelayedControls::push(const ControlList\n> &controls)\n> >                       << \" at index \" << queueCount_;\n> >       }\n> >\n> > +     cookies_[queueCount_] = cookie;\n> >       queueCount_++;\n> >\n> >       return true;\n> > @@ -198,9 +202,10 @@ bool DelayedControls::push(const ControlList\n> &controls)\n> >    * push(). The max history from the current sequence number that\n> yields valid\n> >    * values are thus 16 minus number of controls pushed.\n> >    *\n> > - * \\return The controls at \\a sequence number\n> > + * \\return The controls at \\a sequence number and associated user\n> supplied\n> > + * cookie value.\n>\n> Is the sequence number of cookie returned, 'associated' ? I have asked a\n> similar question above so apologies for repeating.\n>\n> My understanding is that the ControlList returned here corresponds to\n> sequence parameter and cookie corresponds to  a frame whose's controls\n> have been applied on the sensor. The sequence's and cookie's frame\n> number differ, no ? In that case, I would repharse it to:\n>\n> + * \\return The controls at \\a sequence number and user supplied cookie\n> + * value representing the latest controls applied for it's associated\n> + * sequence.\n>\n> >    */\n> > -ControlList DelayedControls::get(uint32_t sequence)\n> > +std::pair<ControlList, unsigned int> DelayedControls::get(uint32_t\n> sequence)\n> >   {\n> >       unsigned int index = std::max<int>(0, sequence - maxDelay_);\n> >\n> > @@ -217,7 +222,7 @@ ControlList DelayedControls::get(uint32_t sequence)\n> >                       << \" at index \" << index;\n> >       }\n> >\n> > -     return out;\n> > +     return { out, cookies_[index] };\n> >   }\n> >\n> >   /**\n> > @@ -276,7 +281,7 @@ void DelayedControls::applyControls(uint32_t\n> sequence)\n> >       while (writeCount_ > queueCount_) {\n> >               LOG(DelayedControls, Debug)\n> >                       << \"Queue is empty, auto queue no-op.\";\n> > -             push({});\n> > +             push({}, cookies_[queueCount_ - 1]);\n> >       }\n> >\n> >       device_->setControls(&out);\n> > diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp\n> b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> > index 93219a6c1134..b0f0b22c5298 100644\n> > --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n> > +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> > @@ -1385,7 +1385,8 @@ void IPU3CameraData::cio2BufferReady(FrameBuffer\n> *buffer)\n> >       request->metadata().set(controls::SensorTimestamp,\n> >                               buffer->metadata().timestamp);\n> >\n> > -     info->effectiveSensorControls =\n> delayedCtrls_->get(buffer->metadata().sequence);\n> > +     auto [controls, cookie] =\n> delayedCtrls_->get(buffer->metadata().sequence);\n> > +     info->effectiveSensorControls = std::move(controls);\n> >\n> >       if (request->findBuffer(&rawStream_))\n> >               pipe()->completeBuffer(request, buffer);\n> > diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> > index b4094898ca6c..d34a906c3cea 100644\n> > --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> > +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> > @@ -1848,7 +1848,7 @@ void\n> RPiCameraData::unicamBufferDequeue(FrameBuffer *buffer)\n> >                * Lookup the sensor controls used for this frame sequence\n> from\n> >                * DelayedControl and queue them along with the frame\n> buffer.\n> >                */\n> > -             ControlList ctrl =\n> delayedCtrls_->get(buffer->metadata().sequence);\n> > +             auto [ctrl, cookie] =\n> delayedCtrls_->get(buffer->metadata().sequence);\n>\n> I would grab this opportunity to rename s/ctrl/ctrls/\n> >               /*\n> >                * Add the frame timestamp to the ControlList for the IPA\n> to use\n> >                * as it does not receive the FrameBuffer object.\n> > diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> > index 03bbe6b467ae..cec90810ff95 100644\n> > --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> > +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> > @@ -1159,8 +1159,9 @@ void PipelineHandlerRkISP1::statReady(FrameBuffer\n> *buffer)\n> >       if (data->frame_ <= buffer->metadata().sequence)\n> >               data->frame_ = buffer->metadata().sequence + 1;\n> >\n> > +     auto [controls, cooke] =\n> data->delayedCtrls_->get(buffer->metadata().sequence);\n>\n> s/cooke/cookie/\n> >       data->ipa_->processStatsBuffer(info->frame,\n> info->statBuffer->cookie(),\n> > -\n> data->delayedCtrls_->get(buffer->metadata().sequence));\n> > +                                    controls);\n> >   }\n> >\n> >   REGISTER_PIPELINE_HANDLER(PipelineHandlerRkISP1)\n> > diff --git a/test/delayed_controls.cpp b/test/delayed_controls.cpp\n> > index a8ce9828d73d..322c545998b2 100644\n> > --- a/test/delayed_controls.cpp\n> > +++ b/test/delayed_controls.cpp\n> > @@ -96,7 +96,7 @@ protected:\n> >\n> >                       delayed->applyControls(i);\n> >\n> > -                     ControlList result = delayed->get(i);\n> > +                     auto [result, cookie] = delayed->get(i);\n> >                       int32_t brightness =\n> result.get(V4L2_CID_BRIGHTNESS).get<int32_t>();\n> >                       if (brightness != value) {\n> >                               cerr << \"Failed single control without\n> delay\"\n> > @@ -138,7 +138,7 @@ protected:\n> >\n> >                       delayed->applyControls(i);\n> >\n> > -                     ControlList result = delayed->get(i);\n> > +                     auto [result, cookie] = delayed->get(i);\n> >                       int32_t brightness =\n> result.get(V4L2_CID_BRIGHTNESS).get<int32_t>();\n> >                       if (brightness != expected) {\n> >                               cerr << \"Failed single control with delay\"\n> > @@ -187,7 +187,7 @@ protected:\n> >\n> >                       delayed->applyControls(i);\n> >\n> > -                     ControlList result = delayed->get(i);\n> > +                     auto [result, cookie] = delayed->get(i);\n> >                       int32_t brightness =\n> result.get(V4L2_CID_BRIGHTNESS).get<int32_t>();\n> >                       int32_t contrast =\n> result.get(V4L2_CID_CONTRAST).get<int32_t>();\n> >                       if (brightness != expected || contrast != expected\n> + 1) {\n> > @@ -247,7 +247,7 @@ protected:\n> >\n> >                       delayed->applyControls(i);\n> >\n> > -                     ControlList result = delayed->get(i);\n> > +                     auto [result, cookie] = delayed->get(i);\n> >\n> >                       int32_t brightness =\n> result.get(V4L2_CID_BRIGHTNESS).get<int32_t>();\n> >                       int32_t contrast =\n> result.get(V4L2_CID_CONTRAST).get<int32_t>();\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 649BEC0DA4\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  5 Sep 2022 09:32:46 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C58466205A;\n\tMon,  5 Sep 2022 11:32:45 +0200 (CEST)","from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com\n\t[IPv6:2a00:1450:4864:20::12e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0CA9A62054\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  5 Sep 2022 11:32:44 +0200 (CEST)","by mail-lf1-x12e.google.com with SMTP id m7so12279121lfq.8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 05 Sep 2022 02:32:43 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1662370365;\n\tbh=VyXqa4O+hJm34QUBThlMkjpi/JHzv/5z5T6a0tPulhk=;\n\th=References:In-Reply-To:Date:To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=paUgcs/liZEiETECxDgMHtcSgF8z6QPTd+/UxUV+rDe0m/3wRb//8ioTINVmu6o6g\n\t1R33j8UNvWeO84Y9dXgVN+mqn8IB/FDvTqScMoePl6HdaMg45cuopc6yyW4Y8Mu8qe\n\tggJDgl/oidkr0kQk1J5Qa3L2m2/elMktnKW3Ih3p4H1cB6iyVWODZHJx9bBoBW69Z/\n\tZwvFGbMv7yO5HVGZyhKZOXHPEZd5oyFDh4hbr5WhAzUWzAPd2pJrNaZF+MrC5Jtu/Q\n\tkLnahtp7sC/Nh2uTFw6zDSAHFDEO3MfLI/Ut4eIF4OqzdW6frMPQJblflN1S/2BOvj\n\tqIUteWNtvevig==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:from:to:cc:subject:date;\n\tbh=HsiGsKDe4m/JKhGUtnhxNce8tv42EBPpIrd0nu8wCQQ=;\n\tb=mn8femcRizn19xgT0cJZ8LJolNLZSyGjQLdDPcbJdBiY7Phnf8NO5ATXqoDtAXRvlE\n\tkhR0BkzgR5t4wuF0hr1XHAHxa9eiKwGQEEtqyyDT49qao60d+iiGz/rsn/Zeget0rjIP\n\te2+XI6jRahBsGa8tBVlcRPIq+r4gRTWmUixEsWMOPVQ9LgQvbtM/wVl6tVJwOWD1mNZl\n\tshiJ9pRSp2C3g3o0QRbntMeBkuseIqZY+ZTM4OJ7GwAWVjGHc6iwEaNDFTdtWeF36EJp\n\tegj4MA9nR022pKDOb0MLA8NzkMBXc2ZSvRRcLMLCr/2BVI/OqLIoJ2HPLIpe1o1RM2Td\n\tyw8Q=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"mn8femcR\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:x-gm-message-state:from:to:cc:subject:date;\n\tbh=HsiGsKDe4m/JKhGUtnhxNce8tv42EBPpIrd0nu8wCQQ=;\n\tb=eOKrfPIQc5qccBOvmQkKE5Vuug7sjColhEy+g/u/Aes6NycfEEksu8C7Mqy5gj18TN\n\tmWnyRImxrPB4LUu/qgeqDinLE1Ia7hwDlvGg7m9d1bGRKZ+NW9FNhmmVANohegLOJ8A1\n\t+oOFMi6qrG2PHb4DIdCo7DkvFfcexuVPUbExmCcB7uqMHoWtMJoUizoNW0/HVJEH2+dt\n\tZuOQ3979fsv3yU6Qmw0RrdubuM6s/0T5zRmC41YH0u8Tr+bhUe7zLBfiFnRfVdILaAJ2\n\tMp+2iaI6aLAgGYzfqNatbMm6amspjDiLD8odzVxwNzzMb+CI8M5cFRugLhG/XYgz0lqR\n\tLu0w==","X-Gm-Message-State":"ACgBeo2nTPysBbLRzEKRpY4Gqqya1b9jwrxjo8htBm2r8COLovF5j4Gl\n\tLLzJWOM7EMA9bX4sZi1duDnNSOVGvNfC1zUciySvNhBtSMEY7LXv","X-Google-Smtp-Source":"AA6agR78m0rcuYTw3n+J8pJPWZ465VgSQHzvXVpT3NBeilFh2FQY2y1Qj5hmZSuW6X5cD4NWPuI1X3POIaZ6aU92S9Q=","X-Received":"by 2002:a05:6512:159a:b0:492:8c61:1991 with SMTP id\n\tbp26-20020a056512159a00b004928c611991mr14716604lfb.245.1662370363153;\n\tMon, 05 Sep 2022 02:32:43 -0700 (PDT)","MIME-Version":"1.0","References":"<20220905073956.7342-1-naush@raspberrypi.com>\n\t<20220905073956.7342-3-naush@raspberrypi.com>\n\t<4e9da811-ea4a-f9f5-7b23-ae39bccfb58d@ideasonboard.com>","In-Reply-To":"<4e9da811-ea4a-f9f5-7b23-ae39bccfb58d@ideasonboard.com>","Date":"Mon, 5 Sep 2022 10:32:27 +0100","Message-ID":"<CAEmqJPqUnZ6MDKsgqfURpLDgF7frx5vn50fptYS599T9eXwFhg@mail.gmail.com>","To":"Umang Jain <umang.jain@ideasonboard.com>","Content-Type":"multipart/alternative; boundary=\"000000000000fb3c5f05e7eac288\"","Subject":"Re: [libcamera-devel] [PATCH v2 2/7] delayed_controls: Add user\n\tcookie to DelayedControls","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":"Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Naushir Patuck <naush@raspberrypi.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":24958,"web_url":"https://patchwork.libcamera.org/comment/24958/","msgid":"<1bb0315c-e759-42a0-6a8e-6061f34ce439@ideasonboard.com>","date":"2022-09-08T06:42:01","subject":"Re: [libcamera-devel] [PATCH v2 2/7] delayed_controls: Add user\n\tcookie to DelayedControls","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/people/86/","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"content":"HI Naushir,\n\nOn 9/5/22 3:02 PM, Naushir Patuck wrote:\n> Hi Umang,\n>\n> On Mon, 5 Sept 2022 at 10:09, Umang Jain <umang.jain@ideasonboard.com> \n> wrote:\n>\n>     Hi Naushir,\n>\n>     Thank you for the patch. Few clarifications questions below...\n>\n>     On 9/5/22 1:09 PM, Naushir Patuck via libcamera-devel wrote:\n>     > Allow the caller to provide a cookie value to\n>     DelayedControls::reset and\n>     > DelayedControls::push. This cookie value is returned from\n>     DelayedControls::get\n>     > for the frame that has the control values applied to it.\n>     >\n>     > The cookie value is useful in tracking when a set of controls\n>     has been applied\n>     > to a frame. In a subsequent commit, it will be used by the\n>     Raspberry Pi IPA to\n>     > track the IPA context used when setting the control values.\n>\n>\n>     Do you mean that the latest controls applied on the sensor are\n>     represented by the cookie? Meaning the sequence parameter in\n>     DelayedControls::get(sequence)  has no co-relation with cookie being\n>     returned?\n>\n>\n> DelayedControls staggers sensor writes so that all controls in the \n> ControlList\n> passed into push() are applied on the same frame, and the cookie is \n> returned\n> out on that particular frame. In that sense, the cookie does have a \n> relation\n> to the (future) frame sequence number.\n\nAh yes, I see that now\n>\n>\n>     This brings me to a follow up question that, if\n>     DelayedControls::get(sequence) being called multiple times on same\n>     sequence number - does it mean the cookie returned, will get changed\n>     everytime? Will that be expected behavior?\n>\n>\n> If you call get(sequence) multiple times with the same sequence number,\n> you will get back the same cookie value as the latter corresponds with\n> the frame controls, not the internal state of the DelayedControls. \n> This of course\n\nThis makes sense now. Thanks for the explanation.\n\n> assumes that we don't overrun the DelayedControls queue of 16 values,\n> but that is not likely to happen...\n>\n> Hope that makes sense, if not I'm happy to provide more details.\n>\n> Regards,\n> Naush\n>\n>\n>     > Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n>     > ---\n>     >   include/libcamera/internal/delayed_controls.h   |  8 +++++---\n>     >   src/libcamera/delayed_controls.cpp              | 17\n>     +++++++++++------\n>     >   src/libcamera/pipeline/ipu3/ipu3.cpp            |  3 ++-\n>     >   .../pipeline/raspberrypi/raspberrypi.cpp        |  2 +-\n>     >   src/libcamera/pipeline/rkisp1/rkisp1.cpp        |  3 ++-\n>     >   test/delayed_controls.cpp                       |  8 ++++----\n>     >   6 files changed, 25 insertions(+), 16 deletions(-)\n>     >\n>     > diff --git a/include/libcamera/internal/delayed_controls.h\n>     b/include/libcamera/internal/delayed_controls.h\n>     > index f6e622f1dfba..fa222bb17d23 100644\n>     > --- a/include/libcamera/internal/delayed_controls.h\n>     > +++ b/include/libcamera/internal/delayed_controls.h\n>     > @@ -9,6 +9,7 @@\n>     >\n>     >   #include <stdint.h>\n>     >   #include <unordered_map>\n>     > +#include <utility>\n>     >\n>     >   #include <libcamera/controls.h>\n>     >\n>     > @@ -27,10 +28,10 @@ public:\n>     >       DelayedControls(V4L2Device *device,\n>     >                       const std::unordered_map<uint32_t,\n>     ControlParams> &controlParams);\n>     >\n>     > -     void reset();\n>     > +     void reset(unsigned int cookie = 0);\n>     >\n>     > -     bool push(const ControlList &controls);\n>     > -     ControlList get(uint32_t sequence);\n>     > +     bool push(const ControlList &controls, unsigned int cookie\n>     = 0);\n>     > +     std::pair<ControlList, unsigned int> get(uint32_t sequence);\n>     >\n>     >       void applyControls(uint32_t sequence);\n>     >\n>     > @@ -77,6 +78,7 @@ private:\n>     >       uint32_t writeCount_;\n>     >       /* \\todo Evaluate if we should index on ControlId * or\n>     unsigned int */\n>     >       std::unordered_map<const ControlId *,\n>     ControlRingBuffer<Info>> values_;\n>     > +     ControlRingBuffer<unsigned int> cookies_;\n>\n>     Maybe some level of naming bikeshedding is required on\n>     \"ControlRingBuffer\", since now it's templated (1/7) But that can\n>     be later...\n>     >   };\n>     >\n>     >   } /* namespace libcamera */\n>     > diff --git a/src/libcamera/delayed_controls.cpp\n>     b/src/libcamera/delayed_controls.cpp\n>     > index 777441e8222a..c2198d0e8d77 100644\n>     > --- a/src/libcamera/delayed_controls.cpp\n>     > +++ b/src/libcamera/delayed_controls.cpp\n>     > @@ -109,14 +109,16 @@\n>     DelayedControls::DelayedControls(V4L2Device *device,\n>     >\n>     >   /**\n>     >    * \\brief Reset state machine\n>     > + * \\param[in] cookie User supplied reset cookie value\n>     >    *\n>     >    * Resets the state machine to a starting position based on\n>     control values\n>     >    * retrieved from the device.\n>     >    */\n>     > -void DelayedControls::reset()\n>     > +void DelayedControls::reset(unsigned int cookie)\n>     >   {\n>     >       queueCount_ = 1;\n>     >       writeCount_ = 0;\n>     > +     cookies_[0] = cookie;\n>     >\n>     >       /* Retrieve control as reported by the device. */\n>     >       std::vector<uint32_t> ids;\n>     > @@ -140,13 +142,14 @@ void DelayedControls::reset()\n>     >   /**\n>     >    * \\brief Push a set of controls on the queue\n>     >    * \\param[in] controls List of controls to add to the device queue\n>     > + * \\param[in] cookie User supplied cookie value for \\a controls\n>     >    *\n>     >    * Push a set of controls to the control queue. This increases\n>     the control queue\n>     >    * depth by one.\n>     >    *\n>\n>     Maybe its worth to clarify here that the cookie is returned back\n>     as part\n>     of ::get() mechanism, to know the controls have been applied.\n>     >    * \\returns true if \\a controls are accepted, or false otherwise\n>     >    */\n>     > -bool DelayedControls::push(const ControlList &controls)\n>     > +bool DelayedControls::push(const ControlList &controls, const\n>     unsigned int cookie)\n>     >   {\n>     >       /* Copy state from previous frame. */\n>     >       for (auto &ctrl : values_) {\n>     > @@ -180,6 +183,7 @@ bool DelayedControls::push(const ControlList\n>     &controls)\n>     >                       << \" at index \" << queueCount_;\n>     >       }\n>     >\n>     > +     cookies_[queueCount_] = cookie;\n>     >       queueCount_++;\n>     >\n>     >       return true;\n>     > @@ -198,9 +202,10 @@ bool DelayedControls::push(const\n>     ControlList &controls)\n>     >    * push(). The max history from the current sequence number\n>     that yields valid\n>     >    * values are thus 16 minus number of controls pushed.\n>     >    *\n>     > - * \\return The controls at \\a sequence number\n>     > + * \\return The controls at \\a sequence number and associated\n>     user supplied\n>     > + * cookie value.\n>\n>     Is the sequence number of cookie returned, 'associated' ? I have\n>     asked a\n>     similar question above so apologies for repeating.\n>\n>     My understanding is that the ControlList returned here corresponds to\n>     sequence parameter and cookie corresponds to  a frame whose's\n>     controls\n>     have been applied on the sensor. The sequence's and cookie's frame\n>     number differ, no ? In that case, I would repharse it to:\n>\n>     + * \\return The controls at \\a sequence number and user supplied\n>     cookie\n>     + * value representing the latest controls applied for it's associated\n>     + * sequence.\n>\n>     >    */\n>     > -ControlList DelayedControls::get(uint32_t sequence)\n>     > +std::pair<ControlList, unsigned int>\n>     DelayedControls::get(uint32_t sequence)\n>     >   {\n>     >       unsigned int index = std::max<int>(0, sequence - maxDelay_);\n>     >\n>     > @@ -217,7 +222,7 @@ ControlList DelayedControls::get(uint32_t\n>     sequence)\n>     >                       << \" at index \" << index;\n>     >       }\n>     >\n>     > -     return out;\n>     > +     return { out, cookies_[index] };\n>     >   }\n>     >\n>     >   /**\n>     > @@ -276,7 +281,7 @@ void DelayedControls::applyControls(uint32_t\n>     sequence)\n>     >       while (writeCount_ > queueCount_) {\n>     >               LOG(DelayedControls, Debug)\n>     >                       << \"Queue is empty, auto queue no-op.\";\n>     > -             push({});\n>     > +             push({}, cookies_[queueCount_ - 1]);\n>     >       }\n>     >\n>     >       device_->setControls(&out);\n>     > diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp\n>     b/src/libcamera/pipeline/ipu3/ipu3.cpp\n>     > index 93219a6c1134..b0f0b22c5298 100644\n>     > --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n>     > +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n>     > @@ -1385,7 +1385,8 @@ void\n>     IPU3CameraData::cio2BufferReady(FrameBuffer *buffer)\n>     >  request->metadata().set(controls::SensorTimestamp,\n>     >  buffer->metadata().timestamp);\n>     >\n>     > -     info->effectiveSensorControls =\n>     delayedCtrls_->get(buffer->metadata().sequence);\n>     > +     auto [controls, cookie] =\n>     delayedCtrls_->get(buffer->metadata().sequence);\n>     > +     info->effectiveSensorControls = std::move(controls);\n>     >\n>     >       if (request->findBuffer(&rawStream_))\n>     >               pipe()->completeBuffer(request, buffer);\n>     > diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n>     b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n>     > index b4094898ca6c..d34a906c3cea 100644\n>     > --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n>     > +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n>     > @@ -1848,7 +1848,7 @@ void\n>     RPiCameraData::unicamBufferDequeue(FrameBuffer *buffer)\n>     >                * Lookup the sensor controls used for this frame\n>     sequence from\n>     >                * DelayedControl and queue them along with the\n>     frame buffer.\n>     >                */\n>     > -             ControlList ctrl =\n>     delayedCtrls_->get(buffer->metadata().sequence);\n>     > +             auto [ctrl, cookie] =\n>     delayedCtrls_->get(buffer->metadata().sequence);\n>\n>     I would grab this opportunity to rename s/ctrl/ctrls/\n>     >               /*\n>     >                * Add the frame timestamp to the ControlList for\n>     the IPA to use\n>     >                * as it does not receive the FrameBuffer object.\n>     > diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n>     b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n>     > index 03bbe6b467ae..cec90810ff95 100644\n>     > --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n>     > +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n>     > @@ -1159,8 +1159,9 @@ void\n>     PipelineHandlerRkISP1::statReady(FrameBuffer *buffer)\n>     >       if (data->frame_ <= buffer->metadata().sequence)\n>     >               data->frame_ = buffer->metadata().sequence + 1;\n>     >\n>     > +     auto [controls, cooke] =\n>     data->delayedCtrls_->get(buffer->metadata().sequence);\n>\n>     s/cooke/cookie/\n>     >  data->ipa_->processStatsBuffer(info->frame,\n>     info->statBuffer->cookie(),\n>     > - data->delayedCtrls_->get(buffer->metadata().sequence));\n>     > +                                    controls);\n>     >   }\n>     >\n>     >   REGISTER_PIPELINE_HANDLER(PipelineHandlerRkISP1)\n>     > diff --git a/test/delayed_controls.cpp b/test/delayed_controls.cpp\n>     > index a8ce9828d73d..322c545998b2 100644\n>     > --- a/test/delayed_controls.cpp\n>     > +++ b/test/delayed_controls.cpp\n>     > @@ -96,7 +96,7 @@ protected:\n>     >\n>     >                       delayed->applyControls(i);\n>     >\n>     > -                     ControlList result = delayed->get(i);\n>     > +                     auto [result, cookie] = delayed->get(i);\n>     >                       int32_t brightness =\n>     result.get(V4L2_CID_BRIGHTNESS).get<int32_t>();\n>     >                       if (brightness != value) {\n>     >                               cerr << \"Failed single control\n>     without delay\"\n>     > @@ -138,7 +138,7 @@ protected:\n>     >\n>     >                       delayed->applyControls(i);\n>     >\n>     > -                     ControlList result = delayed->get(i);\n>     > +                     auto [result, cookie] = delayed->get(i);\n>     >                       int32_t brightness =\n>     result.get(V4L2_CID_BRIGHTNESS).get<int32_t>();\n>     >                       if (brightness != expected) {\n>     >                               cerr << \"Failed single control\n>     with delay\"\n>     > @@ -187,7 +187,7 @@ protected:\n>     >\n>     >                       delayed->applyControls(i);\n>     >\n>     > -                     ControlList result = delayed->get(i);\n>     > +                     auto [result, cookie] = delayed->get(i);\n>     >                       int32_t brightness =\n>     result.get(V4L2_CID_BRIGHTNESS).get<int32_t>();\n>     >                       int32_t contrast =\n>     result.get(V4L2_CID_CONTRAST).get<int32_t>();\n>     >                       if (brightness != expected || contrast !=\n>     expected + 1) {\n>     > @@ -247,7 +247,7 @@ protected:\n>     >\n>     >                       delayed->applyControls(i);\n>     >\n>     > -                     ControlList result = delayed->get(i);\n>     > +                     auto [result, cookie] = delayed->get(i);\n>     >\n>     >                       int32_t brightness =\n>     result.get(V4L2_CID_BRIGHTNESS).get<int32_t>();\n>     >                       int32_t contrast =\n>     result.get(V4L2_CID_CONTRAST).get<int32_t>();\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 D5ED3C3272\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  8 Sep 2022 06:42:10 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2B6316209D;\n\tThu,  8 Sep 2022 08:42:10 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E125C6208F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  8 Sep 2022 08:42:08 +0200 (CEST)","from [IPV6:2401:4900:1f3e:50f3:a89c:93ec:bcd7:8b90] (unknown\n\t[IPv6:2401:4900:1f3e:50f3:a89c:93ec:bcd7:8b90])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 9C5D36CC;\n\tThu,  8 Sep 2022 08:42:07 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1662619330;\n\tbh=HhOUgGTseFII4SEwnxQzoHEP1S5ayvbjL9Q6FbDzGyw=;\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=trg/DyoPtx1NVTY/u/b669UTp3wGcjoXNuWMJ+8pjmpL5YUAep58WrfQG6kpRa2IO\n\tkuWq059gFfFPV5auMuRZLlvX0Isn+pNoJ6Bj32UMqLZYFjntiY/5uNgE/swZcCYlJK\n\tdK00Rd4UF1fwdDHqvnPwiGKNYDAwOQpQ7+kBmWHQyCpB9/8DPiIOluKZCfvhBp+Rcg\n\tK2F6jracTxM9+UqbML0i3hel3Tv5KgVN2sKeNhPuiXotxN/i58mrd5uvpUkTaovxsW\n\tS1N4k0Os2qrJmX38PeQN23yxQjkT2iyZTUGKVSUAfJshSNjExB4bZUFSYeGU6m4/7q\n\tn1jkusQX5n16g==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1662619328;\n\tbh=HhOUgGTseFII4SEwnxQzoHEP1S5ayvbjL9Q6FbDzGyw=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=qvC0hGYDFKLRbX4Iv2ytSoTY9USlTYP3L+x74BYBempEe0K78oiqlKCOmbSIhV1Z0\n\t9NK9F7RxAF6njvBzWjjzqY0gZlgaT19eOASRaVy4tTxPYUnR7TNFw58pxerbIByj8N\n\txKy3smedT0joRlgrT47OpWI/OM2obbrrWpsPh2JA="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"qvC0hGYD\"; dkim-atps=neutral","Content-Type":"multipart/alternative;\n\tboundary=\"------------rmAUeLHw8POdXOPjcBRgTMIi\"","Message-ID":"<1bb0315c-e759-42a0-6a8e-6061f34ce439@ideasonboard.com>","Date":"Thu, 8 Sep 2022 12:12:01 +0530","MIME-Version":"1.0","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101\n\tThunderbird/91.12.0","Content-Language":"en-US","To":"Naushir Patuck <naush@raspberrypi.com>","References":"<20220905073956.7342-1-naush@raspberrypi.com>\n\t<20220905073956.7342-3-naush@raspberrypi.com>\n\t<4e9da811-ea4a-f9f5-7b23-ae39bccfb58d@ideasonboard.com>\n\t<CAEmqJPqUnZ6MDKsgqfURpLDgF7frx5vn50fptYS599T9eXwFhg@mail.gmail.com>","In-Reply-To":"<CAEmqJPqUnZ6MDKsgqfURpLDgF7frx5vn50fptYS599T9eXwFhg@mail.gmail.com>","Subject":"Re: [libcamera-devel] [PATCH v2 2/7] delayed_controls: Add user\n\tcookie to DelayedControls","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>"}},{"id":25113,"web_url":"https://patchwork.libcamera.org/comment/25113/","msgid":"<CAHW6GY+fnYTf98KNoRtQYowT3SK6e-sKSDDyDyLzE4qdG-gC=Q@mail.gmail.com>","date":"2022-09-23T09:47:32","subject":"Re: [libcamera-devel] [PATCH v2 2/7] delayed_controls: Add user\n\tcookie to DelayedControls","submitter":{"id":42,"url":"https://patchwork.libcamera.org/api/people/42/","name":"David Plowman","email":"david.plowman@raspberrypi.com"},"content":"Hi Naush\n\nThanks for the patch.\n\nOn Mon, 5 Sept 2022 at 08:40, Naushir Patuck via libcamera-devel\n<libcamera-devel@lists.libcamera.org> wrote:\n>\n> Allow the caller to provide a cookie value to DelayedControls::reset and\n> DelayedControls::push. This cookie value is returned from DelayedControls::get\n> for the frame that has the control values applied to it.\n>\n> The cookie value is useful in tracking when a set of controls has been applied\n> to a frame. In a subsequent commit, it will be used by the Raspberry Pi IPA to\n> track the IPA context used when setting the control values.\n>\n> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> ---\n>  include/libcamera/internal/delayed_controls.h   |  8 +++++---\n>  src/libcamera/delayed_controls.cpp              | 17 +++++++++++------\n>  src/libcamera/pipeline/ipu3/ipu3.cpp            |  3 ++-\n>  .../pipeline/raspberrypi/raspberrypi.cpp        |  2 +-\n>  src/libcamera/pipeline/rkisp1/rkisp1.cpp        |  3 ++-\n>  test/delayed_controls.cpp                       |  8 ++++----\n>  6 files changed, 25 insertions(+), 16 deletions(-)\n>\n> diff --git a/include/libcamera/internal/delayed_controls.h b/include/libcamera/internal/delayed_controls.h\n> index f6e622f1dfba..fa222bb17d23 100644\n> --- a/include/libcamera/internal/delayed_controls.h\n> +++ b/include/libcamera/internal/delayed_controls.h\n> @@ -9,6 +9,7 @@\n>\n>  #include <stdint.h>\n>  #include <unordered_map>\n> +#include <utility>\n>\n>  #include <libcamera/controls.h>\n>\n> @@ -27,10 +28,10 @@ public:\n>         DelayedControls(V4L2Device *device,\n>                         const std::unordered_map<uint32_t, ControlParams> &controlParams);\n>\n> -       void reset();\n> +       void reset(unsigned int cookie = 0);\n>\n> -       bool push(const ControlList &controls);\n> -       ControlList get(uint32_t sequence);\n> +       bool push(const ControlList &controls, unsigned int cookie = 0);\n> +       std::pair<ControlList, unsigned int> get(uint32_t sequence);\n\nI guess my only question here is whether we're happy that we've caught\nall the places affected by this API change. Maybe in code for other\nplatforms that we don't normally compile? A different API could have\nmade the change transparent, but if we're happy with this then so am\nI!!\n\n>\n>         void applyControls(uint32_t sequence);\n>\n> @@ -77,6 +78,7 @@ private:\n>         uint32_t writeCount_;\n>         /* \\todo Evaluate if we should index on ControlId * or unsigned int */\n>         std::unordered_map<const ControlId *, ControlRingBuffer<Info>> values_;\n> +       ControlRingBuffer<unsigned int> cookies_;\n>  };\n>\n>  } /* namespace libcamera */\n> diff --git a/src/libcamera/delayed_controls.cpp b/src/libcamera/delayed_controls.cpp\n> index 777441e8222a..c2198d0e8d77 100644\n> --- a/src/libcamera/delayed_controls.cpp\n> +++ b/src/libcamera/delayed_controls.cpp\n> @@ -109,14 +109,16 @@ DelayedControls::DelayedControls(V4L2Device *device,\n>\n>  /**\n>   * \\brief Reset state machine\n> + * \\param[in] cookie User supplied reset cookie value\n>   *\n>   * Resets the state machine to a starting position based on control values\n>   * retrieved from the device.\n>   */\n> -void DelayedControls::reset()\n> +void DelayedControls::reset(unsigned int cookie)\n>  {\n>         queueCount_ = 1;\n>         writeCount_ = 0;\n> +       cookies_[0] = cookie;\n>\n>         /* Retrieve control as reported by the device. */\n>         std::vector<uint32_t> ids;\n> @@ -140,13 +142,14 @@ void DelayedControls::reset()\n>  /**\n>   * \\brief Push a set of controls on the queue\n>   * \\param[in] controls List of controls to add to the device queue\n> + * \\param[in] cookie User supplied cookie value for \\a controls\n>   *\n>   * Push a set of controls to the control queue. This increases the control queue\n>   * depth by one.\n>   *\n>   * \\returns true if \\a controls are accepted, or false otherwise\n>   */\n> -bool DelayedControls::push(const ControlList &controls)\n> +bool DelayedControls::push(const ControlList &controls, const unsigned int cookie)\n>  {\n>         /* Copy state from previous frame. */\n>         for (auto &ctrl : values_) {\n> @@ -180,6 +183,7 @@ bool DelayedControls::push(const ControlList &controls)\n>                         << \" at index \" << queueCount_;\n>         }\n>\n> +       cookies_[queueCount_] = cookie;\n>         queueCount_++;\n>\n>         return true;\n> @@ -198,9 +202,10 @@ bool DelayedControls::push(const ControlList &controls)\n>   * push(). The max history from the current sequence number that yields valid\n>   * values are thus 16 minus number of controls pushed.\n>   *\n> - * \\return The controls at \\a sequence number\n> + * \\return The controls at \\a sequence number and associated user supplied\n> + * cookie value.\n>   */\n> -ControlList DelayedControls::get(uint32_t sequence)\n> +std::pair<ControlList, unsigned int> DelayedControls::get(uint32_t sequence)\n>  {\n>         unsigned int index = std::max<int>(0, sequence - maxDelay_);\n>\n> @@ -217,7 +222,7 @@ ControlList DelayedControls::get(uint32_t sequence)\n>                         << \" at index \" << index;\n>         }\n>\n> -       return out;\n> +       return { out, cookies_[index] };\n>  }\n>\n>  /**\n> @@ -276,7 +281,7 @@ void DelayedControls::applyControls(uint32_t sequence)\n>         while (writeCount_ > queueCount_) {\n>                 LOG(DelayedControls, Debug)\n>                         << \"Queue is empty, auto queue no-op.\";\n> -               push({});\n> +               push({}, cookies_[queueCount_ - 1]);\n>         }\n>\n>         device_->setControls(&out);\n> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> index 93219a6c1134..b0f0b22c5298 100644\n> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> @@ -1385,7 +1385,8 @@ void IPU3CameraData::cio2BufferReady(FrameBuffer *buffer)\n>         request->metadata().set(controls::SensorTimestamp,\n>                                 buffer->metadata().timestamp);\n>\n> -       info->effectiveSensorControls = delayedCtrls_->get(buffer->metadata().sequence);\n> +       auto [controls, cookie] = delayedCtrls_->get(buffer->metadata().sequence);\n> +       info->effectiveSensorControls = std::move(controls);\n>\n>         if (request->findBuffer(&rawStream_))\n>                 pipe()->completeBuffer(request, buffer);\n> diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> index b4094898ca6c..d34a906c3cea 100644\n> --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> @@ -1848,7 +1848,7 @@ void RPiCameraData::unicamBufferDequeue(FrameBuffer *buffer)\n>                  * Lookup the sensor controls used for this frame sequence from\n>                  * DelayedControl and queue them along with the frame buffer.\n>                  */\n> -               ControlList ctrl = delayedCtrls_->get(buffer->metadata().sequence);\n> +               auto [ctrl, cookie] = delayedCtrls_->get(buffer->metadata().sequence);\n>                 /*\n>                  * Add the frame timestamp to the ControlList for the IPA to use\n>                  * as it does not receive the FrameBuffer object.\n> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> index 03bbe6b467ae..cec90810ff95 100644\n> --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> @@ -1159,8 +1159,9 @@ void PipelineHandlerRkISP1::statReady(FrameBuffer *buffer)\n>         if (data->frame_ <= buffer->metadata().sequence)\n>                 data->frame_ = buffer->metadata().sequence + 1;\n>\n> +       auto [controls, cooke] = data->delayedCtrls_->get(buffer->metadata().sequence);\n\ns/cooke/cookie/ ? Though I guess no one is using it, but still...\n\nWith or without this very minor typo correction:\n\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\nTested-by: David Plowman <david.plowman@raspberrypi.com>\n\n(Tested on Raspberry Pi only.)\n\nThanks!\nDavid\n\n>         data->ipa_->processStatsBuffer(info->frame, info->statBuffer->cookie(),\n> -                                      data->delayedCtrls_->get(buffer->metadata().sequence));\n> +                                      controls);\n>  }\n>\n>  REGISTER_PIPELINE_HANDLER(PipelineHandlerRkISP1)\n> diff --git a/test/delayed_controls.cpp b/test/delayed_controls.cpp\n> index a8ce9828d73d..322c545998b2 100644\n> --- a/test/delayed_controls.cpp\n> +++ b/test/delayed_controls.cpp\n> @@ -96,7 +96,7 @@ protected:\n>\n>                         delayed->applyControls(i);\n>\n> -                       ControlList result = delayed->get(i);\n> +                       auto [result, cookie] = delayed->get(i);\n>                         int32_t brightness = result.get(V4L2_CID_BRIGHTNESS).get<int32_t>();\n>                         if (brightness != value) {\n>                                 cerr << \"Failed single control without delay\"\n> @@ -138,7 +138,7 @@ protected:\n>\n>                         delayed->applyControls(i);\n>\n> -                       ControlList result = delayed->get(i);\n> +                       auto [result, cookie] = delayed->get(i);\n>                         int32_t brightness = result.get(V4L2_CID_BRIGHTNESS).get<int32_t>();\n>                         if (brightness != expected) {\n>                                 cerr << \"Failed single control with delay\"\n> @@ -187,7 +187,7 @@ protected:\n>\n>                         delayed->applyControls(i);\n>\n> -                       ControlList result = delayed->get(i);\n> +                       auto [result, cookie] = delayed->get(i);\n>                         int32_t brightness = result.get(V4L2_CID_BRIGHTNESS).get<int32_t>();\n>                         int32_t contrast = result.get(V4L2_CID_CONTRAST).get<int32_t>();\n>                         if (brightness != expected || contrast != expected + 1) {\n> @@ -247,7 +247,7 @@ protected:\n>\n>                         delayed->applyControls(i);\n>\n> -                       ControlList result = delayed->get(i);\n> +                       auto [result, cookie] = delayed->get(i);\n>\n>                         int32_t brightness = result.get(V4L2_CID_BRIGHTNESS).get<int32_t>();\n>                         int32_t contrast = result.get(V4L2_CID_CONTRAST).get<int32_t>();\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 1259DBD16B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 23 Sep 2022 09:47:47 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5C33362233;\n\tFri, 23 Sep 2022 11:47:46 +0200 (CEST)","from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com\n\t[IPv6:2a00:1450:4864:20::12c])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C7ABD621BC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 23 Sep 2022 11:47:44 +0200 (CEST)","by mail-lf1-x12c.google.com with SMTP id j16so18970818lfg.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 23 Sep 2022 02:47:44 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1663926466;\n\tbh=+yrLDRNgdhXX6TX/W6Flz0UK3Mw5JeTICx/SPj+4jlE=;\n\th=References:In-Reply-To:Date:To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=4KzNWkebUYWhkVoTtmMTL5MQFlKpXXUBMopzS3mXEmhYOtcJhG44/XBjzKvaPqPPb\n\tCE2XhV/YN6WCDrlcboZDscx2d3xDzIpcxg8gDdFVcXBmW61ZUdOPqDAk4SNztvHf9S\n\tMxaSfCTfuypvRyjcSCDGT9dlGNGqigamhDLj73RoIbs/BSnLenYQSA+FRn8Ci3VT/y\n\ttDDuE2usvI/2pFnaTQYgWlGVWdy6dqoRo8eba9EkVrRJ25/4eEGhK8uibcxHjbH7PN\n\tk0FCjwV9jOPXY05pstDvUE9s/RYp0fDYprVsWX519P0Dq0QrxOiAT7HsLJ4HKd88p4\n\tG63J1G9rkVFDA==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:from:to:cc:subject:date;\n\tbh=1NBz4RC2ZqlBXn8oX7bCTaJU7qGJZ/1WZIRyHg8pqJ4=;\n\tb=ttOZMXKxdz3gL/CeQ5ukbxEiK6Q2svAXRyuCLCchK4DkjQ7nZtfQHTHY+BKRFtf9Dz\n\tbvSnmXwF0xoSrescqLRXzFQBRIF0DZvLys3jbLzaa/8aUaPweZa39o2/KpKAlHj0b8sa\n\tHY0oLfr/6e/mVszJsNWBbkqemIrQEAebQsLPgOhcI5APnlQ46uwyLvIPT7lSq+PO9V0g\n\tt1F3FHqHemHkahlsl2/Emk4UcGr74pbYv8cBpPYmq29WC8emxHys6iESDWg15LgFjIF0\n\tR3A2KVLcrhUgqDQ/YLNaBjBuyX635Ri4eOvPb+R69hI0xlXjXya+zhHF5cSfP3kD8CIN\n\tF3Hw=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"ttOZMXKx\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:x-gm-message-state:from:to:cc:subject:date;\n\tbh=1NBz4RC2ZqlBXn8oX7bCTaJU7qGJZ/1WZIRyHg8pqJ4=;\n\tb=Bxeiur2Lb5el1TljfiXBAaSj+tCPJRW+eQVDPIGamP0OdAM/3St6PdzbaQBVQuPB3Z\n\tweCQySjV5sqGrMsjGkkMEhWXxZkpnF7NnXYevoiRywrHGJhlEheL0cjElPA0mrdBlJ6k\n\tfegSU4m2hqbUcfjsghPeZIvviqoTmM9yPbqCmuyfZHQF6YT6W/IDL42uG8OeSwfgxziS\n\tcLK+ZVZUE0Hg6tCOohg3QUyJGEojkjnMVbg7mJS8CGrgJOUjeVUWQm/clW/KYWhM+SmB\n\tPEgJimJrFDweWQYrKBTnS47eovyc0yHysGFHclWIwSmG9wOR6Je4eCwI5tI456eoDQgF\n\tIfMw==","X-Gm-Message-State":"ACrzQf2wFzNnHctUS2hGpslryTwa7yDxrRcABLNu3kADP+Zx+na5RGBd\n\tlJYOYColjqYccWlaYSszUQ/G+oijr9uLxoUl4TZ5ZtSou25Zmw==","X-Google-Smtp-Source":"AMsMyM7aOg55vQWDABZB1YvBORnHSfHsdsfVjinQIEahirYn/4PWz7QVQTSTwV5bzthS4ik24OyWpxbolB6hPxLVmvU=","X-Received":"by 2002:a19:6446:0:b0:49a:9b06:f4be with SMTP id\n\tb6-20020a196446000000b0049a9b06f4bemr2997565lfj.157.1663926464026;\n\tFri, 23 Sep 2022 02:47:44 -0700 (PDT)","MIME-Version":"1.0","References":"<20220905073956.7342-1-naush@raspberrypi.com>\n\t<20220905073956.7342-3-naush@raspberrypi.com>","In-Reply-To":"<20220905073956.7342-3-naush@raspberrypi.com>","Date":"Fri, 23 Sep 2022 10:47:32 +0100","Message-ID":"<CAHW6GY+fnYTf98KNoRtQYowT3SK6e-sKSDDyDyLzE4qdG-gC=Q@mail.gmail.com>","To":"Naushir Patuck <naush@raspberrypi.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Subject":"Re: [libcamera-devel] [PATCH v2 2/7] delayed_controls: Add user\n\tcookie to DelayedControls","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":"David Plowman via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"David Plowman <david.plowman@raspberrypi.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]