diff --git a/msm/sde/sde_encoder_phys_vid.c b/msm/sde/sde_encoder_phys_vid.c index 7a156c7bd2..7e444aa4dc 100644 --- a/msm/sde/sde_encoder_phys_vid.c +++ b/msm/sde/sde_encoder_phys_vid.c @@ -205,6 +205,7 @@ static u32 programmable_fetch_get_num_lines( const struct intf_timing_params *timing) { struct sde_encoder_phys *phys_enc = &vid_enc->base; + struct sde_mdss_cfg *m; u32 needed_prefill_lines, needed_vfp_lines, actual_vfp_lines; const u32 fixed_prefill_fps = DEFAULT_FPS; @@ -213,18 +214,23 @@ static u32 programmable_fetch_get_num_lines( u32 start_of_frame_lines = timing->v_back_porch + timing->vsync_pulse_width; u32 v_front_porch = timing->v_front_porch; + u32 vrefresh, max_fps; + + m = phys_enc->sde_kms->catalog; + max_fps = sde_encoder_get_dfps_maxfps(phys_enc->parent); + vrefresh = (max_fps > timing->vrefresh) ? max_fps : timing->vrefresh; /* minimum prefill lines are defined based on 60fps */ - needed_prefill_lines = (timing->vrefresh > fixed_prefill_fps) ? - ((default_prefill_lines * timing->vrefresh) / + needed_prefill_lines = (vrefresh > fixed_prefill_fps) ? + ((default_prefill_lines * vrefresh) / fixed_prefill_fps) : default_prefill_lines; needed_vfp_lines = needed_prefill_lines - start_of_frame_lines; /* Fetch must be outside active lines, otherwise undefined. */ if (start_of_frame_lines >= needed_prefill_lines) { SDE_DEBUG_VIDENC(vid_enc, - "prog fetch is not needed, large vbp+vsw\n"); - actual_vfp_lines = 0; + "prog fetch always enabled case\n"); + actual_vfp_lines = (m->delay_prg_fetch_start) ? 2 : 1; } else if (v_front_porch < needed_vfp_lines) { /* Warn fetch needed, but not enough porch in panel config */ pr_warn_once @@ -239,7 +245,7 @@ static u32 programmable_fetch_get_num_lines( SDE_DEBUG_VIDENC(vid_enc, "vrefresh:%u v_front_porch:%u v_back_porch:%u vsync_pulse_width:%u\n", - timing->vrefresh, v_front_porch, timing->v_back_porch, + vrefresh, v_front_porch, timing->v_back_porch, timing->vsync_pulse_width); SDE_DEBUG_VIDENC(vid_enc, "prefill_lines:%u needed_vfp_lines:%u actual_vfp_lines:%u\n",