pmaports/device/linux-xiaomi-tissot/fix-xorg-mdss-update-fb-info.patch

118 lines
4.4 KiB
Diff
Raw Normal View History

From f3ed0c110153e63884e38aa20bc6a352b647b47d Mon Sep 17 00:00:00 2001
From: Ion Agorria <ion@agorria.com>
Date: Thu, 24 Jan 2019 18:52:58 +0100
Subject: [PATCH] mdss: update fb mode at mdss_panelinfo_to_fb_var to fix Xorg
When mdss_panelinfo_to_fb_var is called at
screen unblank it updates the values in fb_info->var,
meanwhile the fb_info->mode and modelist remain with old
values set at registering the fb causing mismatch when
Xorg attempts to set mode.
---
drivers/video/msm/mdss/mdss_fb.c | 25 ++++++++++++++++-------
drivers/video/msm/mdss/mdss_fb.h | 3 +--
drivers/video/msm/mdss/mdss_mdp_overlay.c | 2 +-
3 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/drivers/video/msm/mdss/mdss_fb.c b/drivers/video/msm/mdss/mdss_fb.c
index fbcec438dbc4..3302afc7120a 100644
--- a/drivers/video/msm/mdss/mdss_fb.c
+++ b/drivers/video/msm/mdss/mdss_fb.c
@@ -1851,7 +1851,7 @@ static void mdss_panel_validate_debugfs_info(struct msm_fb_data_type *mfd)
if (is_panel_split(mfd) && pdata->next)
mdss_fb_validate_split(pdata->panel_info.xres,
pdata->next->panel_info.xres, mfd);
- mdss_panelinfo_to_fb_var(panel_info, var);
+ mdss_panelinfo_to_fb_var(mfd);
if (mdss_fb_send_panel_event(mfd, MDSS_EVENT_CHECK_PARAMS,
panel_info))
pr_err("Failed to send panel event CHECK_PARAMS\n");
@@ -1964,7 +1964,7 @@ static int mdss_fb_blank_unblank(struct msm_fb_data_type *mfd)
* programmed in the controller.
* Update this info in the upstream structs.
*/
- mdss_panelinfo_to_fb_var(panel_info, var);
+ mdss_panelinfo_to_fb_var(mfd);
/* Start the work thread to signal idle time */
if (mfd->idle_time)
@@ -2696,7 +2696,7 @@ static int mdss_fb_register(struct msm_fb_data_type *mfd)
return ret;
}
- mdss_panelinfo_to_fb_var(panel_info, var);
+ mdss_panelinfo_to_fb_var(mfd);
fix->type = panel_info->is_3d_panel;
if (mfd->mdp.fb_stride)
@@ -3408,7 +3408,7 @@ static void mdss_fb_update_resolution(struct msm_fb_data_type *mfd,
}
var->xres_virtual = var->xres;
var->yres_virtual = pinfo->yres * mfd->fb_page;
- mdss_panelinfo_to_fb_var(pinfo, var);
+ mdss_panelinfo_to_fb_var(mfd);
}
int mdss_fb_atomic_commit(struct fb_info *info,
@@ -3630,9 +3630,14 @@ static void mdss_fb_var_to_panelinfo(struct fb_var_screeninfo *var,
pinfo->mipi.dsi_pclk_rate = pinfo->clk_rate;
}
-void mdss_panelinfo_to_fb_var(struct mdss_panel_info *pinfo,
- struct fb_var_screeninfo *var)
+void mdss_panelinfo_to_fb_var(struct msm_fb_data_type *mfd)
{
+ if (!mfd)
+ return -EINVAL;
+
+ struct mdss_panel_info *pinfo = mfd->panel_info;
+ struct fb_info *fbi = mfd->fbi;
+ struct fb_var_screeninfo *var = &fbi->var;
u32 frame_rate;
var->xres = mdss_fb_get_panel_xres(pinfo);
@@ -3667,7 +3672,13 @@ void mdss_panelinfo_to_fb_var(struct mdss_panel_info *pinfo,
if (pinfo->physical_height)
var->height = pinfo->physical_height;
- pr_debug("ScreenInfo: res=%dx%d [%d, %d] [%d, %d]\n",
+ //Hack to update current fbi->mode according to fbi->var when var is updated from panel info
+ if (fbi->mode) {
+ printk("Updating mdss fb mode from fb var\n");
+ fb_var_to_videomode(fbi->mode, var);
+ }
+
+ printk("ScreenInfo: res=%dx%d [%d, %d] [%d, %d]\n",
var->xres, var->yres, var->left_margin,
var->right_margin, var->upper_margin,
var->lower_margin);
diff --git a/drivers/video/msm/mdss/mdss_fb.h b/drivers/video/msm/mdss/mdss_fb.h
index 7bc2afd09646..3ea0c6426485 100644
--- a/drivers/video/msm/mdss/mdss_fb.h
+++ b/drivers/video/msm/mdss/mdss_fb.h
@@ -471,7 +471,6 @@ int mdss_fb_async_position_update(struct fb_info *info,
u32 mdss_fb_get_mode_switch(struct msm_fb_data_type *mfd);
void mdss_fb_report_panel_dead(struct msm_fb_data_type *mfd);
-void mdss_panelinfo_to_fb_var(struct mdss_panel_info *pinfo,
- struct fb_var_screeninfo *var);
+void mdss_panelinfo_to_fb_var(struct msm_fb_data_type *mfd);
void mdss_fb_calc_fps(struct msm_fb_data_type *mfd);
#endif /* MDSS_FB_H */
diff --git a/drivers/video/msm/mdss/mdss_mdp_overlay.c b/drivers/video/msm/mdss/mdss_mdp_overlay.c
index 0a99acba594b..c998d26211d4 100644
--- a/drivers/video/msm/mdss/mdss_mdp_overlay.c
+++ b/drivers/video/msm/mdss/mdss_mdp_overlay.c
@@ -3844,7 +3844,7 @@ int mdss_mdp_dfps_update_params(struct msm_fb_data_type *mfd,
* data, so any further call to get the screen
* info has the updated timings.
*/
- mdss_panelinfo_to_fb_var(&pdata->panel_info, var);
+ mdss_panelinfo_to_fb_var(mfd);
MDSS_XLOG(dfps);
mutex_unlock(&mdp5_data->dfps_lock);
--
2.19.2