diff options
author | Jeevan Shriram <jshriram@codeaurora.org> | 2015-04-20 10:49:47 -0700 |
---|---|---|
committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-23 20:40:53 -0700 |
commit | 59dbf28883e3d0c1450d7201c293eed4c3fdb4d0 (patch) | |
tree | 5c15f041eeb8582419b81c0b827c0da3412adde9 | |
parent | 9df13699a8a3a3155eb666d0bc85108312766286 (diff) |
msm: mdss: change calculation reference to default frame rate
In the current implementation for dynamic fps in vfp method, while
calculating the porch values current fps is taken as reference which
may lead to precision loss and clock calculations go wrong. Use the
default fps as reference for any change in fps.
Change-Id: I9a36c33c9824c95abc4925a324f9cd2f47456e6a
Signed-off-by: Jeevan Shriram <jshriram@codeaurora.org>
-rw-r--r-- | drivers/video/fbdev/msm/mdss_mdp_intf_video.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/drivers/video/fbdev/msm/mdss_mdp_intf_video.c b/drivers/video/fbdev/msm/mdss_mdp_intf_video.c index 4b0440cb899b..98b308aac3b3 100644 --- a/drivers/video/fbdev/msm/mdss_mdp_intf_video.c +++ b/drivers/video/fbdev/msm/mdss_mdp_intf_video.c @@ -64,6 +64,10 @@ struct mdss_mdp_video_ctx { struct completion vsync_comp; int wait_pending; + u32 default_fps; + u32 saved_vtotal; + u32 saved_vfporch; + atomic_t vsync_ref; spinlock_t vsync_lock; spinlock_t dfps_lock; @@ -754,7 +758,6 @@ static int mdss_mdp_video_hfp_fps_update(struct mdss_mdp_video_ctx *ctx, static int mdss_mdp_video_vfp_fps_update(struct mdss_mdp_video_ctx *ctx, struct mdss_panel_data *pdata, int new_fps) { - int curr_fps; int add_v_lines = 0; u32 current_vsync_period_f0, new_vsync_period_f0; int vsync_period, hsync_period; @@ -762,11 +765,17 @@ static int mdss_mdp_video_vfp_fps_update(struct mdss_mdp_video_ctx *ctx, vsync_period = mdss_panel_get_vtotal(&pdata->panel_info); hsync_period = mdss_panel_get_htotal(&pdata->panel_info, true); - curr_fps = mdss_panel_get_framerate(&pdata->panel_info); - diff = curr_fps - new_fps; - add_v_lines = mult_frac(vsync_period, diff, new_fps); - pdata->panel_info.lcdc.v_front_porch += add_v_lines; + if (!ctx->default_fps) { + ctx->default_fps = mdss_panel_get_framerate(&pdata->panel_info); + ctx->saved_vtotal = vsync_period; + ctx->saved_vfporch = pdata->panel_info.lcdc.v_front_porch; + } + + diff = ctx->default_fps - new_fps; + add_v_lines = mult_frac(ctx->saved_vtotal, diff, new_fps); + pdata->panel_info.lcdc.v_front_porch = ctx->saved_vfporch + + add_v_lines; vsync_period = mdss_panel_get_vtotal(&pdata->panel_info); current_vsync_period_f0 = mdp_video_read(ctx, |