From b1c9d65e3d63c44ce14edc72a9a6aa5d75cca333 Mon Sep 17 00:00:00 2001 From: Veera Sundaram Sankaran Date: Thu, 24 Oct 2019 16:49:42 -0700 Subject: [PATCH] disp: msm: sde: fix video mode prefill lines for RSCC The RSCC static wakeup and the bandwidth trigger for the downvotes are based on the prefill lines. Reduce the prefill lines based on the panel vertical front porch to avoid issuing bw downvotes during active region of the previous frame. Change-Id: I408209ba308c32e71d9f70c5ed7e60c134877c84 Signed-off-by: Veera Sundaram Sankaran --- msm/sde/sde_encoder.c | 26 +++++++++++++++++++++----- msm/sde_rsc.c | 3 +-- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/msm/sde/sde_encoder.c b/msm/sde/sde_encoder.c index 6dba660106e0..8f45613653a7 100644 --- a/msm/sde/sde_encoder.c +++ b/msm/sde/sde_encoder.c @@ -1928,11 +1928,13 @@ static int _sde_encoder_update_rsc_client( struct drm_crtc *crtc; enum sde_rsc_state rsc_state = SDE_RSC_IDLE_STATE; struct sde_rsc_cmd_config *rsc_config; - int ret, prefill_lines; + int ret; struct msm_display_info *disp_info; struct msm_mode_info *mode_info; int wait_vblank_crtc_id = SDE_RSC_INVALID_CRTC_ID; - u32 qsync_mode = 0; + u32 qsync_mode = 0, v_front_porch; + struct drm_display_mode *mode; + bool is_vid_mode; if (!drm_enc || !drm_enc->dev) { SDE_ERROR("invalid encoder arguments\n"); @@ -1977,17 +1979,31 @@ static int _sde_encoder_update_rsc_client( SDE_EVT32(rsc_state, qsync_mode); - prefill_lines = mode_info->prefill_lines; + is_vid_mode = sde_encoder_check_curr_mode(&sde_enc->base, + MSM_DISPLAY_VIDEO_MODE); + mode = &sde_enc->crtc->state->mode; + v_front_porch = mode->vsync_start - mode->vdisplay; /* compare specific items and reconfigure the rsc */ if ((rsc_config->fps != mode_info->frame_rate) || (rsc_config->vtotal != mode_info->vtotal) || - (rsc_config->prefill_lines != prefill_lines) || + (rsc_config->prefill_lines != mode_info->prefill_lines) || (rsc_config->jitter_numer != mode_info->jitter_numer) || (rsc_config->jitter_denom != mode_info->jitter_denom)) { + rsc_config->fps = mode_info->frame_rate; rsc_config->vtotal = mode_info->vtotal; - rsc_config->prefill_lines = prefill_lines; + /* + * for video mode, prefill lines should not go beyond vertical + * front porch for RSCC configuration. This will ensure bw + * downvotes are not sent within the active region. Additional + * -1 is to give one line time for rscc mode min_threshold. + */ + if (is_vid_mode && (mode_info->prefill_lines >= v_front_porch)) + rsc_config->prefill_lines = v_front_porch - 1; + else + rsc_config->prefill_lines = mode_info->prefill_lines; + rsc_config->jitter_numer = mode_info->jitter_numer; rsc_config->jitter_denom = mode_info->jitter_denom; sde_enc->rsc_state_init = false; diff --git a/msm/sde_rsc.c b/msm/sde_rsc.c index f60b7e4fe4e8..9e8710494492 100644 --- a/msm/sde_rsc.c +++ b/msm/sde_rsc.c @@ -311,8 +311,7 @@ static u32 sde_rsc_timer_calculate(struct sde_rsc_priv *rsc, default_prefill_lines = (rsc->cmd_config.fps * DEFAULT_PANEL_MIN_V_PREFILL) / DEFAULT_PANEL_FPS; - if ((state == SDE_RSC_CMD_STATE) || - (rsc->cmd_config.prefill_lines < default_prefill_lines)) + if ((state == SDE_RSC_CMD_STATE) || !rsc->cmd_config.prefill_lines) rsc->cmd_config.prefill_lines = default_prefill_lines; pr_debug("frame fps:%d jitter_numer:%d jitter_denom:%d vtotal:%d prefill lines:%d\n",