diff options
| author | Ingrid Gallardo <ingridg@codeaurora.org> | 2016-05-11 19:44:45 -0700 |
|---|---|---|
| committer | Kyle Yan <kyan@codeaurora.org> | 2016-05-26 15:30:04 -0700 |
| commit | 16ce5906892041e8b90565600834deec60a5da15 (patch) | |
| tree | 31f1b63901b4f4375b3619336f9355355e55dd63 /drivers/video/fbdev | |
| parent | 7d2526e588258d83f7088a661a1a93cc9b1aacdd (diff) | |
msm: mdss: fix amortized prefill calculations
Fix wrong calculation for the amortized prefill
parameters to use destination coordiates as well
as adjust ts_count denominators for the correct
units, also make sure vsync clock is enabled.
It was causing problem when feature was enabled.
Change-Id: I62a3bd31997be05181de98307089e2a69d98ab7b
Signed-off-by: Ingrid Gallardo <ingridg@codeaurora.org>
Diffstat (limited to 'drivers/video/fbdev')
| -rw-r--r-- | drivers/video/fbdev/msm/mdss_mdp_pipe.c | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/drivers/video/fbdev/msm/mdss_mdp_pipe.c b/drivers/video/fbdev/msm/mdss_mdp_pipe.c index e0ead6c1c5b7..a2a8855ac473 100644 --- a/drivers/video/fbdev/msm/mdss_mdp_pipe.c +++ b/drivers/video/fbdev/msm/mdss_mdp_pipe.c @@ -45,6 +45,8 @@ #define QSEED3_DEFAULT_PRELAOD_H 0x4 #define QSEED3_DEFAULT_PRELAOD_V 0x3 +#define TS_CLK 19200000 + static DEFINE_MUTEX(mdss_mdp_sspp_lock); static DEFINE_MUTEX(mdss_mdp_smp_lock); @@ -2375,7 +2377,7 @@ bool mdss_mdp_is_amortizable_pipe(struct mdss_mdp_pipe *pipe, struct mdss_mdp_mixer *mixer, struct mdss_data_type *mdata) { /* do not apply for rotator or WB */ - return ((pipe->src.y > mdata->prefill_data.ts_threshold) && + return ((pipe->dst.y > mdata->prefill_data.ts_threshold) && (mixer->type == MDSS_MDP_MIXER_TYPE_INTF)); } @@ -2393,7 +2395,7 @@ static inline void __get_ordered_rects(struct mdss_mdp_pipe *pipe, *high_pipe = pipe->multirect.next; /* if pipes are not in order, order them according to position */ - if ((*low_pipe)->src.y > (*high_pipe)->src.y) { + if ((*low_pipe)->dst.y > (*high_pipe)->dst.y) { *low_pipe = pipe->multirect.next; *high_pipe = pipe; } @@ -2403,7 +2405,7 @@ static u32 __get_ts_count(struct mdss_mdp_pipe *pipe, struct mdss_mdp_mixer *mixer, bool is_low_pipe) { struct mdss_data_type *mdata = mdss_mdp_get_mdata(); - u32 ts_diff, ts_ypos; + u32 ts_diff, ts_ypos, rate_factor; struct mdss_mdp_pipe *low_pipe, *high_pipe; u32 ts_count = 0; u32 v_total, fps, h_total, xres; @@ -2419,8 +2421,10 @@ static u32 __get_ts_count(struct mdss_mdp_pipe *pipe, if (mdss_mdp_is_amortizable_pipe(pipe, mixer, mdata)) { ts_diff = mdata->prefill_data.ts_threshold - mdata->prefill_data.ts_end; - ts_ypos = pipe->src.y - ts_diff; - ts_count = mult_frac(ts_ypos, 19200000, fps * v_total); + ts_ypos = pipe->dst.y - ts_diff; + rate_factor = TS_CLK / fps; + ts_count = mult_frac(ts_ypos, rate_factor, v_total); + MDSS_XLOG(ts_diff, ts_ypos, rate_factor, ts_count); } } else { /* high pipe */ @@ -2428,8 +2432,10 @@ static u32 __get_ts_count(struct mdss_mdp_pipe *pipe, if (pipe && pipe->multirect.mode == MDSS_MDP_PIPE_MULTIRECT_SERIAL) { __get_ordered_rects(pipe, &low_pipe, &high_pipe); - ts_count = high_pipe->src.y - low_pipe->src.y - 1; - ts_count = mult_frac(ts_count, 19200000, fps * v_total); + ts_ypos = high_pipe->dst.y - low_pipe->dst.y - 1; + rate_factor = TS_CLK / fps; + ts_count = mult_frac(ts_ypos, rate_factor, v_total); + MDSS_XLOG(ts_ypos, rate_factor, ts_count); } } @@ -2446,7 +2452,14 @@ static u32 __calc_ts_bytes(struct mdss_rect *src, u32 fps, u32 bpp) ts_bytes = mult_frac(ts_bytes, mdata->prefill_data.ts_rate.numer, mdata->prefill_data.ts_rate.denom); - ts_bytes /= 19200000; + ts_bytes = DIV_ROUND_UP(ts_bytes, TS_CLK); + + pr_debug("ts:%d, w:%d h:%d fps:%d bpp:%d\n", ts_bytes, + src->w, src->h, fps, bpp); + MDSS_XLOG(ts_bytes, src->w, src->h, fps, bpp); + + if (ts_bytes == 0) + ts_bytes = 1; return ts_bytes; } @@ -2513,9 +2526,9 @@ static u32 __get_ts_bytes(struct mdss_mdp_pipe *pipe, /* amortize depending on the lower pipe amortization */ if (mdss_mdp_is_amortizable_pipe(low_pipe, mixer, mdata)) ts_bytes = DIV_ROUND_UP_ULL(max(low_pipe_bw, - high_pipe_bw), 19200000); + high_pipe_bw), TS_CLK); else - ts_bytes = DIV_ROUND_UP_ULL(high_pipe_bw, 19200000); + ts_bytes = DIV_ROUND_UP_ULL(high_pipe_bw, TS_CLK); break; default: pr_err("unknown multirect mode!\n"); @@ -2570,6 +2583,8 @@ static int mdss_mdp_set_ts_pipe(struct mdss_mdp_pipe *pipe) ts_rec1 = ts_count_low; } + mdss_mdp_vsync_clk_enable(1, false); + mdss_mdp_pipe_qos_ctrl(pipe, false, MDSS_MDP_PIPE_QOS_VBLANK_AMORTIZE); mdss_mdp_pipe_write(pipe, MDSS_MDP_REG_SSPP_TRAFFIC_SHAPER, ts_bytes); mdss_mdp_pipe_write(pipe, MDSS_MDP_REG_SSPP_TRAFFIC_SHAPER_PREFILL, |
