diff --git a/msm/sde/sde_encoder_phys_wb.c b/msm/sde/sde_encoder_phys_wb.c index 4805ee9391..d2db4b3024 100644 --- a/msm/sde/sde_encoder_phys_wb.c +++ b/msm/sde/sde_encoder_phys_wb.c @@ -551,6 +551,7 @@ static void _sde_encoder_phys_wb_setup_cwb(struct sde_encoder_phys *phys_enc, bo struct sde_hw_pingpong *hw_pp = phys_enc->hw_pp; struct sde_hw_dnsc_blur *hw_dnsc_blur = phys_enc->hw_dnsc_blur; bool need_merge = (crtc->num_mixers > 1); + enum sde_dcwb; int i = 0; const int num_wb = 1; @@ -575,10 +576,13 @@ static void _sde_encoder_phys_wb_setup_cwb(struct sde_encoder_phys *phys_enc, bo intf_cfg.wb_count = num_wb; intf_cfg.wb[0] = hw_wb->idx; - for (i = 0; i < crtc->num_mixers; i++) - intf_cfg.cwb[intf_cfg.cwb_count++] = (enum sde_cwb) - (test_bit(SDE_WB_DCWB_CTRL, &hw_wb->caps->features) ? - ((hw_pp->idx % 2) + i) : (hw_pp->idx + i)); + for (i = 0; i < crtc->num_mixers; i++) { + if (test_bit(SDE_WB_DCWB_CTRL, &hw_wb->caps->features)) + intf_cfg.cwb[intf_cfg.cwb_count++] = + (enum sde_cwb)(hw_pp->dcwb_idx + i); + else + intf_cfg.cwb[intf_cfg.cwb_count++] = (enum sde_cwb)(hw_pp->idx + i); + } if (hw_pp->merge_3d && (intf_cfg.merge_3d_count < MAX_MERGE_3D_PER_CTL_V1) && need_merge) @@ -1275,7 +1279,7 @@ static void _sde_encoder_phys_wb_update_cwb_flush(struct sde_encoder_phys *phys_ struct sde_hw_dnsc_blur *hw_dnsc_blur; struct sde_crtc *crtc; struct sde_crtc_state *crtc_state; - int i = 0, cwb_capture_mode = 0; + int cwb_capture_mode = 0; enum sde_cwb cwb_idx = 0; enum sde_dcwb dcwb_idx = 0; enum sde_cwb src_pp_idx = 0; @@ -1312,7 +1316,7 @@ static void _sde_encoder_phys_wb_update_cwb_flush(struct sde_encoder_phys *phys_ need_merge = (crtc->num_mixers > 1) ? true : false; if (test_bit(SDE_WB_DCWB_CTRL, &hw_wb->caps->features)) { - dcwb_idx = (enum sde_dcwb) ((hw_pp->idx % 2) + i); + dcwb_idx = hw_pp->dcwb_idx; if ((dcwb_idx + crtc->num_mixers) > DCWB_MAX) { SDE_ERROR("[enc:%d, wb:%d] invalid DCWB config; dcwb=%d, num_lm=%d\n", DRMID(phys_enc->parent), WBID(wb_enc), dcwb_idx, crtc->num_mixers); diff --git a/msm/sde/sde_hw_catalog.c b/msm/sde/sde_hw_catalog.c index 3c246d87e9..1e02abd6d2 100644 --- a/msm/sde/sde_hw_catalog.c +++ b/msm/sde/sde_hw_catalog.c @@ -3885,6 +3885,7 @@ static int sde_pp_parse_dt(struct device_node *np, struct sde_mdss_cfg *sde_cfg) if (test_bit(SDE_FEATURE_DEDICATED_CWB, sde_cfg->features)) sde_cfg->dcwb_count++; } + pp->dcwb_id = (sde_cfg->dcwb_count > 0) ? sde_cfg->dcwb_count : DCWB_MAX; if (major_version < SDE_HW_MAJOR(SDE_HW_VER_700)) { sblk->dsc.base = PROP_VALUE_ACCESS(prop_value, diff --git a/msm/sde/sde_hw_catalog.h b/msm/sde/sde_hw_catalog.h index 623a981b3b..49b133f832 100644 --- a/msm/sde/sde_hw_catalog.h +++ b/msm/sde/sde_hw_catalog.h @@ -1353,11 +1353,13 @@ struct sde_ds_cfg { * @features bit mask identifying sub-blocks/features * @sblk sub-blocks information * @merge_3d_id merge_3d block id + * @dcwb: ID of DCWB, DCWB_MAX if invalid */ struct sde_pingpong_cfg { SDE_HW_BLK_INFO; const struct sde_pingpong_sub_blks *sblk; int merge_3d_id; + u32 dcwb_id; }; /** diff --git a/msm/sde/sde_hw_pingpong.c b/msm/sde/sde_hw_pingpong.c index e6af74943d..2250950de1 100644 --- a/msm/sde/sde_hw_pingpong.c +++ b/msm/sde/sde_hw_pingpong.c @@ -515,6 +515,7 @@ struct sde_hw_blk_reg_map *sde_hw_pingpong_init(enum sde_pingpong idx, c->idx = idx; c->caps = cfg; + c->dcwb_idx = cfg->dcwb_id; if (test_bit(SDE_PINGPONG_MERGE_3D, &cfg->features)) { c->merge_3d = _sde_pp_merge_3d_init(cfg->merge_3d_id, addr, m); if (IS_ERR(c->merge_3d)) { diff --git a/msm/sde/sde_hw_pingpong.h b/msm/sde/sde_hw_pingpong.h index ca83172561..ea86eefa07 100644 --- a/msm/sde/sde_hw_pingpong.h +++ b/msm/sde/sde_hw_pingpong.h @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) 2015-2021, The Linux Foundation. All rights reserved. */ @@ -163,6 +164,9 @@ struct sde_hw_pingpong { enum sde_pingpong idx; const struct sde_pingpong_cfg *caps; + /* associated dcwb idx */ + enum sde_dcwb dcwb_idx; + /* associated 3d_merge */ struct sde_hw_merge_3d *merge_3d;