[{"id":38965,"web_url":"https://patchwork.libcamera.org/comment/38965/","msgid":"<ahgOBa-928tTgy-U@zed>","date":"2026-05-28T09:43:07","subject":"Re: [PATCH v2 12/32] pipeline: rkisp1: Fix controls in raw mode","submitter":{"id":143,"url":"https://patchwork.libcamera.org/api/people/143/","name":"Jacopo Mondi","email":"jacopo.mondi@ideasonboard.com"},"content":"Hi Stefan\n\nOn Wed, Mar 25, 2026 at 04:13:44PM +0100, Stefan Klug wrote:\n> After the pipeline restructuring setSensorControls is no longer emitted\n> within process() but within computeParams(). In raw mode computeParams\n> is not called and therefore setSensorControls is never emitted. Fix that\n> by allowing computeParams to be called with an empty bufferId. This\n> strategy is also used for processStats() to ensure that metadata gets\n> filled in raw mode.  Then call computeParams within frameStart() when in\n> raw mode.\n>\n> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n>\n> ---\n>\n> Changes in v2:\n> - Call computeParams() within queueRequestDevice for now to make the\n>   patch easier to follow. Moving computeParams to frameStart() will\n> happen in a later patch.\n> ---\n>  src/ipa/rkisp1/rkisp1.cpp                | 12 ++++++++++++\n>  src/libcamera/pipeline/rkisp1/rkisp1.cpp |  6 ++++++\n>  2 files changed, 18 insertions(+)\n>\n> diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\n> index 81430d6532ac..e06238a7abe9 100644\n> --- a/src/ipa/rkisp1/rkisp1.cpp\n> +++ b/src/ipa/rkisp1/rkisp1.cpp\n> @@ -343,6 +343,18 @@ void IPARkISP1::computeParams(const uint32_t frame, const uint32_t bufferId)\n>  {\n>  \tIPAFrameContext &frameContext = context_.frameContexts.get(frame);\n>\n> +\t/*\n> +\t * \\todo: This needs discussion. In raw mode, computeParams is\n> +\t * called without a params buffer, to trigger the setSensorControls\n> +\t * signal. Currently our algorithms don't support prepare calls with\n> +\t * a nullptr. Do we need that or can we safely skip it?\n> +\t */\n> +\tif (bufferId == 0) {\n> +\t\tControlList ctrls = getSensorControls(frameContext);\n> +\t\tsetSensorControls.emit(frame, ctrls);\n\nI might have missed who updates the sensor's exposure/gain if we do\nnot call algo->prepare() ?\n\n> +\t\treturn;\n> +\t}\n> +\n>  \tRkISP1Params params(context_.configuration.paramFormat,\n>  \t\t\t    mappedBuffers_.at(bufferId).planes()[0]);\n>\n> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> index a3b78bf4dc6b..7352237dbb86 100644\n> --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> @@ -1350,6 +1350,12 @@ int PipelineHandlerRkISP1::queueRequestDevice(Camera *camera, Request *request)\n>\n>  \t\tif (data->selfPath_ && info->selfPathBuffer)\n>  \t\t\tdata->selfPath_->queueBuffer(info->selfPathBuffer);\n> +\n> +\t\t/*\n> +\t\t * Call computeParams with an empty param buffer to trigger the\n> +\t\t * setSensorControls signal.\n> +\t\t */\n> +\t\tdata->ipa_->computeParams(data->frame_, 0);\n>  \t} else {\n>  \t\tdata->ipa_->computeParams(data->frame_,\n>  \t\t\t\t\t  info->paramBuffer->cookie());\n> --\n> 2.51.0\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 5D83FBDCBC\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 28 May 2026 09:43:15 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3287162FEA;\n\tThu, 28 May 2026 11:43:14 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C067A62DC4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 28 May 2026 11:43:12 +0200 (CEST)","from ideasonboard.com (unknown [91.80.69.123])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id DA236219;\n\tThu, 28 May 2026 11:42:52 +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=\"snqTOepY\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1779961373;\n\tbh=XBJVZ12jwgZZ9/ve9mQQMQAU2QYn6YwuFM3KacJjqjM=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=snqTOepYeEKq1E70lxWkCx1xMze+maD2DEPwEtPzlBptWiaX4j94ZvSw9O32KEN0H\n\tKBWxieo3V6F5Na9xPcZ3DGyu1j79umHkN0kvZ0n7kImyoFAOyFDlDAEswIphtwTPIa\n\t4VQz1zPUMEyB8UFuGoxyebwY1YTsJbNvyNboo9y4=","Date":"Thu, 28 May 2026 11:43:07 +0200","From":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","To":"Stefan Klug <stefan.klug@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v2 12/32] pipeline: rkisp1: Fix controls in raw mode","Message-ID":"<ahgOBa-928tTgy-U@zed>","References":"<20260325151416.2114564-1-stefan.klug@ideasonboard.com>\n\t<20260325151416.2114564-13-stefan.klug@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20260325151416.2114564-13-stefan.klug@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":38969,"web_url":"https://patchwork.libcamera.org/comment/38969/","msgid":"<177997510544.8301.1863783346585370307@localhost>","date":"2026-05-28T13:31:45","subject":"Re: [PATCH v2 12/32] pipeline: rkisp1: Fix controls in raw mode","submitter":{"id":184,"url":"https://patchwork.libcamera.org/api/people/184/","name":"Stefan Klug","email":"stefan.klug@ideasonboard.com"},"content":"Hi Jacopo,\n\n\nQuoting Jacopo Mondi (2026-05-28 11:43:07)\n> Hi Stefan\n> \n> On Wed, Mar 25, 2026 at 04:13:44PM +0100, Stefan Klug wrote:\n> > After the pipeline restructuring setSensorControls is no longer emitted\n> > within process() but within computeParams(). In raw mode computeParams\n> > is not called and therefore setSensorControls is never emitted. Fix that\n> > by allowing computeParams to be called with an empty bufferId. This\n> > strategy is also used for processStats() to ensure that metadata gets\n> > filled in raw mode.  Then call computeParams within frameStart() when in\n> > raw mode.\n> >\n> > Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n> >\n> > ---\n> >\n> > Changes in v2:\n> > - Call computeParams() within queueRequestDevice for now to make the\n> >   patch easier to follow. Moving computeParams to frameStart() will\n> > happen in a later patch.\n> > ---\n> >  src/ipa/rkisp1/rkisp1.cpp                | 12 ++++++++++++\n> >  src/libcamera/pipeline/rkisp1/rkisp1.cpp |  6 ++++++\n> >  2 files changed, 18 insertions(+)\n> >\n> > diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\n> > index 81430d6532ac..e06238a7abe9 100644\n> > --- a/src/ipa/rkisp1/rkisp1.cpp\n> > +++ b/src/ipa/rkisp1/rkisp1.cpp\n> > @@ -343,6 +343,18 @@ void IPARkISP1::computeParams(const uint32_t frame, const uint32_t bufferId)\n> >  {\n> >       IPAFrameContext &frameContext = context_.frameContexts.get(frame);\n> >\n> > +     /*\n> > +      * \\todo: This needs discussion. In raw mode, computeParams is\n> > +      * called without a params buffer, to trigger the setSensorControls\n> > +      * signal. Currently our algorithms don't support prepare calls with\n> > +      * a nullptr. Do we need that or can we safely skip it?\n> > +      */\n> > +     if (bufferId == 0) {\n> > +             ControlList ctrls = getSensorControls(frameContext);\n> > +             setSensorControls.emit(frame, ctrls);\n> \n> I might have missed who updates the sensor's exposure/gain if we do\n> not call algo->prepare() ?\n\nAs this path is exercised in RAW mode where we don't have auto\nregulation I think it makes sense to ensure that algorithms have all the\nsensor related fields set up in queueRequest. But you are right, this\nonly works properly if we actually call queueRequest on all the\nalgorithms. This is done in [PATCH v2 22/32] ipa: rkisp1: Lazy\ninitialise frame context.\n\nRegards,\nStefan\n\n> \n> > +             return;\n> > +     }\n> > +\n> >       RkISP1Params params(context_.configuration.paramFormat,\n> >                           mappedBuffers_.at(bufferId).planes()[0]);\n> >\n> > diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> > index a3b78bf4dc6b..7352237dbb86 100644\n> > --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> > +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> > @@ -1350,6 +1350,12 @@ int PipelineHandlerRkISP1::queueRequestDevice(Camera *camera, Request *request)\n> >\n> >               if (data->selfPath_ && info->selfPathBuffer)\n> >                       data->selfPath_->queueBuffer(info->selfPathBuffer);\n> > +\n> > +             /*\n> > +              * Call computeParams with an empty param buffer to trigger the\n> > +              * setSensorControls signal.\n> > +              */\n> > +             data->ipa_->computeParams(data->frame_, 0);\n> >       } else {\n> >               data->ipa_->computeParams(data->frame_,\n> >                                         info->paramBuffer->cookie());\n> > --\n> > 2.51.0\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 B68F8C328C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 28 May 2026 13:31:50 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9210762FEC;\n\tThu, 28 May 2026 15:31:49 +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 A92FE6175A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 28 May 2026 15:31:48 +0200 (CEST)","from ideasonboard.com (tmo-086-128.customers.d1-online.com\n\t[80.187.86.128])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id C8EF282A;\n\tThu, 28 May 2026 15:31:28 +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=\"rpihN1TM\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1779975089;\n\tbh=6WY4Q/hAtsFq6V04k9ZWr5cCYseleFwbV7xTE0ReCmE=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=rpihN1TM1m9d5/I/BLU0M5UZwaHV6VmejFZX12P4xS6YUkxLucAd5jsh2wb8HbjU+\n\tj/g1vlh/EB1OnYZNawr3RZ0NwuPnuTrsGkrDtSFrXGy0V1SyuCeSjhCIlEa+dBAd3s\n\tMJDW7UXaatyexAA/w0f/CS1uFd7CN/bY1uSh/MEc=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<ahgOBa-928tTgy-U@zed>","References":"<20260325151416.2114564-1-stefan.klug@ideasonboard.com>\n\t<20260325151416.2114564-13-stefan.klug@ideasonboard.com>\n\t<ahgOBa-928tTgy-U@zed>","Subject":"Re: [PATCH v2 12/32] pipeline: rkisp1: Fix controls in raw mode","From":"Stefan Klug <stefan.klug@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","To":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","Date":"Thu, 28 May 2026 15:31:45 +0200","Message-ID":"<177997510544.8301.1863783346585370307@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>"}}]