[{"id":31639,"web_url":"https://patchwork.libcamera.org/comment/31639/","msgid":"<dcoyqmk5pjwregkpeomr6sclpxylpyl2ivxc34yzf7e5jatcni@3n7fdemdg7g6>","date":"2024-10-09T11:00:41","subject":"Re: [PATCH v2] libcamera: rkisp1: Clamp stream configuration to ISP\n\tlimit on raw path","submitter":{"id":184,"url":"https://patchwork.libcamera.org/api/people/184/","name":"Stefan Klug","email":"stefan.klug@ideasonboard.com"},"content":"Hi Umang,\n\nThank you for the patch. \n\nOn Wed, Oct 09, 2024 at 03:09:19PM +0530, Umang Jain wrote:\n> Commit 761545407c76 (\"pipeline: rkisp1: Filter out sensor sizes not\n> supported by the pipeline\") introduced a mechanism to determine maximum\n> supported sensor resolution and filter out resolutions that cannot be\n> supported by the ISP.\n> \n> However, it missed to update the raw stream configuration path, where\n> it should have clamped the raw stream configuration size to the maximum\n> sensor supported resolution.\n> \n> This patch fixes the above issue and can be confirmed with IMX283\n> on i.MX8MP:\n> \n> From:\n> ($) cam -c1 -srole=raw,width=5472,height=3072\n> INFO Camera camera.cpp:1197 configuring streams: (0) 5472x3648-SRGGB12\n> ERROR RkISP1 rkisp1_path.cpp:425 Unable to configure capture in 5472x3648-SRGGB12\n> Failed to configure camera\n> Failed to start camera session\n> \n> To:\n> ($) cam -c1 -srole=raw,width=5472,height=3072\n> INFO Camera camera.cpp:1197 configuring streams: (0) 4096x3072-SRGGB12\n> cam0: Capture until user interrupts by SIGINT\n> 536.082380 (0.00 fps) cam0-stream0 seq: 000000 bytesused: 25165824\n> 536.182378 (10.00 fps) cam0-stream0 seq: 000001 bytesused: 25165824\n> 536.282375 (10.00 fps) cam0-stream0 seq: 000002 bytesused: 25165824\n> ...\n> \n> Fixes: 761545407c76 (\"pipeline: rkisp1: Filter out sensor sizes not supported by the pipeline\")\n> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>\n> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n\nLooks good to me.\n\nReviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> \n\n> ---\n> Changes in v2:\n> - Extend the comment on what 'resolution' var is and denote that\n>   sensor->getFormat() will never return something greter than\n>  'resolution'\n> ---\n>  src/libcamera/pipeline/rkisp1/rkisp1_path.cpp | 8 +++++++-\n>  1 file changed, 7 insertions(+), 1 deletion(-)\n> \n> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\n> index 3b5bea96..1999094e 100644\n> --- a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\n> +++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\n> @@ -326,9 +326,15 @@ RkISP1Path::validate(const CameraSensor *sensor,\n>  \tif (isRaw) {\n>  \t\t/*\n>  \t\t * Use the sensor output size closest to the requested stream\n> -\t\t * size.\n> +\t\t * size while ensuring the output size doesn't exceed ISP limits.\n> +\t\t *\n> +\t\t * As 'resolution' is the largest sensor resolution\n> +\t\t * supported by the ISP, CameraSensor::getFormat() will never\n> +\t\t * return a V4L2SubdeviceFormat with a larger size.\n>  \t\t */\n>  \t\tuint32_t mbusCode = formatToMediaBus.at(cfg->pixelFormat);\n> +\t\tcfg->size.boundTo(resolution);\n> +\n>  \t\tSize rawSize = sensorConfig ? sensorConfig->outputSize\n>  \t\t\t\t\t    : cfg->size;\n>  \n> -- \n> 2.45.2\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 90E21C32E0\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  9 Oct 2024 11:00:46 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7327E63538;\n\tWed,  9 Oct 2024 13:00:45 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 86F13618C5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  9 Oct 2024 13:00:44 +0200 (CEST)","from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:749:b3f1:dbb0:6c33])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id EAD742EC;\n\tWed,  9 Oct 2024 12:59:06 +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=\"Qx4X7s3U\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1728471547;\n\tbh=RNDn7n3bXaXkhkxThtl8ijMOSGWavbJ0cn/Qqwmto6M=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=Qx4X7s3U0zqSjMreYah9v79t8jBBcPYTbP0LIu/va4bvUmdkihI0lvzuSLIxB3oCd\n\t/dvTVr0FGgIOf5R4CM2U1RBOHb+IzhHf8v3x0yKnaCEYFuN+FlPkTi1w2IPWQ3z3oj\n\tB+HvfFtcIniNu5hyF0J0xuT1k0KLARIGf0vGg9LM=","Date":"Wed, 9 Oct 2024 13:00:41 +0200","From":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"Umang Jain <umang.jain@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org, \n\tJacopo Mondi <jacopo.mondi@ideasonboard.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>","Subject":"Re: [PATCH v2] libcamera: rkisp1: Clamp stream configuration to ISP\n\tlimit on raw path","Message-ID":"<dcoyqmk5pjwregkpeomr6sclpxylpyl2ivxc34yzf7e5jatcni@3n7fdemdg7g6>","References":"<20241009093919.391662-1-umang.jain@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20241009093919.391662-1-umang.jain@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":31642,"web_url":"https://patchwork.libcamera.org/comment/31642/","msgid":"<172847467532.532453.15366343911605945920@ping.linuxembedded.co.uk>","date":"2024-10-09T11:51:15","subject":"Re: [PATCH v2] libcamera: rkisp1: Clamp stream configuration to ISP\n\tlimit on raw path","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Stefan Klug (2024-10-09 12:00:41)\n> Hi Umang,\n> \n> Thank you for the patch. \n> \n> On Wed, Oct 09, 2024 at 03:09:19PM +0530, Umang Jain wrote:\n> > Commit 761545407c76 (\"pipeline: rkisp1: Filter out sensor sizes not\n> > supported by the pipeline\") introduced a mechanism to determine maximum\n> > supported sensor resolution and filter out resolutions that cannot be\n> > supported by the ISP.\n> > \n> > However, it missed to update the raw stream configuration path, where\n> > it should have clamped the raw stream configuration size to the maximum\n> > sensor supported resolution.\n> > \n> > This patch fixes the above issue and can be confirmed with IMX283\n> > on i.MX8MP:\n> > \n> > From:\n> > ($) cam -c1 -srole=raw,width=5472,height=3072\n> > INFO Camera camera.cpp:1197 configuring streams: (0) 5472x3648-SRGGB12\n> > ERROR RkISP1 rkisp1_path.cpp:425 Unable to configure capture in 5472x3648-SRGGB12\n> > Failed to configure camera\n> > Failed to start camera session\n> > \n> > To:\n> > ($) cam -c1 -srole=raw,width=5472,height=3072\n> > INFO Camera camera.cpp:1197 configuring streams: (0) 4096x3072-SRGGB12\n> > cam0: Capture until user interrupts by SIGINT\n> > 536.082380 (0.00 fps) cam0-stream0 seq: 000000 bytesused: 25165824\n> > 536.182378 (10.00 fps) cam0-stream0 seq: 000001 bytesused: 25165824\n> > 536.282375 (10.00 fps) cam0-stream0 seq: 000002 bytesused: 25165824\n> > ...\n> > \n> > Fixes: 761545407c76 (\"pipeline: rkisp1: Filter out sensor sizes not supported by the pipeline\")\n> > Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>\n> > Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n> \n> Looks good to me.\n> \n> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> \n> \n> > ---\n> > Changes in v2:\n> > - Extend the comment on what 'resolution' var is and denote that\n> >   sensor->getFormat() will never return something greter than\n> >  'resolution'\n> > ---\n> >  src/libcamera/pipeline/rkisp1/rkisp1_path.cpp | 8 +++++++-\n> >  1 file changed, 7 insertions(+), 1 deletion(-)\n> > \n> > diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\n> > index 3b5bea96..1999094e 100644\n> > --- a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\n> > +++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\n> > @@ -326,9 +326,15 @@ RkISP1Path::validate(const CameraSensor *sensor,\n> >       if (isRaw) {\n> >               /*\n> >                * Use the sensor output size closest to the requested stream\n> > -              * size.\n> > +              * size while ensuring the output size doesn't exceed ISP limits.\n> > +              *\n> > +              * As 'resolution' is the largest sensor resolution\n> > +              * supported by the ISP, CameraSensor::getFormat() will never\n> > +              * return a V4L2SubdeviceFormat with a larger size.\n> >                */\n> >               uint32_t mbusCode = formatToMediaBus.at(cfg->pixelFormat);\n> > +             cfg->size.boundTo(resolution);\n> > +\n\nI wonder if 'resolution' should be better named, but I think this is\nfine now.\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> >               Size rawSize = sensorConfig ? sensorConfig->outputSize\n> >                                           : cfg->size;\n> >  \n> > -- \n> > 2.45.2\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 58114C32E0\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  9 Oct 2024 11:51:21 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8C7B463538;\n\tWed,  9 Oct 2024 13:51:20 +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 D153F618C5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  9 Oct 2024 13:51:18 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 3D0EC594;\n\tWed,  9 Oct 2024 13:49:41 +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=\"Kvi7RGH3\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1728474581;\n\tbh=h4085qDD8ZDvGopbCl6z7MoSTGPIjLNfBki25E69Bnc=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=Kvi7RGH3hLUbr52MnNGfWNPWvdwyu/MhRC9Nu8Jw5GERDN0FS95yyXG5wN/+bdxkP\n\tnRh2g9A3eXl/OUuwt2srzhrkyMgN/QCe8lvc0ZztZJGoRfMaHw+VnOwuI4nDyIQoTT\n\t5LgFMmQ1bYJCt6xMbQK2aq+gVeJzcQ00cQOhFN1o=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<dcoyqmk5pjwregkpeomr6sclpxylpyl2ivxc34yzf7e5jatcni@3n7fdemdg7g6>","References":"<20241009093919.391662-1-umang.jain@ideasonboard.com>\n\t<dcoyqmk5pjwregkpeomr6sclpxylpyl2ivxc34yzf7e5jatcni@3n7fdemdg7g6>","Subject":"Re: [PATCH v2] libcamera: rkisp1: Clamp stream configuration to ISP\n\tlimit on raw path","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org,\n\tJacopo Mondi <jacopo.mondi@ideasonboard.com>","To":"Stefan Klug <stefan.klug@ideasonboard.com>,\n\tUmang Jain <umang.jain@ideasonboard.com>","Date":"Wed, 09 Oct 2024 12:51:15 +0100","Message-ID":"<172847467532.532453.15366343911605945920@ping.linuxembedded.co.uk>","User-Agent":"alot/0.10","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>"}}]