[{"id":24085,"web_url":"https://patchwork.libcamera.org/comment/24085/","msgid":"<Yt24sczF2brlfMW/@pendragon.ideasonboard.com>","date":"2022-07-24T21:25:05","subject":"Re: [libcamera-devel] [PATCH v2 4/5] include: linux: Update rkisp1\n\tkernel header for DPCC configuration","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Florian,\n\nThank you for the patch.\n\nOn Fri, Jul 22, 2022 at 05:16:34PM +0200, Florian Sylvestre via libcamera-devel wrote:\n> To improve the kernel interface, a proposal has been made to the\n> linux-kernel [1] to improve the configuration of the Defective\n> Pixel Cluster Correction (DPCC).\n> \n> [1] https://lore.kernel.org/linux-media/20220616160456.21549-1-laurent.pinchart@ideasonboard.com/\n> \n> Update the local copy of the rkisp1-config.h to match the proposal.\n> \n> Signed-off-by: Florian Sylvestre <fsylvestre@baylibre.com>\n> Acked-by: Paul Elder <paul.elder@ideasonboard.com>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n>  include/linux/rkisp1-config.h | 77 +++++++++++++++++++++++++++--------\n>  1 file changed, 61 insertions(+), 16 deletions(-)\n> \n> diff --git a/include/linux/rkisp1-config.h b/include/linux/rkisp1-config.h\n> index 9be67d63..0ed3dca8 100644\n> --- a/include/linux/rkisp1-config.h\n> +++ b/include/linux/rkisp1-config.h\n> @@ -117,7 +117,46 @@\n>  /*\n>   * Defect Pixel Cluster Correction\n>   */\n> -#define RKISP1_CIF_ISP_DPCC_METHODS_MAX       3\n> +#define RKISP1_CIF_ISP_DPCC_METHODS_MAX\t\t\t\t3\n> +\n> +#define RKISP1_CIF_ISP_DPCC_MODE_STAGE1_ENABLE\t\t\t(1U << 2)\n> +\n> +#define RKISP1_CIF_ISP_DPCC_OUTPUT_MODE_STAGE1_INCL_G_CENTER\t(1U << 0)\n> +#define RKISP1_CIF_ISP_DPCC_OUTPUT_MODE_STAGE1_INCL_RB_CENTER\t(1U << 1)\n> +#define RKISP1_CIF_ISP_DPCC_OUTPUT_MODE_STAGE1_G_3X3\t\t(1U << 2)\n> +#define RKISP1_CIF_ISP_DPCC_OUTPUT_MODE_STAGE1_RB_3X3\t\t(1U << 3)\n> +\n> +/* 0-2 for sets 1-3 */\n> +#define RKISP1_CIF_ISP_DPCC_SET_USE_STAGE1_USE_SET(n)\t\t((n) << 0)\n> +#define RKISP1_CIF_ISP_DPCC_SET_USE_STAGE1_USE_FIX_SET\t\t(1U << 3)\n> +\n> +#define RKISP1_CIF_ISP_DPCC_METHODS_SET_PG_GREEN_ENABLE\t\t(1U << 0)\n> +#define RKISP1_CIF_ISP_DPCC_METHODS_SET_LC_GREEN_ENABLE\t\t(1U << 1)\n> +#define RKISP1_CIF_ISP_DPCC_METHODS_SET_RO_GREEN_ENABLE\t\t(1U << 2)\n> +#define RKISP1_CIF_ISP_DPCC_METHODS_SET_RND_GREEN_ENABLE\t(1U << 3)\n> +#define RKISP1_CIF_ISP_DPCC_METHODS_SET_RG_GREEN_ENABLE\t\t(1U << 4)\n> +#define RKISP1_CIF_ISP_DPCC_METHODS_SET_PG_RED_BLUE_ENABLE\t(1U << 8)\n> +#define RKISP1_CIF_ISP_DPCC_METHODS_SET_LC_RED_BLUE_ENABLE\t(1U << 9)\n> +#define RKISP1_CIF_ISP_DPCC_METHODS_SET_RO_RED_BLUE_ENABLE\t(1U << 10)\n> +#define RKISP1_CIF_ISP_DPCC_METHODS_SET_RND_RED_BLUE_ENABLE\t(1U << 11)\n> +#define RKISP1_CIF_ISP_DPCC_METHODS_SET_RG_RED_BLUE_ENABLE\t(1U << 12)\n> +\n> +#define RKISP1_CIF_ISP_DPCC_LINE_THRESH_G(v)\t\t\t((v) << 0)\n> +#define RKISP1_CIF_ISP_DPCC_LINE_THRESH_RB(v)\t\t\t((v) << 8)\n> +#define RKISP1_CIF_ISP_DPCC_LINE_MAD_FAC_G(v)\t\t\t((v) << 0)\n> +#define RKISP1_CIF_ISP_DPCC_LINE_MAD_FAC_RB(v)\t\t\t((v) << 8)\n> +#define RKISP1_CIF_ISP_DPCC_PG_FAC_G(v)\t\t\t\t((v) << 0)\n> +#define RKISP1_CIF_ISP_DPCC_PG_FAC_RB(v)\t\t\t((v) << 8)\n> +#define RKISP1_CIF_ISP_DPCC_RND_THRESH_G(v)\t\t\t((v) << 0)\n> +#define RKISP1_CIF_ISP_DPCC_RND_THRESH_RB(v)\t\t\t((v) << 8)\n> +#define RKISP1_CIF_ISP_DPCC_RG_FAC_G(v)\t\t\t\t((v) << 0)\n> +#define RKISP1_CIF_ISP_DPCC_RG_FAC_RB(v)\t\t\t((v) << 8)\n> +\n> +#define RKISP1_CIF_ISP_DPCC_RO_LIMITS_n_G(n, v)\t\t\t((v) << ((n) * 4))\n> +#define RKISP1_CIF_ISP_DPCC_RO_LIMITS_n_RB(n, v)\t\t((v) << ((n) * 4 + 2))\n> +\n> +#define RKISP1_CIF_ISP_DPCC_RND_OFFS_n_G(n, v)\t\t\t((v) << ((n) * 4))\n> +#define RKISP1_CIF_ISP_DPCC_RND_OFFS_n_RB(n, v)\t\t\t((v) << ((n) * 4 + 2))\n>  \n>  /*\n>   * Denoising pre filter\n> @@ -250,16 +289,20 @@ struct rkisp1_cif_isp_bls_config {\n>  };\n>  \n>  /**\n> - * struct rkisp1_cif_isp_dpcc_methods_config - Methods Configuration used by DPCC\n> + * struct rkisp1_cif_isp_dpcc_methods_config - DPCC methods set configuration\n>   *\n> - * Methods Configuration used by Defect Pixel Cluster Correction\n> + * This structure stores the configuration of one set of methods for the DPCC\n> + * algorithm. Multiple methods can be selected in each set (independently for\n> + * the Green and Red/Blue components) through the @method field, the result is\n> + * the logical AND of all enabled methods. The remaining fields set thresholds\n> + * and factors for each method.\n>   *\n> - * @method: Method enable bits\n> - * @line_thresh: Line threshold\n> - * @line_mad_fac: Line MAD factor\n> - * @pg_fac: Peak gradient factor\n> - * @rnd_thresh: Rank Neighbor Difference threshold\n> - * @rg_fac: Rank gradient factor\n> + * @method: Method enable bits (RKISP1_CIF_ISP_DPCC_METHODS_SET_*)\n> + * @line_thresh: Line threshold (RKISP1_CIF_ISP_DPCC_LINE_THRESH_*)\n> + * @line_mad_fac: Line Mean Absolute Difference factor (RKISP1_CIF_ISP_DPCC_LINE_MAD_FAC_*)\n> + * @pg_fac: Peak gradient factor (RKISP1_CIF_ISP_DPCC_PG_FAC_*)\n> + * @rnd_thresh: Rank Neighbor Difference threshold (RKISP1_CIF_ISP_DPCC_RND_THRESH_*)\n> + * @rg_fac: Rank gradient factor (RKISP1_CIF_ISP_DPCC_RG_FAC_*)\n>   */\n>  struct rkisp1_cif_isp_dpcc_methods_config {\n>  \t__u32 method;\n> @@ -273,14 +316,16 @@ struct rkisp1_cif_isp_dpcc_methods_config {\n>  /**\n>   * struct rkisp1_cif_isp_dpcc_config - Configuration used by DPCC\n>   *\n> - * Configuration used by Defect Pixel Cluster Correction\n> + * Configuration used by Defect Pixel Cluster Correction. Three sets of methods\n> + * can be configured and selected through the @set_use field. The result is the\n> + * logical OR of all enabled sets.\n>   *\n> - * @mode: dpcc output mode\n> - * @output_mode: whether use hard coded methods\n> - * @set_use: stage1 methods set\n> - * @methods: methods config\n> - * @ro_limits: rank order limits\n> - * @rnd_offs: differential rank offsets for rank neighbor difference\n> + * @mode: DPCC mode (RKISP1_CIF_ISP_DPCC_MODE_*)\n> + * @output_mode: Interpolation output mode (RKISP1_CIF_ISP_DPCC_OUTPUT_MODE_*)\n> + * @set_use: Methods sets selection (RKISP1_CIF_ISP_DPCC_SET_USE_*)\n> + * @methods: Methods sets configuration\n> + * @ro_limits: Rank order limits (RKISP1_CIF_ISP_DPCC_RO_LIMITS_*)\n> + * @rnd_offs: Differential rank offsets for rank neighbor difference (RKISP1_CIF_ISP_DPCC_RND_OFFS_*)\n>   */\n>  struct rkisp1_cif_isp_dpcc_config {\n>  \t__u32 mode;","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 B2B0EC3275\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 24 Jul 2022 21:25:10 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6512163312;\n\tSun, 24 Jul 2022 23:25:10 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 00ED66330B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 24 Jul 2022 23:25:09 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 87E25898;\n\tSun, 24 Jul 2022 23:25:08 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1658697910;\n\tbh=OoaB4LOp2Yf68aFdM7nZqzYFuXFAUKuK6cH/qJXH2Nw=;\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=rod3Wy4oatK34o1ykz2zO3kYgz8lKttO761sxkGG5Gb4oTVSzW5kcsOzY63f2A3u+\n\toHLXsuR3zdHNdAdVri/4b8Q+/X43hIWOnQeRJFzB8c5MBk/6Qnn9Wq3oNheZ+ZiohJ\n\tPSUW/sKEBtJcVggCGXfAkt6ihy2YFppkOWVxVzmi7rv0YObpbVT8QOFudjiIzBkycJ\n\tF+0hKhPq3Zgiw5wKWh5ddDYQVzDrTzDL/+GcN4HtkmUppD++y5nv4Lb9OnVicIQDmV\n\tFquFAfbyrh1PJritC8k7muW8xxie5Hn3B3dUKORomzNtEcM62TM67yI6ZV/WqMvxEY\n\tWp08brKOOxGLw==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1658697908;\n\tbh=OoaB4LOp2Yf68aFdM7nZqzYFuXFAUKuK6cH/qJXH2Nw=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=gAAt5nsL0f/lfGQPpRlxFTYmwan1+m9M0hmmVHcHTvqWK3JdXK+GLxMcD+wksY20g\n\tBcmch8Ay+HkgF2kZ536ktmcfWOMvev5ARFprSNZkZ0qn3w/9J9I+VCiF2Fe4EtgLo2\n\trulYHXRIKwhZ+ndn2obzBUKv0cDh/ApQpVii7FBs="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"gAAt5nsL\"; dkim-atps=neutral","Date":"Mon, 25 Jul 2022 00:25:05 +0300","To":"Florian Sylvestre <fsylvestre@baylibre.com>","Message-ID":"<Yt24sczF2brlfMW/@pendragon.ideasonboard.com>","References":"<20220722151635.239221-1-fsylvestre@baylibre.com>\n\t<20220722151635.239221-5-fsylvestre@baylibre.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20220722151635.239221-5-fsylvestre@baylibre.com>","Subject":"Re: [libcamera-devel] [PATCH v2 4/5] include: linux: Update rkisp1\n\tkernel header for DPCC configuration","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@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]