Only 2 CWB is supported in topology currently. Expand to 4 CWB with dedicated CWB counter to support quad-pipe use case.
Signed-off-by: Jun Nie <[email protected]> --- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 4 +++- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 2 +- drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c | 7 ++++++- drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h | 1 + 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c index 09563a766390..7ac2cdbce8de 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c @@ -1423,7 +1423,6 @@ static struct msm_display_topology dpu_crtc_get_topology( if (topology.num_intf == 2) { if (dpu_use_virtual_planes && caps->has_3d_merge && - !topology.cwb_enabled && (mode->hdisplay > 2 * caps->max_mixer_width || mode_rate > 2 * dpu_kms->perf.max_core_clk_rate)) topology.num_lm = 4; @@ -1443,6 +1442,9 @@ static struct msm_display_topology dpu_crtc_get_topology( if (dsc) topology.num_dsc = topology.num_lm; + if (topology.cwb_enabled) + topology.num_cwb = topology.num_lm; + if (crtc_state->ctm || crtc_state->gamma_lut) topology.num_dspp = topology.num_lm; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c index d455845ba14b..11eae4b19684 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -56,7 +56,7 @@ (MAX_H_TILES_PER_DISPLAY * NUM_PHYS_ENCODER_TYPES) #define MAX_CHANNELS_PER_ENC 4 -#define MAX_CWB_PER_ENC 2 +#define MAX_CWB_PER_ENC MAX_CHANNELS_PER_ENC #define IDLE_SHORT_TIMEOUT 1 diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c index 4ada16cf8610..9519cc59e9f3 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c @@ -240,12 +240,17 @@ static int _dpu_rm_reserve_cwb_mux_and_pingpongs(struct dpu_rm *rm, uint32_t crtc_id, struct msm_display_topology *topology) { - int num_cwb_mux = topology->num_lm, cwb_mux_count = 0; + int num_cwb_mux = topology->num_cwb, cwb_mux_count = 0; int cwb_pp_start_idx = PINGPONG_CWB_0 - PINGPONG_0; int cwb_pp_idx[MAX_BLOCKS]; int cwb_mux_idx[MAX_BLOCKS]; int cwb_mux_idx_start = 0; + if (!topology->num_cwb) { + DPU_ERROR("invalid number of cwb: %d\n", topology->num_cwb); + return -EINVAL; + } + /* * Reserve additional dedicated CWB PINGPONG blocks and muxes for each * mixer diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h index ccd64404f12d..9b2ea51608de 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h @@ -62,6 +62,7 @@ struct msm_display_topology { u32 num_intf; u32 num_dspp; u32 num_dsc; + u32 num_cwb; int num_cdm; bool cwb_enabled; }; -- 2.53.0
