Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b165e058 authored by Ingrid Gallardo's avatar Ingrid Gallardo Committed by Ujwal Patel
Browse files

msm: mdss: fix to update the correct panel info for dynamic fps



Current code does not reflect the correct panel information
when user space request the panel info and fps data after
the fps update.
This change fix the code, so further calls to get the
screen info have the correct panel data.

Change-Id: I3e0382748cbf8b480c2516223cfe14444d388e29
Signed-off-by: default avatarIngrid Gallardo <ingridg@codeaurora.org>
parent c38e7004
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -1585,7 +1585,11 @@ static void __mdss_dsi_update_video_mode_total(struct mdss_panel_data *pdata,
	if (ctrl_pdata->shared_data->timing_db_mode)
		MIPI_OUTP((ctrl_pdata->ctrl_base) + 0x1e4, 0x1);

	ctrl_pdata->panel_data.panel_info.mipi.frame_rate = new_fps;
	pr_debug("%s new_fps:%d vsync:%d hsync:%d frame_rate:%d\n",
			__func__, new_fps, vsync_period, hsync_period,
			ctrl_pdata->panel_data.panel_info.mipi.frame_rate);

	ctrl_pdata->panel_data.panel_info.current_fps = new_fps;
	MDSS_XLOG(current_dsi_v_total, new_dsi_v_total, new_fps,
		ctrl_pdata->shared_data->timing_db_mode);

@@ -1746,9 +1750,13 @@ static int __mdss_dsi_dfps_update_clks(struct mdss_panel_data *pdata,
		clk_disable_unprepare(ctrl_pdata->pll_byte_clk);
		clk_disable_unprepare(ctrl_pdata->pll_pixel_clk);

		if (!rc)
		if (!rc) {
			ctrl_pdata->panel_data.panel_info.mipi.frame_rate =
				new_fps;
			/* we are using current_fps to compare if dfps needed */
			ctrl_pdata->panel_data.panel_info.current_fps =
				new_fps;
		}
	} else {
		ctrl_pdata->pclk_rate =
			pdata->panel_info.mipi.dsi_pclk_rate;
@@ -1816,7 +1824,7 @@ static int mdss_dsi_dfps_config(struct mdss_panel_data *pdata, int new_fps)
	}

	if (new_fps !=
		ctrl_pdata->panel_data.panel_info.mipi.frame_rate) {
		ctrl_pdata->panel_data.panel_info.current_fps) {
		if (pdata->panel_info.dfps_update
			== DFPS_IMMEDIATE_PORCH_UPDATE_MODE_HFP ||
			pdata->panel_info.dfps_update
+6 −3
Original line number Diff line number Diff line
@@ -110,8 +110,6 @@ static int mdss_fb_send_panel_event(struct msm_fb_data_type *mfd,
					int event, void *arg);
static void mdss_fb_set_mdp_sync_pt_threshold(struct msm_fb_data_type *mfd,
		int type);
static void mdss_panelinfo_to_fb_var(struct mdss_panel_info *pinfo,
					struct fb_var_screeninfo *var);
void mdss_fb_no_update_notify_timer_cb(unsigned long data)
{
	struct msm_fb_data_type *mfd = (struct msm_fb_data_type *)data;
@@ -3259,7 +3257,7 @@ static void mdss_fb_var_to_panelinfo(struct fb_var_screeninfo *var,
		pinfo->clk_rate = PICOS2KHZ(var->pixclock) * 1000;
}

static void mdss_panelinfo_to_fb_var(struct mdss_panel_info *pinfo,
void mdss_panelinfo_to_fb_var(struct mdss_panel_info *pinfo,
						struct fb_var_screeninfo *var)
{
	var->xres = mdss_fb_get_panel_xres(pinfo);
@@ -3278,6 +3276,11 @@ static void mdss_panelinfo_to_fb_var(struct mdss_panel_info *pinfo,
		var->width = pinfo->physical_width;
	if (pinfo->physical_height)
		var->height = pinfo->physical_height;

	pr_debug("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);
}

/**
+2 −0
Original line number Diff line number Diff line
@@ -444,4 +444,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);
#endif /* MDSS_FB_H */
+1 −1
Original line number Diff line number Diff line
@@ -1082,7 +1082,7 @@ int mdss_mdp_ctl_start(struct mdss_mdp_ctl *ctl, bool handoff);
int mdss_mdp_ctl_stop(struct mdss_mdp_ctl *ctl, int panel_power_mode);
int mdss_mdp_ctl_intf_event(struct mdss_mdp_ctl *ctl, int event, void *arg,
	u32 flags);
int mdss_mdp_get_prefetch_lines(struct mdss_mdp_ctl *ctl);
int mdss_mdp_get_prefetch_lines(struct mdss_panel_info *pinfo);
int mdss_mdp_perf_bw_check(struct mdss_mdp_ctl *ctl,
		struct mdss_mdp_pipe **left_plist, int left_cnt,
		struct mdss_mdp_pipe **right_plist, int right_cnt);
+30 −11
Original line number Diff line number Diff line
@@ -1063,10 +1063,9 @@ exit:
		*(perf->bw_vote_mode));
}

static bool is_mdp_prefetch_needed(struct mdss_mdp_ctl *ctl)
static bool is_mdp_prefetch_needed(struct mdss_panel_info *pinfo)
{
	struct mdss_panel_info *pinfo = &ctl->panel_data->panel_info;
	struct mdss_data_type *mdata = ctl->mdata;
	struct mdss_data_type *mdata = mdss_mdp_get_mdata();
	bool enable_prefetch = false;

	if (mdata->mdp_rev >= MDSS_MDP_HW_REV_105) {
@@ -1090,7 +1089,7 @@ static bool is_mdp_prefetch_needed(struct mdss_mdp_ctl *ctl)

/**
 * mdss_mdp_get_prefetch_lines: - Number of fetch lines in vertical front porch
 * @ctl:	Pointer to controller where prefetch lines will be calculated
 * @pinfo: Pointer to the panel information.
 *
 * Returns the number of fetch lines in vertical front porch at which mdp
 * can start fetching the next frame.
@@ -1099,14 +1098,13 @@ static bool is_mdp_prefetch_needed(struct mdss_mdp_ctl *ctl)
 * the mdp fetch lines  as the last (25 - vbp - vpw) lines of vertical
 * front porch.
 */
int mdss_mdp_get_prefetch_lines(struct mdss_mdp_ctl *ctl)
int mdss_mdp_get_prefetch_lines(struct mdss_panel_info *pinfo)
{
	int prefetch_avail = 0;
	int v_total, vfp_start;
	u32 prefetch_needed;
	struct mdss_panel_info *pinfo = &ctl->panel_data->panel_info;

	if (!is_mdp_prefetch_needed(ctl))
	if (!is_mdp_prefetch_needed(pinfo))
		return 0;

	v_total = mdss_panel_get_vtotal(pinfo);
@@ -4151,17 +4149,36 @@ int mdss_mdp_ctl_update_fps(struct mdss_mdp_ctl *ctl)
	if (!pinfo->dynamic_fps || !ctl->ops.config_fps_fnc)
		return 0;

	if (!pinfo->default_fps) {
		/* we haven't got any call to update the fps */
		return 0;
	}

	mdp5_data = mfd_to_mdp5_data(ctl->mfd);
	if (!mdp5_data)
		return -ENODEV;

	/*
	 * Panel info is already updated with the new fps info,
	 * so we need to lock the data to make sure the panel info
	 * is not updated while we reconfigure the HW.
	 */
	mutex_lock(&mdp5_data->dfps_lock);

	if ((pinfo->dfps_update == DFPS_IMMEDIATE_PORCH_UPDATE_MODE_VFP) ||
		(pinfo->dfps_update == DFPS_IMMEDIATE_PORCH_UPDATE_MODE_HFP)) {
		new_fps = mdss_panel_get_framerate(pinfo);
	} else {
		new_fps = pinfo->new_fps;
	mutex_unlock(&mdp5_data->dfps_lock);
	}

	if (new_fps == pinfo->mipi.frame_rate) {
	pr_debug("fps new:%d old:%d\n", new_fps,
		pinfo->current_fps);

	if (new_fps == pinfo->current_fps) {
		pr_debug("FPS is already %d\n", new_fps);
		return 0;
		ret = 0;
		goto exit;
	}

	ret = ctl->ops.config_fps_fnc(ctl, new_fps);
@@ -4171,6 +4188,8 @@ int mdss_mdp_ctl_update_fps(struct mdss_mdp_ctl *ctl)
		pr_err("Failed to configure %d fps rc=%d\n",
			new_fps, ret);

exit:
	mutex_unlock(&mdp5_data->dfps_lock);
	return ret;
}

Loading