[{"id":36630,"web_url":"https://patchwork.libcamera.org/comment/36630/","msgid":"<20251102202706.GJ27255@pendragon.ideasonboard.com>","date":"2025-11-02T20:27:06","subject":"Re: [PATCH] libcamera: rkisp1: Mark VBLANK as priority","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nThank you for addressing this so quickly.\n\nOn Sun, Nov 02, 2025 at 08:54:33PM +0100, Jacopo Mondi wrote:\n> The DelayedControls class works around a limitation of the V4L2 controls\n> API by assigning to controls that modify the limits of other controls a\n> 'priority' flag.\n> \n> 'Priority' controls are written to the device before others to make sure\n> the limits of dependent controls are correctly updated.\n> \n> A typical example of a priority control is VBLANK, whose value changes the\n> limits of the EXPOSURE control. This doesn't apply to a specific hardware\n> platform but to all V4L2 sensors.\n> \n> The RkISP1 pipeline handler doesn't mark VBLANK as a priority control, an\n> issue which might result in the exposure being clamped to an outdated frame\n> length.\n> \n> Fix the rkisp1 pipeline by marking VBLANK as a priority control.\n> \n> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n> A simpler version of \"libcamera: delayed_controls: Make VBLANK priority\n> by default\" as automatically setting VBLANK would save pipeline handlers\n> from doing it, but if anyone has to support HBLANK, in example, it has\n> to modify DelayedControls, not sure what's better, so I'm sending both.\n\nI think I like this one better for the time being as it's less invasive.\nWe know we need to rework DelayedControls in the future.\n\n> ---\n>  src/libcamera/pipeline/rkisp1/rkisp1.cpp | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n> \n> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> index ecd13831539fdf5cb79da2ea4b33a353514328ae..d7195b6c484d091857a91de709e0e060810c7c32 100644\n> --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> @@ -1348,7 +1348,7 @@ int PipelineHandlerRkISP1::createCamera(MediaEntity *sensor)\n>  \tstd::unordered_map<uint32_t, DelayedControls::ControlParams> params = {\n>  \t\t{ V4L2_CID_ANALOGUE_GAIN, { delays.gainDelay, false } },\n>  \t\t{ V4L2_CID_EXPOSURE, { delays.exposureDelay, false } },\n> -\t\t{ V4L2_CID_VBLANK, { delays.vblankDelay, false } },\n> +\t\t{ V4L2_CID_VBLANK, { delays.vblankDelay, true } },\n>  \t};\n>  \n>  \tdata->delayedCtrls_ =\n> \n> ---\n> base-commit: b1f09c013a01a82c739f0e30b71fd8d000ef5655\n> change-id: 20251102-rkisp1-vblank-ba2084646ba7","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 5964BBDE4C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun,  2 Nov 2025 20:27:22 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 16DB360A80;\n\tSun,  2 Nov 2025 21:27:22 +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 879B7606E6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun,  2 Nov 2025 21:27:20 +0100 (CET)","from pendragon.ideasonboard.com (82-203-160-149.bb.dnainternet.fi\n\t[82.203.160.149])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 0C42C99F;\n\tSun,  2 Nov 2025 21:25: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=\"AjF5veB4\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1762115128;\n\tbh=XqP0OPMqojMTayOC4CE7AH3IMcGM/g/goy1r61RmMnM=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=AjF5veB47rlYR2WRX+pt+Wm+7Z/ZJ/Bmfk8QtTZ9Ea5GsHOCfGbkBZyWi47A6Mqak\n\t+yKFveU9p7+CwLYaG/Lj5UlmfAL4YzJ4ho4Wc1gbRoChMXDAEgQvwHrjJ3AtB9k+nB\n\tR/eMqFnqAXN1cFtVi3ImbUsPHNjUPsKZVQOL5aK0=","Date":"Sun, 2 Nov 2025 22:27:06 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH] libcamera: rkisp1: Mark VBLANK as priority","Message-ID":"<20251102202706.GJ27255@pendragon.ideasonboard.com>","References":"<20251102-rkisp1-vblank-v1-1-fa8f8bb3e396@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20251102-rkisp1-vblank-v1-1-fa8f8bb3e396@ideasonboard.com>","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":36646,"web_url":"https://patchwork.libcamera.org/comment/36646/","msgid":"<e2a4cab7-e646-4314-b39f-713c0cb7b6c4@ideasonboard.com>","date":"2025-11-03T11:25:59","subject":"Re: [PATCH] libcamera: rkisp1: Mark VBLANK as priority","submitter":{"id":216,"url":"https://patchwork.libcamera.org/api/people/216/","name":"Barnabás Pőcze","email":"barnabas.pocze@ideasonboard.com"},"content":"Hi\n\n2025. 11. 02. 20:54 keltezéssel, Jacopo Mondi írta:\n> The DelayedControls class works around a limitation of the V4L2 controls\n> API by assigning to controls that modify the limits of other controls a\n> 'priority' flag.\n> \n> 'Priority' controls are written to the device before others to make sure\n> the limits of dependent controls are correctly updated.\n> \n> A typical example of a priority control is VBLANK, whose value changes the\n> limits of the EXPOSURE control. This doesn't apply to a specific hardware\n> platform but to all V4L2 sensors.\n> \n> The RkISP1 pipeline handler doesn't mark VBLANK as a priority control, an\n> issue which might result in the exposure being clamped to an outdated frame\n> length.\n> \n> Fix the rkisp1 pipeline by marking VBLANK as a priority control.\n> \n> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n> ---\n> A simpler version of \"libcamera: delayed_controls: Make VBLANK priority\n> by default\" as automatically setting VBLANK would save pipeline handlers\n> from doing it, but if anyone has to support HBLANK, in example, it has\n> to modify DelayedControls, not sure what's better, so I'm sending both.\n> ---\n>   src/libcamera/pipeline/rkisp1/rkisp1.cpp | 2 +-\n>   1 file changed, 1 insertion(+), 1 deletion(-)\n> \n> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> index ecd13831539fdf5cb79da2ea4b33a353514328ae..d7195b6c484d091857a91de709e0e060810c7c32 100644\n> --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> @@ -1348,7 +1348,7 @@ int PipelineHandlerRkISP1::createCamera(MediaEntity *sensor)\n>   \tstd::unordered_map<uint32_t, DelayedControls::ControlParams> params = {\n>   \t\t{ V4L2_CID_ANALOGUE_GAIN, { delays.gainDelay, false } },\n>   \t\t{ V4L2_CID_EXPOSURE, { delays.exposureDelay, false } },\n> -\t\t{ V4L2_CID_VBLANK, { delays.vblankDelay, false } },\n> +\t\t{ V4L2_CID_VBLANK, { delays.vblankDelay, true } },\n\nWhy was it not marked as \"priority-write\"? Was it simply an oversight in\nf72c76eb6e06a41d2aaff8c8c4002dea21a7774d (\"rkisp1: Honor the FrameDurationLimits control\") ?\n\nIn any case, it appears OK to me.\n\nReviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n\n\n>   \t};\n>   \n>   \tdata->delayedCtrls_ =\n> \n> ---\n> base-commit: b1f09c013a01a82c739f0e30b71fd8d000ef5655\n> change-id: 20251102-rkisp1-vblank-ba2084646ba7\n> \n> Best regards,","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 7EC6EC3241\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  3 Nov 2025 11:26:05 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B663560A80;\n\tMon,  3 Nov 2025 12:26:04 +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 512C1606A0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  3 Nov 2025 12:26:03 +0100 (CET)","from [192.168.33.39] (185.221.140.239.nat.pool.zt.hu\n\t[185.221.140.239])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 2112B99F;\n\tMon,  3 Nov 2025 12:24:10 +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=\"SDPGIX+S\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1762169050;\n\tbh=6MhSJ3lbjXq0TcpMUm9z2bctFIp9x00m6pKpXlvs5I8=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=SDPGIX+S41n+b+aVWwewOUPQUACItZaHP7KP7GI2+75hKIIRdR7SJG9ZyOUWF8gv/\n\tJwhIa/dweK5GQOOIpF8wlUjQYszud6LiuZTF/GgdW0ER4IWVrI7a/nwC43qBRjSrUT\n\toJ1nv2YaxoJLTopHuXk9S/0ToFZ7iTPteP0SgBn8=","Message-ID":"<e2a4cab7-e646-4314-b39f-713c0cb7b6c4@ideasonboard.com>","Date":"Mon, 3 Nov 2025 12:25:59 +0100","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH] libcamera: rkisp1: Mark VBLANK as priority","To":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org,\n\tPaul Elder <paul.elder@ideasonboard.com>","References":"<20251102-rkisp1-vblank-v1-1-fa8f8bb3e396@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":"<20251102-rkisp1-vblank-v1-1-fa8f8bb3e396@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":36680,"web_url":"https://patchwork.libcamera.org/comment/36680/","msgid":"<drlfhjv5xqqcloyhazu2k3z3q4juzmz5qk3eym42cw3rqvhdxs@jkxf4h3pwvsm>","date":"2025-11-04T15:31:11","subject":"Re: [PATCH] libcamera: rkisp1: Mark VBLANK as priority","submitter":{"id":143,"url":"https://patchwork.libcamera.org/api/people/143/","name":"Jacopo Mondi","email":"jacopo.mondi@ideasonboard.com"},"content":"Hi Barnabás\n\nOn Mon, Nov 03, 2025 at 12:25:59PM +0100, Barnabás Pőcze wrote:\n> Hi\n>\n> 2025. 11. 02. 20:54 keltezéssel, Jacopo Mondi írta:\n> > The DelayedControls class works around a limitation of the V4L2 controls\n> > API by assigning to controls that modify the limits of other controls a\n> > 'priority' flag.\n> >\n> > 'Priority' controls are written to the device before others to make sure\n> > the limits of dependent controls are correctly updated.\n> >\n> > A typical example of a priority control is VBLANK, whose value changes the\n> > limits of the EXPOSURE control. This doesn't apply to a specific hardware\n> > platform but to all V4L2 sensors.\n> >\n> > The RkISP1 pipeline handler doesn't mark VBLANK as a priority control, an\n> > issue which might result in the exposure being clamped to an outdated frame\n> > length.\n> >\n> > Fix the rkisp1 pipeline by marking VBLANK as a priority control.\n> >\n> > Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n> > ---\n> > A simpler version of \"libcamera: delayed_controls: Make VBLANK priority\n> > by default\" as automatically setting VBLANK would save pipeline handlers\n> > from doing it, but if anyone has to support HBLANK, in example, it has\n> > to modify DelayedControls, not sure what's better, so I'm sending both.\n> > ---\n> >   src/libcamera/pipeline/rkisp1/rkisp1.cpp | 2 +-\n> >   1 file changed, 1 insertion(+), 1 deletion(-)\n> >\n> > diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> > index ecd13831539fdf5cb79da2ea4b33a353514328ae..d7195b6c484d091857a91de709e0e060810c7c32 100644\n> > --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> > +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> > @@ -1348,7 +1348,7 @@ int PipelineHandlerRkISP1::createCamera(MediaEntity *sensor)\n> >   \tstd::unordered_map<uint32_t, DelayedControls::ControlParams> params = {\n> >   \t\t{ V4L2_CID_ANALOGUE_GAIN, { delays.gainDelay, false } },\n> >   \t\t{ V4L2_CID_EXPOSURE, { delays.exposureDelay, false } },\n> > -\t\t{ V4L2_CID_VBLANK, { delays.vblankDelay, false } },\n> > +\t\t{ V4L2_CID_VBLANK, { delays.vblankDelay, true } },\n>\n> Why was it not marked as \"priority-write\"? Was it simply an oversight in\n> f72c76eb6e06a41d2aaff8c8c4002dea21a7774d (\"rkisp1: Honor the FrameDurationLimits control\") ?\n\nI presume so, I don't see a reason for not making VBLANK a priority\n(see also the alternative patch I proposed where it was marked as such\ninside DelayedControls).\n>\n> In any case, it appears OK to me.\n>\n> Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n\nThanks, I will push and add a Fixes tag!\n\n>\n>\n> >   \t};\n> >   \tdata->delayedCtrls_ =\n> >\n> > ---\n> > base-commit: b1f09c013a01a82c739f0e30b71fd8d000ef5655\n> > change-id: 20251102-rkisp1-vblank-ba2084646ba7\n> >\n> > Best regards,\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 387C6BDE4C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  4 Nov 2025 15:31:17 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 647D260A80;\n\tTue,  4 Nov 2025 16:31:16 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id EDD176069A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  4 Nov 2025 16:31:14 +0100 (CET)","from ideasonboard.com (93-61-96-190.ip145.fastwebnet.it\n\t[93.61.96.190])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id DE348EB7;\n\tTue,  4 Nov 2025 16:29:20 +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=\"OeGRh6q0\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1762270161;\n\tbh=ts61Z5L4P5Uh41ODKM1rpmdgsXKT98myHtjoCcqRz2M=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=OeGRh6q06aUiZ+2YgwyemeTunh5LtbTdvSFJDEx2NzgjFhzkd60Ov5GcABMBhZ81g\n\tyyrDj2yqNTdeWH7eZ9KsNRR29JRG5f9CEUuvY80qHGSTcSJ/FuhkJDpf08tLVIogmC\n\tyFOzrw0GtC3mLcdXtohnVtKelhjChm0ybjmEktm8=","Date":"Tue, 4 Nov 2025 16:31:11 +0100","From":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Cc":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>, \n\tlibcamera-devel@lists.libcamera.org,\n\tPaul Elder <paul.elder@ideasonboard.com>","Subject":"Re: [PATCH] libcamera: rkisp1: Mark VBLANK as priority","Message-ID":"<drlfhjv5xqqcloyhazu2k3z3q4juzmz5qk3eym42cw3rqvhdxs@jkxf4h3pwvsm>","References":"<20251102-rkisp1-vblank-v1-1-fa8f8bb3e396@ideasonboard.com>\n\t<e2a4cab7-e646-4314-b39f-713c0cb7b6c4@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<e2a4cab7-e646-4314-b39f-713c0cb7b6c4@ideasonboard.com>","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]