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

Commit 1970f5d3 authored by Naseer Ahmed's avatar Naseer Ahmed Committed by Abhijith Desai
Browse files

msm: mdss: Dynamic resolution switch with DSC on/off



When dynamically switching resolutions from one with DSC and the
other without, DSC should be turned off in MDP and also
topology should be switched to enable 3D mux if DSC merge was
being used.

Change-Id: I381003f4542d1483004df4b24e2ffe6bd1571592
Signed-off-by: default avatarNaseer Ahmed <naseer@codeaurora.org>
parent e64c9281
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -664,6 +664,8 @@ struct mdss_mdp_mixer {
	bool valid_roi;
	bool roi_changed;
	struct mdss_rect roi;
	bool dsc_enabled;
	bool dsc_merge_enabled;

	u8 cursor_enabled;
	u16 cursor_hotx;
+45 −7
Original line number Diff line number Diff line
@@ -2876,6 +2876,7 @@ static inline void __dsc_enable(struct mdss_mdp_mixer *mixer)
{
	mdss_mdp_pingpong_write(mixer->pingpong_base,
			MDSS_MDP_REG_PP_DSC_MODE, 1);
	mixer->dsc_enabled = true;
}

static inline void __dsc_disable(struct mdss_mdp_mixer *mixer)
@@ -2895,6 +2896,13 @@ static inline void __dsc_disable(struct mdss_mdp_mixer *mixer)
		return;
	}
	writel_relaxed(0, offset + MDSS_MDP_REG_DSC_COMMON_MODE);
	mixer->dsc_enabled = false;
	mixer->dsc_merge_enabled = false;
}

static bool __is_dsc_merge_enabled(u32 common_mode)
{
	return common_mode & BIT(1);
}

static void __dsc_config(struct mdss_mdp_mixer *mixer,
@@ -2907,6 +2915,7 @@ static void __dsc_config(struct mdss_mdp_mixer *mixer,
	u32 initial_lines = dsc->initial_lines;
	bool is_cmd_mode = !(mode & BIT(2));

	mixer->dsc_merge_enabled = __is_dsc_merge_enabled(mode);
	data = mdss_mdp_pingpong_read(mixer->pingpong_base,
			MDSS_MDP_REG_PP_DCE_DATA_OUT_SWAP);
	data |= BIT(18); /* endian flip */
@@ -3061,11 +3070,6 @@ static void __dsc_config_thresh(struct mdss_mdp_mixer *mixer,
	}
}

static bool __is_dsc_merge_enabled(u32 common_mode)
{
	return common_mode & BIT(1);
}

static bool __dsc_is_3d_mux_enabled(struct mdss_mdp_ctl *ctl,
	struct mdss_panel_info *pinfo)
{
@@ -3407,8 +3411,19 @@ void mdss_mdp_ctl_dsc_setup(struct mdss_mdp_ctl *ctl,
	struct mdss_mdp_ctl *sctl;
	struct mdss_panel_info *spinfo;

	if (!is_dsc_compression(pinfo))
	/*
	 * Check for dynamic resolution switch from DSC On to DSC Off
	 * and disable DSC
	 */
	if ((ctl->pending_mode_switch == SWITCH_RESOLUTION) &&
	    ctl->is_master &&
	    (!is_dsc_compression(pinfo))) {
		if (ctl->mixer_left && ctl->mixer_left->dsc_enabled)
			__dsc_disable(ctl->mixer_left);
		if (ctl->mixer_right && ctl->mixer_right->dsc_enabled)
			__dsc_disable(ctl->mixer_right);
		return;
	}

	if (!ctl->is_master) {
		pr_debug("skip slave ctl because master will program for both\n");
@@ -3694,6 +3709,30 @@ int mdss_mdp_ctl_reconfig(struct mdss_mdp_ctl *ctl,
			ctl->mixer_right->width = ctl->width / 2;
			ctl->mixer_right->height = ctl->height;
		}

		/*
		 * If we are transitioning from  DSC On + DSC Merge to DSC Off
		 * the 3D mux needs to be enabled
		 */
		if (!is_dsc_compression(&pdata->panel_info) &&
		    ctl->mixer_left &&
		    ctl->mixer_left->dsc_enabled &&
		    ctl->mixer_left->dsc_merge_enabled) {
			ctl->opmode |= MDSS_MDP_CTL_OP_PACK_3D_ENABLE |
				       MDSS_MDP_CTL_OP_PACK_3D_H_ROW_INT;
		}

		/*
		 * If we are transitioning from DSC Off to DSC On + DSC Merge
		 * the 3D mux needs to be disabled
		 */
		if (is_dsc_compression(&pdata->panel_info) &&
		    ctl->mixer_left &&
		    !ctl->mixer_left->dsc_enabled &&
		    pdata->panel_info.dsc_enc_total != 1) {
			ctl->opmode &= ~(MDSS_MDP_CTL_OP_PACK_3D_ENABLE |
				  MDSS_MDP_CTL_OP_PACK_3D_H_ROW_INT);
		}
	} else {
		/*
		 * Handles MDP_SPLIT_MODE_NONE, MDP_DUAL_LM_DUAL_DISPLAY and
@@ -3708,7 +3747,6 @@ int mdss_mdp_ctl_reconfig(struct mdss_mdp_ctl *ctl,

	ctl->border_x_off = pdata->panel_info.lcdc.border_left;
	ctl->border_y_off = pdata->panel_info.lcdc.border_top;

	return ret;
}

+16 −2
Original line number Diff line number Diff line
@@ -2133,8 +2133,22 @@ static void mdss_mdp_cmd_dsc_reconfig(struct mdss_mdp_ctl *ctl)
		return;

	pinfo = &ctl->panel_data->panel_info;
	if (pinfo->compression_mode != COMPRESSION_DSC)
	if (pinfo->compression_mode != COMPRESSION_DSC) {
		/*
		 * Check for a dynamic resolution switch from DSC On to
		 * DSC Off and call mdss_mdp_ctl_dsc_setup to disable DSC
		 */
		if (ctl->pending_mode_switch == SWITCH_RESOLUTION) {
			if (ctl->mixer_left && ctl->mixer_left->dsc_enabled)
				changed = true;
			if (is_split_lm(ctl->mfd) &&
			    ctl->mixer_right &&
			    ctl->mixer_right->dsc_enabled)
				changed = true;
		} else {
			return;
		}
	}

	changed = ctl->mixer_left->roi_changed;
	if (is_split_lm(ctl->mfd))