Эх сурвалжийг харах

disp: msm: sde: always enable prog fetch and fix prefill calculations

Enabling and disabling programmable fetch dynamically
across different fps can cause dsi underflow/overflow followed
by underrun. Add changes to always enable prog fetch to handle
such cases. Fix needed_prefill_lines calculation for vfp method
of dfps since linetime is constant in this method and hence
prefill lines need to be based on max_fps. For panels whose
linetime varies with fps, the needed_prefill_lines calculation
remains unchanged.

Change-Id: Ib7b68b577ff903fc2359a8e8c4573d62d55c3828
Signed-off-by: Jayaprakash <[email protected]>
Jayaprakash 4 жил өмнө
parent
commit
ea5b9b3157

+ 11 - 5
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",