[{"id":36429,"web_url":"https://patchwork.libcamera.org/comment/36429/","msgid":"<8c7881ed-394a-4404-bf85-e4f841dee686@ideasonboard.com>","date":"2025-10-24T11:39:52","subject":"Re: [PATCH v1 04/35] libcamera: delayed_controls: Queue noop when\n\tneeded, not before","submitter":{"id":216,"url":"https://patchwork.libcamera.org/api/people/216/","name":"Barnabás Pőcze","email":"barnabas.pocze@ideasonboard.com"},"content":"2025. 10. 24. 10:50 keltezéssel, Stefan Klug írta:\n> A no-op is queued when DelayedControls runs out of controls after a\n> successful applyControls(). But after applyControls() there is still\n> some time left for new controls to be pushed until the next call to\n> applyControls(). To fix that, move the no-op push to the beginning of\n> applyContols().\n> \n> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n> ---\n>   src/libcamera/delayed_controls.cpp | 14 ++++++++------\n>   1 file changed, 8 insertions(+), 6 deletions(-)\n> \n> diff --git a/src/libcamera/delayed_controls.cpp b/src/libcamera/delayed_controls.cpp\n> index 044c6c7325e7..67213fe87d53 100644\n> --- a/src/libcamera/delayed_controls.cpp\n> +++ b/src/libcamera/delayed_controls.cpp\n> @@ -272,6 +272,14 @@ void DelayedControls::applyControls(uint32_t sequence)\n>   {\n>   \tLOG(DelayedControls, Debug) << \"frame \" << sequence << \" started\";\n> \n> +\twhile (queueCount_ - 1 < sequence) {\n> +\t\tLOG(DelayedControls, Warning)\n> +\t\t\t<< \"Queue is empty, auto queue no-op.\" << queueCount_;\n\nMissing space or some kind of separator in the log message.\n\n\n> +\t\tpush(queueCount_, {});\n> +\t}\n> +\n> +\twriteCount_ = sequence;\n\nI must be missing something. The commit message says\n\n   there is still some time left for new controls to be pushed until the next call\n\nbut the loop above does the same number of `push()` that the removed loop did.\nSo I don't understand what the commit message refers to, how could the user do\nany \"valid\" `push()` that wasn't previously possible?\n\n\n> +\n>   \t/*\n>   \t * Create control list peeking ahead in the value queue to ensure\n>   \t * values are set in time to satisfy the sensor delay.\n> @@ -312,12 +320,6 @@ void DelayedControls::applyControls(uint32_t sequence)\n> \n>   \twriteCount_ = sequence + 1;\n> \n> -\twhile (writeCount_ > queueCount_) {\n> -\t\tLOG(DelayedControls, Warning)\n> -\t\t\t<< \"Queue is empty, auto queue no-op.\";\n> -\t\tpush(queueCount_, {});\n> -\t}\n> -\n>   \tdevice_->setControls(&out);\n>   }\n> \n> --\n> 2.48.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 84932C3259\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 24 Oct 2025 11:39:59 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A2D76608CD;\n\tFri, 24 Oct 2025 13:39:58 +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 852BD608BD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 24 Oct 2025 13:39:57 +0200 (CEST)","from [192.168.33.13] (185.221.141.231.nat.pool.zt.hu\n\t[185.221.141.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 383541AA6;\n\tFri, 24 Oct 2025 13:38:10 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"dhkZSd49\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1761305891;\n\tbh=P1xhJ+Tqs1Rqik7nWKK+GzrRbJoghY8tovrMkldaiLk=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=dhkZSd49Mo29uozYHQ3LFo3gHz+h4LqFwOJzEowRlUhVj/jX3OOkRa61mj5qjesOu\n\tR1FCQca2bPsL2jQUgN6EDlbaztnInAP0tvTozu7/WQXXTJm1/a79KjDKehfrGgsZNa\n\thJ/G1es8noCZM809sjC3YeuaiNIx8/c6i1zjehrk=","Message-ID":"<8c7881ed-394a-4404-bf85-e4f841dee686@ideasonboard.com>","Date":"Fri, 24 Oct 2025 13:39:52 +0200","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v1 04/35] libcamera: delayed_controls: Queue noop when\n\tneeded, not before","To":"Stefan Klug <stefan.klug@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20251024085130.995967-1-stefan.klug@ideasonboard.com>\n\t<YRBifxOhmW7OXgtrN8bJ5eBGjoRxRwryIsfkhTO5IsekfnCX4_TAQwuhjvmj6i2e8xzr1WaQwAHRjhoufpZCjg==@protonmail.internalid>\n\t<20251024085130.995967-5-stefan.klug@ideasonboard.com>","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Content-Language":"en-US, hu-HU","In-Reply-To":"<20251024085130.995967-5-stefan.klug@ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"8bit","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":37283,"web_url":"https://patchwork.libcamera.org/comment/37283/","msgid":"<176542087481.30806.12276483497333044163@localhost>","date":"2025-12-11T02:41:14","subject":"Re: [PATCH v1 04/35] libcamera: delayed_controls: Queue noop when\n\tneeded, not before","submitter":{"id":184,"url":"https://patchwork.libcamera.org/api/people/184/","name":"Stefan Klug","email":"stefan.klug@ideasonboard.com"},"content":"Hi Barnabás,\n\nThank you for the review.\n\nQuoting Barnabás Pőcze (2025-10-24 13:39:52)\n> 2025. 10. 24. 10:50 keltezéssel, Stefan Klug írta:\n> > A no-op is queued when DelayedControls runs out of controls after a\n> > successful applyControls(). But after applyControls() there is still\n> > some time left for new controls to be pushed until the next call to\n> > applyControls(). To fix that, move the no-op push to the beginning of\n> > applyContols().\n> > \n> > Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n> > ---\n> >   src/libcamera/delayed_controls.cpp | 14 ++++++++------\n> >   1 file changed, 8 insertions(+), 6 deletions(-)\n> > \n> > diff --git a/src/libcamera/delayed_controls.cpp b/src/libcamera/delayed_controls.cpp\n> > index 044c6c7325e7..67213fe87d53 100644\n> > --- a/src/libcamera/delayed_controls.cpp\n> > +++ b/src/libcamera/delayed_controls.cpp\n> > @@ -272,6 +272,14 @@ void DelayedControls::applyControls(uint32_t sequence)\n> >   {\n> >       LOG(DelayedControls, Debug) << \"frame \" << sequence << \" started\";\n> > \n> > +     while (queueCount_ - 1 < sequence) {\n> > +             LOG(DelayedControls, Warning)\n> > +                     << \"Queue is empty, auto queue no-op.\" << queueCount_;\n> \n> Missing space or some kind of separator in the log message.\n\nThanks, fixed for v2.\n\n> \n> \n> > +             push(queueCount_, {});\n> > +     }\n> > +\n> > +     writeCount_ = sequence;\n> \n> I must be missing something. The commit message says\n> \n>    there is still some time left for new controls to be pushed until the next call\n> \n> but the loop above does the same number of `push()` that the removed loop did.\n> So I don't understand what the commit message refers to, how could the user do\n> any \"valid\" `push()` that wasn't previously possible?\n\nAs there are different sequence numbers at play here, (this gets\nadressed in \"libcamera: delayed_controls: Change semantics of sequence\nnumbers\") I have a hard time explaining this precisely.\n\nThe old code basically does:\n- Collect controls for sequence seq\n- Check if there is data for seq+1, push no-op if not\n\nThe issue is that at the time of the check, the data for seq+1 is not\nneeded, but only on the next call to applyControls. So I turned the\nlogic upside down, so that it follows\n- Check if all data for seq is available and push no-op if not\n- Collect controls for sequence seq\n\nSo after applyingControls for sequence seq, there is still a timeslot to\npush data for seq+1 before a no-op gets pushed.\n\nDoes that make sense?\n\nBest regards,\nStefan\n\n> \n> \n> > +\n> >       /*\n> >        * Create control list peeking ahead in the value queue to ensure\n> >        * values are set in time to satisfy the sensor delay.\n> > @@ -312,12 +320,6 @@ void DelayedControls::applyControls(uint32_t sequence)\n> > \n> >       writeCount_ = sequence + 1;\n> > \n> > -     while (writeCount_ > queueCount_) {\n> > -             LOG(DelayedControls, Warning)\n> > -                     << \"Queue is empty, auto queue no-op.\";\n> > -             push(queueCount_, {});\n> > -     }\n> > -\n> >       device_->setControls(&out);\n> >   }\n> > \n> > --\n> > 2.48.1\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 1EEF4C3257\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 11 Dec 2025 02:41:24 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 527D0614EE;\n\tThu, 11 Dec 2025 03:41:23 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 19FC9606D5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 11 Dec 2025 03:41:22 +0100 (CET)","from ideasonboard.com (p99249-ipoefx.ipoe.ocn.ne.jp\n\t[153.246.134.248])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 05A021352; \n\tThu, 11 Dec 2025 03:41:18 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"swFaeSlI\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1765420879;\n\tbh=ehmnCLbHnul8ndCoesvw+TrCEXJI6n/T6XR09sfafbc=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=swFaeSlIEntkd3TPcxw1QGvYM6w8myP4e+Y8DU72HsvA+NkyH841bVlGpZyCXy6rq\n\tT1nd2/9GphL3ESm1byjCzU6OarMVE2EJ5ocvUr+sh0qCai4P4bAPOXHR865Wlnektm\n\tpabkUUuYUqkUO3eqIyx9WfvnbE1+bRKS6uOBOm0U=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<8c7881ed-394a-4404-bf85-e4f841dee686@ideasonboard.com>","References":"<20251024085130.995967-1-stefan.klug@ideasonboard.com>\n\t<YRBifxOhmW7OXgtrN8bJ5eBGjoRxRwryIsfkhTO5IsekfnCX4_TAQwuhjvmj6i2e8xzr1WaQwAHRjhoufpZCjg==@protonmail.internalid>\n\t<20251024085130.995967-5-stefan.klug@ideasonboard.com>\n\t<8c7881ed-394a-4404-bf85-e4f841dee686@ideasonboard.com>","Subject":"Re: [PATCH v1 04/35] libcamera: delayed_controls: Queue noop when\n\tneeded, not before","From":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Thu, 11 Dec 2025 03:41:14 +0100","Message-ID":"<176542087481.30806.12276483497333044163@localhost>","User-Agent":"alot/0.12.dev8+g2c003385c862.d20250602","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":37841,"web_url":"https://patchwork.libcamera.org/comment/37841/","msgid":"<176907329471.3882822.15391984247545481379@neptunite.rasen.tech>","date":"2026-01-22T09:14:54","subject":"Re: [PATCH v1 04/35] libcamera: delayed_controls: Queue noop when\n\tneeded, not before","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"Quoting Stefan Klug (2025-10-24 17:50:28)\n> A no-op is queued when DelayedControls runs out of controls after a\n> successful applyControls(). But after applyControls() there is still\n> some time left for new controls to be pushed until the next call to\n> applyControls(). To fix that, move the no-op push to the beginning of\n> applyContols().\n> \n> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n> ---\n>  src/libcamera/delayed_controls.cpp | 14 ++++++++------\n>  1 file changed, 8 insertions(+), 6 deletions(-)\n> \n> diff --git a/src/libcamera/delayed_controls.cpp b/src/libcamera/delayed_controls.cpp\n> index 044c6c7325e7..67213fe87d53 100644\n> --- a/src/libcamera/delayed_controls.cpp\n> +++ b/src/libcamera/delayed_controls.cpp\n> @@ -272,6 +272,14 @@ void DelayedControls::applyControls(uint32_t sequence)\n>  {\n>         LOG(DelayedControls, Debug) << \"frame \" << sequence << \" started\";\n>  \n> +       while (queueCount_ - 1 < sequence) {\n\nI'm a bit confused. Aren't we fine if queueCount_ == sequence? But in that case\nthis will still trigger and we'll push noop for queueCount_?\n\nIs my understanding off-by-one somewhere?\n\n> +               LOG(DelayedControls, Warning)\n> +                       << \"Queue is empty, auto queue no-op.\" << queueCount_;\n> +               push(queueCount_, {});\n> +       }\n> +\n> +       writeCount_ = sequence;\n> +\n>         /*\n>          * Create control list peeking ahead in the value queue to ensure\n>          * values are set in time to satisfy the sensor delay.\n> @@ -312,12 +320,6 @@ void DelayedControls::applyControls(uint32_t sequence)\n>  \n>         writeCount_ = sequence + 1;\n\nI presume we don't need this anymore?\n\n\nPaul\n\n>  \n> -       while (writeCount_ > queueCount_) {\n> -               LOG(DelayedControls, Warning)\n> -                       << \"Queue is empty, auto queue no-op.\";\n> -               push(queueCount_, {});\n> -       }\n> -\n>         device_->setControls(&out);\n>  }\n>  \n> -- \n> 2.48.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 3E9E9BDCBF\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 22 Jan 2026 09:15:03 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CAFA861FD1;\n\tThu, 22 Jan 2026 10:15:02 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DAE4661FBF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 22 Jan 2026 10:15:00 +0100 (CET)","from neptunite.rasen.tech (unknown\n\t[IPv6:2404:7a81:160:2100:8816:a947:ebed:2ec7])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id EF6B52DD;\n\tThu, 22 Jan 2026 10:14:27 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"wZX+63Fj\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1769073268;\n\tbh=jYknrSfkUgk0VA6lrui1EcINVKisklka6sx2c7skvSw=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=wZX+63FjFMbkgEaKM/LMmQUtldzyDwAlQTsVscuuPefPFmunlulKRGcAEHG2HbJ61\n\t3nBOIGBYZVfz7kz2e9e0EwyMV1VvY0Xc/PULKqDBoDUQqw9X5vXsZsry5OrUazVwLb\n\tfLtv/z/lcSj9IOcsPh0dCKAeIQh2WHn0HaJQaXEk=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20251024085130.995967-5-stefan.klug@ideasonboard.com>","References":"<20251024085130.995967-1-stefan.klug@ideasonboard.com>\n\t<20251024085130.995967-5-stefan.klug@ideasonboard.com>","Subject":"Re: [PATCH v1 04/35] libcamera: delayed_controls: Queue noop when\n\tneeded, not before","From":"Paul Elder <paul.elder@ideasonboard.com>","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"Stefan Klug <stefan.klug@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Thu, 22 Jan 2026 18:14:54 +0900","Message-ID":"<176907329471.3882822.15391984247545481379@neptunite.rasen.tech>","User-Agent":"alot/0.0.0","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":38401,"web_url":"https://patchwork.libcamera.org/comment/38401/","msgid":"<177439145080.1888543.5856857933945749783@localhost>","date":"2026-03-24T22:30:50","subject":"Re: [PATCH v1 04/35] libcamera: delayed_controls: Queue noop when\n\tneeded, not before","submitter":{"id":184,"url":"https://patchwork.libcamera.org/api/people/184/","name":"Stefan Klug","email":"stefan.klug@ideasonboard.com"},"content":"Hi Paul,\n\nThank you for the review.\n\nQuoting Paul Elder (2026-01-22 10:14:54)\n> Quoting Stefan Klug (2025-10-24 17:50:28)\n> > A no-op is queued when DelayedControls runs out of controls after a\n> > successful applyControls(). But after applyControls() there is still\n> > some time left for new controls to be pushed until the next call to\n> > applyControls(). To fix that, move the no-op push to the beginning of\n> > applyContols().\n> > \n> > Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n> > ---\n> >  src/libcamera/delayed_controls.cpp | 14 ++++++++------\n> >  1 file changed, 8 insertions(+), 6 deletions(-)\n> > \n> > diff --git a/src/libcamera/delayed_controls.cpp b/src/libcamera/delayed_controls.cpp\n> > index 044c6c7325e7..67213fe87d53 100644\n> > --- a/src/libcamera/delayed_controls.cpp\n> > +++ b/src/libcamera/delayed_controls.cpp\n> > @@ -272,6 +272,14 @@ void DelayedControls::applyControls(uint32_t sequence)\n> >  {\n> >         LOG(DelayedControls, Debug) << \"frame \" << sequence << \" started\";\n> >  \n> > +       while (queueCount_ - 1 < sequence) {\n> \n> I'm a bit confused. Aren't we fine if queueCount_ == sequence? But in that case\n> this will still trigger and we'll push noop for queueCount_?\n> \n> Is my understanding off-by-one somewhere?\n\nI think the code is correct. queueCount_ is a bad name. It is easier for\nme to understand by calling it queueIndex_. So the next index that gets\nwritten on the next push(). If we'd only ensure that queueIndex ==\nsequence, we would apply controls from an index that was not yet\nwritten. So we ensure that queueIndex > sequence.\n\n> \n> > +               LOG(DelayedControls, Warning)\n> > +                       << \"Queue is empty, auto queue no-op.\" << queueCount_;\n> > +               push(queueCount_, {});\n> > +       }\n> > +\n> > +       writeCount_ = sequence;\n> > +\n> >         /*\n> >          * Create control list peeking ahead in the value queue to ensure\n> >          * values are set in time to satisfy the sensor delay.\n> > @@ -312,12 +320,6 @@ void DelayedControls::applyControls(uint32_t sequence)\n> >  \n> >         writeCount_ = sequence + 1;\n> \n> I presume we don't need this anymore?\n\nRight, I can drop the whole member variable. Neat :-)\n\nBest regards,\nStefan\n\n> \n> \n> Paul\n> \n> >  \n> > -       while (writeCount_ > queueCount_) {\n> > -               LOG(DelayedControls, Warning)\n> > -                       << \"Queue is empty, auto queue no-op.\";\n> > -               push(queueCount_, {});\n> > -       }\n> > -\n> >         device_->setControls(&out);\n> >  }\n> >  \n> > -- \n> > 2.48.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 02143BD87C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 24 Mar 2026 22:30:55 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0F0C962791;\n\tTue, 24 Mar 2026 23:30:55 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8E9D562780\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 24 Mar 2026 23:30:53 +0100 (CET)","from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:b16a:5ed9:4ada:a95a])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id DD27D591;\n\tTue, 24 Mar 2026 23:29:35 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"dAtJA63Z\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1774391376;\n\tbh=KmAfWZYYzFHLR5WynAyC6BnGOve9UPwFxjuFWv+z8kU=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=dAtJA63ZNB3j3QDsxqyiTJZTiwBBc+AiZ1AYLmRGlMOMMXj/CPExgtntoh1F6rmu2\n\t2/btgYNdqBcDmX3U/VllGKqNrPj/h8Wr39tVSyPLZzLto7LlNTdyunkMZKvawIQyuR\n\tXVAHs4TOdMruq3QjnkvNpzVWygHbEoUtY0X/weYE=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<176907329471.3882822.15391984247545481379@neptunite.rasen.tech>","References":"<20251024085130.995967-1-stefan.klug@ideasonboard.com>\n\t<20251024085130.995967-5-stefan.klug@ideasonboard.com>\n\t<176907329471.3882822.15391984247545481379@neptunite.rasen.tech>","Subject":"Re: [PATCH v1 04/35] libcamera: delayed_controls: Queue noop when\n\tneeded, not before","From":"Stefan Klug <stefan.klug@ideasonboard.com>","Cc":"","To":"Paul Elder <paul.elder@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Tue, 24 Mar 2026 23:30:50 +0100","Message-ID":"<177439145080.1888543.5856857933945749783@localhost>","User-Agent":"alot/0.12.dev8+g2c003385c862.d20250602","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]