From patchwork Tue Jul 26 14:36:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Sylvestre X-Patchwork-Id: 16799 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 8F00DC3275 for ; Tue, 26 Jul 2022 14:36:50 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 143016331B; Tue, 26 Jul 2022 16:36:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1658846210; bh=cq44WZNq0MH9EY9MPKJqmMxgjVTz9+P5Weyej4POxxs=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=P8x/oMB7rXgcVvqn2kPWT7J9oHHqlPxNz9a43a5jcPu5Ha/UBDQKAtdP/N2GgCHgg 7Q/RWq67qhF4OaA20iIEh2fwTMhx7YgPf1Naj0fmBuk3gr04edesw66FDcilkPoQaH mZ9v6+dkam3hXxU7pCMq/U1GMvL4V5Wzsm1+7/Y5k14Z7p2+lMublRl5lKM4m565Ee Ix9WFUIYWUL0lUPbKRzfIRxOqXlgV4tqg1t9z7V2FTo7sVaujm41eFFu4sGyFBsvIJ p4MLHjoN9qrfC/rlP6EIWrmIzysntvy3qauQOrCsaMyzH5T9fNflDn28fqBB7seQqT RnKpoW6EWONWQ== Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3231F60487 for ; Tue, 26 Jul 2022 16:36:45 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=baylibre-com.20210112.gappssmtp.com header.i=@baylibre-com.20210112.gappssmtp.com header.b="el4TYKv2"; dkim-atps=neutral Received: by mail-wm1-x334.google.com with SMTP id 8-20020a05600c024800b003a2fe343db1so8293769wmj.1 for ; Tue, 26 Jul 2022 07:36:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rXYLN3M+VURrLxs1TBEH4lG+n/DsAPURZjYMrvBhEAc=; b=el4TYKv2tS65bzurpJqwSIMGBgPIZI/iwEwUOP53cl+7Ru4ereEEXPgKNdhSA9DGzj tZbMyYGm5AVT80pASeF7nEONFxv49e8vuxoxSB3ebWoj0UIGiU1vCej3/s1G9AAfmi2w YUAnwruSC57GlZY59wEbjFRtP/HMxJnQGRnypYZ5KYYmIv0lWGH7sXeYcBKEUz20XSXd aRNKNYBPFQr+5yZ3Nz0B050rq7H6ax99sIiY47g0GatFxVyzdpLhxwZJJslL0185vdjJ B1+FWGCvcyY9XRBea57MbkgpEiwbvPstmVnxQACGdcYGfK6bxF3ZryaJrtEf+zhibonC pf4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rXYLN3M+VURrLxs1TBEH4lG+n/DsAPURZjYMrvBhEAc=; b=sw5ySLNhGpNR7ajTVmrt+Td3/sHsySymLoTPSLHsnkRv4/oGMgfrijxSDpT1UVt+r3 F/3MoFGPTC3H7v8bnqmjhFhB0bw9G8bJ1xgOps2qBfzKgsk3UnMCvuqjlF3ZJ1oiaFth ew5O2YiiQg3TJA8GvYsCtUOtk5VvtaXwqJZETRoQjbUWQyFnQwJm2KggGQhTU6fv0aNA Y28luF0t2lLX6gQpCDiUD9QaFVzADSFkPChhjp8m+jsEXNUBZKS230K1HWarnE1jFnZw jt1sutmOLghDeIrTUt3Daa7mD0Sm2qvAalTp8PzRgFyqUFH1h/t2dbGeUoDJWaBmQ4hd 3w8w== X-Gm-Message-State: AJIora8WP0D6GpQ9Yiuv0A/YsqQXLRTwcf5JcwafRqcrit6ync+ylab1 fzHc7RS4eGmBt0p56rxN+ypaiO5AyEJy0aDA X-Google-Smtp-Source: AGRyM1uwlGc7FtK367qjVHlduJLfvmIkBu7pvLAay6uSwMKS86wCu5UIU8grwEUIh4b/k8JpPBbODg== X-Received: by 2002:a1c:19c3:0:b0:39c:6479:3ca with SMTP id 186-20020a1c19c3000000b0039c647903camr24538001wmz.27.1658846204307; Tue, 26 Jul 2022 07:36:44 -0700 (PDT) Received: from BL087.. ([2a01:e34:eea9:e630:c7b2:2183:8a06:b4dc]) by smtp.gmail.com with ESMTPSA id m184-20020a1c26c1000000b003a04722d745sm22447386wmm.23.2022.07.26.07.36.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jul 2022 07:36:43 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Tue, 26 Jul 2022 16:36:34 +0200 Message-Id: <20220726143635.518227-5-fsylvestre@baylibre.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220726143635.518227-1-fsylvestre@baylibre.com> References: <20220726143635.518227-1-fsylvestre@baylibre.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 4/5] include: linux: Update rkisp1 kernel header for DPCC configuration X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Florian Sylvestre via libcamera-devel From: Florian Sylvestre Reply-To: Florian Sylvestre Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" To improve the kernel interface, a proposal has been made to the linux-kernel [1] to improve the configuration of the Defective Pixel Cluster Correction (DPCC). [1] https://lore.kernel.org/linux-media/20220616160456.21549-1-laurent.pinchart@ideasonboard.com/ Update the local copy of the rkisp1-config.h to match the proposal. Signed-off-by: Florian Sylvestre Acked-by: Paul Elder Reviewed-by: Laurent Pinchart --- include/linux/rkisp1-config.h | 77 +++++++++++++++++++++++++++-------- 1 file changed, 61 insertions(+), 16 deletions(-) diff --git a/include/linux/rkisp1-config.h b/include/linux/rkisp1-config.h index 9be67d63..0ed3dca8 100644 --- a/include/linux/rkisp1-config.h +++ b/include/linux/rkisp1-config.h @@ -117,7 +117,46 @@ /* * Defect Pixel Cluster Correction */ -#define RKISP1_CIF_ISP_DPCC_METHODS_MAX 3 +#define RKISP1_CIF_ISP_DPCC_METHODS_MAX 3 + +#define RKISP1_CIF_ISP_DPCC_MODE_STAGE1_ENABLE (1U << 2) + +#define RKISP1_CIF_ISP_DPCC_OUTPUT_MODE_STAGE1_INCL_G_CENTER (1U << 0) +#define RKISP1_CIF_ISP_DPCC_OUTPUT_MODE_STAGE1_INCL_RB_CENTER (1U << 1) +#define RKISP1_CIF_ISP_DPCC_OUTPUT_MODE_STAGE1_G_3X3 (1U << 2) +#define RKISP1_CIF_ISP_DPCC_OUTPUT_MODE_STAGE1_RB_3X3 (1U << 3) + +/* 0-2 for sets 1-3 */ +#define RKISP1_CIF_ISP_DPCC_SET_USE_STAGE1_USE_SET(n) ((n) << 0) +#define RKISP1_CIF_ISP_DPCC_SET_USE_STAGE1_USE_FIX_SET (1U << 3) + +#define RKISP1_CIF_ISP_DPCC_METHODS_SET_PG_GREEN_ENABLE (1U << 0) +#define RKISP1_CIF_ISP_DPCC_METHODS_SET_LC_GREEN_ENABLE (1U << 1) +#define RKISP1_CIF_ISP_DPCC_METHODS_SET_RO_GREEN_ENABLE (1U << 2) +#define RKISP1_CIF_ISP_DPCC_METHODS_SET_RND_GREEN_ENABLE (1U << 3) +#define RKISP1_CIF_ISP_DPCC_METHODS_SET_RG_GREEN_ENABLE (1U << 4) +#define RKISP1_CIF_ISP_DPCC_METHODS_SET_PG_RED_BLUE_ENABLE (1U << 8) +#define RKISP1_CIF_ISP_DPCC_METHODS_SET_LC_RED_BLUE_ENABLE (1U << 9) +#define RKISP1_CIF_ISP_DPCC_METHODS_SET_RO_RED_BLUE_ENABLE (1U << 10) +#define RKISP1_CIF_ISP_DPCC_METHODS_SET_RND_RED_BLUE_ENABLE (1U << 11) +#define RKISP1_CIF_ISP_DPCC_METHODS_SET_RG_RED_BLUE_ENABLE (1U << 12) + +#define RKISP1_CIF_ISP_DPCC_LINE_THRESH_G(v) ((v) << 0) +#define RKISP1_CIF_ISP_DPCC_LINE_THRESH_RB(v) ((v) << 8) +#define RKISP1_CIF_ISP_DPCC_LINE_MAD_FAC_G(v) ((v) << 0) +#define RKISP1_CIF_ISP_DPCC_LINE_MAD_FAC_RB(v) ((v) << 8) +#define RKISP1_CIF_ISP_DPCC_PG_FAC_G(v) ((v) << 0) +#define RKISP1_CIF_ISP_DPCC_PG_FAC_RB(v) ((v) << 8) +#define RKISP1_CIF_ISP_DPCC_RND_THRESH_G(v) ((v) << 0) +#define RKISP1_CIF_ISP_DPCC_RND_THRESH_RB(v) ((v) << 8) +#define RKISP1_CIF_ISP_DPCC_RG_FAC_G(v) ((v) << 0) +#define RKISP1_CIF_ISP_DPCC_RG_FAC_RB(v) ((v) << 8) + +#define RKISP1_CIF_ISP_DPCC_RO_LIMITS_n_G(n, v) ((v) << ((n) * 4)) +#define RKISP1_CIF_ISP_DPCC_RO_LIMITS_n_RB(n, v) ((v) << ((n) * 4 + 2)) + +#define RKISP1_CIF_ISP_DPCC_RND_OFFS_n_G(n, v) ((v) << ((n) * 4)) +#define RKISP1_CIF_ISP_DPCC_RND_OFFS_n_RB(n, v) ((v) << ((n) * 4 + 2)) /* * Denoising pre filter @@ -250,16 +289,20 @@ struct rkisp1_cif_isp_bls_config { }; /** - * struct rkisp1_cif_isp_dpcc_methods_config - Methods Configuration used by DPCC + * struct rkisp1_cif_isp_dpcc_methods_config - DPCC methods set configuration * - * Methods Configuration used by Defect Pixel Cluster Correction + * This structure stores the configuration of one set of methods for the DPCC + * algorithm. Multiple methods can be selected in each set (independently for + * the Green and Red/Blue components) through the @method field, the result is + * the logical AND of all enabled methods. The remaining fields set thresholds + * and factors for each method. * - * @method: Method enable bits - * @line_thresh: Line threshold - * @line_mad_fac: Line MAD factor - * @pg_fac: Peak gradient factor - * @rnd_thresh: Rank Neighbor Difference threshold - * @rg_fac: Rank gradient factor + * @method: Method enable bits (RKISP1_CIF_ISP_DPCC_METHODS_SET_*) + * @line_thresh: Line threshold (RKISP1_CIF_ISP_DPCC_LINE_THRESH_*) + * @line_mad_fac: Line Mean Absolute Difference factor (RKISP1_CIF_ISP_DPCC_LINE_MAD_FAC_*) + * @pg_fac: Peak gradient factor (RKISP1_CIF_ISP_DPCC_PG_FAC_*) + * @rnd_thresh: Rank Neighbor Difference threshold (RKISP1_CIF_ISP_DPCC_RND_THRESH_*) + * @rg_fac: Rank gradient factor (RKISP1_CIF_ISP_DPCC_RG_FAC_*) */ struct rkisp1_cif_isp_dpcc_methods_config { __u32 method; @@ -273,14 +316,16 @@ struct rkisp1_cif_isp_dpcc_methods_config { /** * struct rkisp1_cif_isp_dpcc_config - Configuration used by DPCC * - * Configuration used by Defect Pixel Cluster Correction + * Configuration used by Defect Pixel Cluster Correction. Three sets of methods + * can be configured and selected through the @set_use field. The result is the + * logical OR of all enabled sets. * - * @mode: dpcc output mode - * @output_mode: whether use hard coded methods - * @set_use: stage1 methods set - * @methods: methods config - * @ro_limits: rank order limits - * @rnd_offs: differential rank offsets for rank neighbor difference + * @mode: DPCC mode (RKISP1_CIF_ISP_DPCC_MODE_*) + * @output_mode: Interpolation output mode (RKISP1_CIF_ISP_DPCC_OUTPUT_MODE_*) + * @set_use: Methods sets selection (RKISP1_CIF_ISP_DPCC_SET_USE_*) + * @methods: Methods sets configuration + * @ro_limits: Rank order limits (RKISP1_CIF_ISP_DPCC_RO_LIMITS_*) + * @rnd_offs: Differential rank offsets for rank neighbor difference (RKISP1_CIF_ISP_DPCC_RND_OFFS_*) */ struct rkisp1_cif_isp_dpcc_config { __u32 mode;