[{"id":22566,"web_url":"https://patchwork.libcamera.org/comment/22566/","msgid":"<fde518b9-b3d6-da59-749a-2768c5de4848@ideasonboard.com>","date":"2022-04-05T14:07:35","subject":"Re: [libcamera-devel] [PATCH] ipa: ipu3: af: enforce grid size\n\trestrictions","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/people/86/","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"content":"Hello Kieran,\n\nThank you for the patch,\n\nOn 3/31/22 17:40, Kieran Bingham via libcamera-devel wrote:\n> Provide enforcement of the selection of the block_{width,height}_log2\n> parameters to the capabilities of the hardware.\n>\n> While this selection is currently hardcoded to the minimum, providing\n> the restriction now allows for further dynamic sizing in the future and\n> documents the restrictions directly in code, making use of the already\n> existing constants.\n>\n> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n\nReviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n\n> ---\n>\n> Note, this is kept separate from my other AF improvement series, as it\n> can be applied independantly - but due to a compilation failure if\n> kAfMinGridBlockWidth, kAfMaxGridBlockWidth kAfMinGridBlockHeight, and\n> kAfMaxGridBlockHeight are not used, this patch must be applied before\n> that series can be integrated.\n>\n>   src/ipa/ipu3/algorithms/af.cpp | 16 ++++++++++++++++\n>   1 file changed, 16 insertions(+)\n>\n> diff --git a/src/ipa/ipu3/algorithms/af.cpp b/src/ipa/ipu3/algorithms/af.cpp\n> index 6c25d02ec7f0..abfaad6164f1 100644\n> --- a/src/ipa/ipu3/algorithms/af.cpp\n> +++ b/src/ipa/ipu3/algorithms/af.cpp\n> @@ -139,6 +139,22 @@ int Af::configure(IPAContext &context, const IPAConfigInfo &configInfo)\n>   \tgrid.height = kAfMinGridHeight;\n>   \tgrid.block_width_log2 = kAfMinGridBlockWidth;\n>   \tgrid.block_height_log2 = kAfMinGridBlockHeight;\n> +\n> +\t/*\n> +\t * \\todo - while this clamping code is effectively a no-op, it satisfies\n> +\t * the compiler that the definitions regarding the hardware restrictions\n> +\t * are used, and paves the way to support dynamic grid sizing in the\n> +\t * future. While the block_{width,height}_log2 remain assigned to the\n> +\t * minimum, this code should be optimized out by the compiler.\n> +\t */\n> +\tgrid.block_width_log2 = std::clamp(grid.block_width_log2,\n> +\t\t\t\t\t   kAfMinGridBlockWidth,\n> +\t\t\t\t\t   kAfMaxGridBlockWidth);\n> +\n> +\tgrid.block_height_log2 = std::clamp(grid.block_height_log2,\n> +\t\t\t\t\t    kAfMinGridBlockHeight,\n> +\t\t\t\t\t    kAfMaxGridBlockHeight);\n> +\n>   \tgrid.height_per_slice = kAfDefaultHeightPerSlice;\n>   \n>   \t/* Position the AF grid in the center of the BDS output. */","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 47C53C3256\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  5 Apr 2022 14:07:43 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AC98C6563F;\n\tTue,  5 Apr 2022 16:07:42 +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 70CBF604BB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  5 Apr 2022 16:07:40 +0200 (CEST)","from [192.168.1.110] (unknown [27.57.186.178])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 76F255D;\n\tTue,  5 Apr 2022 16:07:39 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1649167662;\n\tbh=3f0e9ncdrEKnTW18vkIy2CWOJ2RfgWtQVDGqB4xE9Lg=;\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=wsUjLgvT5ekUVkpGcPH1va4jWDul+eqa/LDj15JPn8e7eP/dQXrkzNO5MrXxd5rZh\n\tO4D9iK6ZDFG1S12u4ZoduYdNbYsAZGNhxEKNYc2DDO60VoKBaDtX8PbJ3+N7+8GbW/\n\t+kkSwRpQFVeramfbSVt8+HTjd9pwDN3RntAB/99U9R+a0nNKaS3vSSMhOuxZumxJ1K\n\tpFLZMWjOH4Yyxy1jfEgr3pgpu/C8cHmCqInmT3fsRdFSCYxOLTuibXVtzLxKcssEj7\n\tPP/i053eDcYZ0OSeLL/4to2CR4RVs7A3NQ/jMb3vgeONRZ1Qwz7zgJWkxaCSq+sBlD\n\tPuF5cahQPx1Bg==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1649167660;\n\tbh=3f0e9ncdrEKnTW18vkIy2CWOJ2RfgWtQVDGqB4xE9Lg=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=R+ZYHHFDgTQ7MdCdCtUfas6Fr/dGkvU/O2vXcCPoHu2qAQrXflzcuyl0MFRtzYFng\n\tbS98hibib2pLNP5l+d+YO2a+lnwIEvin1aA1p/0aALS1ohgdgAKaIUHl+tLrdxWhic\n\tP7GS+K9BuA4quRlCj38M1n6YGq5JO/dYYQxhoP1s="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"R+ZYHHFD\"; dkim-atps=neutral","Message-ID":"<fde518b9-b3d6-da59-749a-2768c5de4848@ideasonboard.com>","Date":"Tue, 5 Apr 2022 19:37:35 +0530","MIME-Version":"1.0","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101\n\tThunderbird/91.4.1","Content-Language":"en-US","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>,\n\tlibcamera devel <libcamera-devel@lists.libcamera.org>","References":"<20220331121032.2150025-1-kieran.bingham@ideasonboard.com>","In-Reply-To":"<20220331121032.2150025-1-kieran.bingham@ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH] ipa: ipu3: af: enforce grid size\n\trestrictions","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":22569,"web_url":"https://patchwork.libcamera.org/comment/22569/","msgid":"<YkxQYLUi/RIWds6E@pendragon.ideasonboard.com>","date":"2022-04-05T14:21:20","subject":"Re: [libcamera-devel] [PATCH] ipa: ipu3: af: enforce grid size\n\trestrictions","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Kieran,\n\nThank you for the patch.\n\nOn Thu, Mar 31, 2022 at 01:10:32PM +0100, Kieran Bingham via libcamera-devel wrote:\n> Provide enforcement of the selection of the block_{width,height}_log2\n> parameters to the capabilities of the hardware.\n> \n> While this selection is currently hardcoded to the minimum, providing\n> the restriction now allows for further dynamic sizing in the future and\n> documents the restrictions directly in code, making use of the already\n> existing constants.\n> \n> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> ---\n> \n> Note, this is kept separate from my other AF improvement series, as it\n> can be applied independantly - but due to a compilation failure if\n> kAfMinGridBlockWidth, kAfMaxGridBlockWidth kAfMinGridBlockHeight, and\n> kAfMaxGridBlockHeight are not used, this patch must be applied before\n> that series can be integrated.\n> \n>  src/ipa/ipu3/algorithms/af.cpp | 16 ++++++++++++++++\n>  1 file changed, 16 insertions(+)\n> \n> diff --git a/src/ipa/ipu3/algorithms/af.cpp b/src/ipa/ipu3/algorithms/af.cpp\n> index 6c25d02ec7f0..abfaad6164f1 100644\n> --- a/src/ipa/ipu3/algorithms/af.cpp\n> +++ b/src/ipa/ipu3/algorithms/af.cpp\n> @@ -139,6 +139,22 @@ int Af::configure(IPAContext &context, const IPAConfigInfo &configInfo)\n>  \tgrid.height = kAfMinGridHeight;\n>  \tgrid.block_width_log2 = kAfMinGridBlockWidth;\n>  \tgrid.block_height_log2 = kAfMinGridBlockHeight;\n> +\n> +\t/*\n> +\t * \\todo - while this clamping code is effectively a no-op, it satisfies\n> +\t * the compiler that the definitions regarding the hardware restrictions\n\n\"... that the definitions of the hardware limits constants are used\" ?\n\n\"satisfy ... that\" sounds a bit weird to me, but maybe it's just me.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> +\t * are used, and paves the way to support dynamic grid sizing in the\n> +\t * future. While the block_{width,height}_log2 remain assigned to the\n> +\t * minimum, this code should be optimized out by the compiler.\n> +\t */\n> +\tgrid.block_width_log2 = std::clamp(grid.block_width_log2,\n> +\t\t\t\t\t   kAfMinGridBlockWidth,\n> +\t\t\t\t\t   kAfMaxGridBlockWidth);\n> +\n> +\tgrid.block_height_log2 = std::clamp(grid.block_height_log2,\n> +\t\t\t\t\t    kAfMinGridBlockHeight,\n> +\t\t\t\t\t    kAfMaxGridBlockHeight);\n> +\n>  \tgrid.height_per_slice = kAfDefaultHeightPerSlice;\n>  \n>  \t/* Position the AF grid in the center of the BDS output. */","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 C39E3C3256\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  5 Apr 2022 14:21:24 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7C1F76563F;\n\tTue,  5 Apr 2022 16:21:24 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6C083604BB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  5 Apr 2022 16:21:23 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(117.145-247-81.adsl-dyn.isp.belgacom.be [81.247.145.117])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 0C7CA5D;\n\tTue,  5 Apr 2022 16:21:23 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1649168484;\n\tbh=go6HsUg07y4ZeLvO1E9YW+PTRad8dHyyT3ATUvR4i9M=;\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=ibKSPwqNWsBAHwBlkFCk6DLpNvi/pkM4MMRG9kIP9ykDXRj2HNmZlgZjhL9i+9dgY\n\t9OBwd8RYW9L1ewegzPBCi1D9kCzUMio67QOB9PONGFZ2WzVB6OLFlaFCMZ4IyrcaFJ\n\tavB7xqa4S1SGyHvCM2MnUAww+aunC4FqKzimvibaInwgJQ0Zvff0Wd6qbQmnxuABsd\n\t3AdhwbiVtOCnSadM1Oa7gyXYQROOOXrnoXTgr/pMgK4QaLvvFcf3DHu914wAQvmuXx\n\t5BxJzISnNJSZ08U8M+0ICky7hBTGYNWwwj8mkmLU6EB47NPW/djbrMS2wldhe1OZRW\n\tR4K1SMOcGRXxg==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1649168483;\n\tbh=go6HsUg07y4ZeLvO1E9YW+PTRad8dHyyT3ATUvR4i9M=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=tfImEQJYE14aUjdVGbZ/KtUk1JcELBhEyzwQ3aO5gRCoj+Nuca+ltsJJIib2+C4Iv\n\tgLLzvyAiIF6CXwK0whgsCO9eyOYh7GctEaDFmlEOobi+UnkDY4VFxuBMrkNez+jHIb\n\tNvST/CRNWCOqm/Gxau2G2plxWdSxOVMEO2Xa3mS0="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"tfImEQJY\"; dkim-atps=neutral","Date":"Tue, 5 Apr 2022 17:21:20 +0300","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Message-ID":"<YkxQYLUi/RIWds6E@pendragon.ideasonboard.com>","References":"<20220331121032.2150025-1-kieran.bingham@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20220331121032.2150025-1-kieran.bingham@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH] ipa: ipu3: af: enforce grid size\n\trestrictions","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":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@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>"}}]