Browse Source

disp: msm: sde: fix traffic shaper prefill calculations

This change fixes traffic shaper prefill calculations
for prefill count and bytes per clock as per hardware
recommendations in the HPG which are calcualted as below:

ts_ count = ts_end*19200000/fps/(vtotal)

ts_bytes_per_clk = ceil(h_src*v_src*bpp*fps/
			19200000*amortized_pref_rate)

Change-Id: Icc2348421a2124daa3b0056f46d7a6a45021381b
Signed-off-by: Yashwanth <[email protected]>
Yashwanth 3 years ago
parent
commit
50aa3cd210
1 changed files with 3 additions and 6 deletions
  1. 3 6
      msm/sde/sde_hw_sspp.c

+ 3 - 6
msm/sde/sde_hw_sspp.c

@@ -1082,17 +1082,14 @@ static void sde_hw_sspp_setup_ts_prefill(struct sde_hw_pipe *ctx,
 	}
 
 	if (cfg->time) {
-		u64 temp = DIV_ROUND_UP_ULL(TS_CLK * 1000000ULL, cfg->time);
-
-		ts_bytes = temp * cfg->size;
+		ts_count = DIV_ROUND_UP_ULL(TS_CLK * cfg->time, 1000000ULL);
+		ts_bytes = DIV_ROUND_UP_ULL(cfg->size, ts_count);
 		if (ts_bytes > SSPP_TRAFFIC_SHAPER_BPC_MAX)
 			ts_bytes = SSPP_TRAFFIC_SHAPER_BPC_MAX;
 	}
 
-	if (ts_bytes) {
-		ts_count = DIV_ROUND_UP_ULL(cfg->size, ts_bytes);
+	if (ts_count)
 		ts_bytes |= BIT(31) | BIT(27);
-	}
 
 	SDE_REG_WRITE(&ctx->hw, ts_offset, ts_bytes);
 	SDE_REG_WRITE(&ctx->hw, ts_prefill_offset, ts_count);