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

Commit 003eea8e authored by Nirmal Abraham's avatar Nirmal Abraham
Browse files

msm: mdss: clear fences in ESD panel dead scenario



When a panel_dead scenario occurs during ESD test,
MDP driver's release/retire fences are cleared from
mdss_fb_atomic_commit. Since mdss_fb_atomic_commit is
called from HAL(user space) context, this leads to
race condition between HAL and mdss driver resulting
in UI freeze / UI corruption due to the difference
between release fence timeline and commit_cnt.
To avoid this, handle the panel dead scenario
gracefully from the mdss driver context.

Change-Id: Id42d88b26bba4c811ae547001759317cda3ef365
Signed-off-by: default avatarNirmal Abraham <nabrah@codeaurora.org>
Signed-off-by: default avatarAlthaf Neelanchirayil <aneelanc@codeaurora.org>
parent 16e57e65
Loading
Loading
Loading
Loading
+13 −18
Original line number Diff line number Diff line
@@ -3687,6 +3687,19 @@ static int __mdss_fb_perform_commit(struct msm_fb_data_type *mfd)
	int ret = -ENOTSUPP;
	u32 new_dsi_mode, dynamic_dsi_switch = 0;

	if (mfd->panel_info->panel_dead) {
		pr_debug("Panel dead, Signal fence and exit commit\n");
		/*
		 * In case of ESD attack, return early from commit
		 * after signalling fences.
		 */
		mdss_fb_release_kickoff(mfd);
		mdss_fb_signal_timeline(sync_pt_data);
		if ((mfd->panel.type == MIPI_CMD_PANEL) &&
			(mfd->mdp.signal_retire_fence))
			mfd->mdp.signal_retire_fence(mfd, 1);
		return ret;
	}
	if (!sync_pt_data->async_wait_fences)
		mdss_fb_wait_for_fence(sync_pt_data);
	sync_pt_data->flushed = false;
@@ -4657,7 +4670,6 @@ static int mdss_fb_atomic_commit_ioctl(struct fb_info *info,
	struct mdp_destination_scaler_data *ds_data = NULL;
	struct mdp_destination_scaler_data __user *ds_data_user;
	struct msm_fb_data_type *mfd;
	struct mdss_overlay_private *mdp5_data = NULL;
	struct mdss_data_type *mdata;

	ret = copy_from_user(&commit, argp, sizeof(struct mdp_layer_commit));
@@ -4670,23 +4682,6 @@ static int mdss_fb_atomic_commit_ioctl(struct fb_info *info,
	if (!mfd)
		return -EINVAL;

	mdp5_data = mfd_to_mdp5_data(mfd);

	if (mfd->panel_info->panel_dead) {
		pr_debug("early commit return\n");
		MDSS_XLOG(mfd->panel_info->panel_dead);
		/*
		 * In case of an ESD attack, since we early return from the
		 * commits, we need to signal the outstanding fences.
		 */
		mdss_fb_release_fences(mfd);
		if ((mfd->panel.type == MIPI_CMD_PANEL) &&
			mfd->mdp.signal_retire_fence && mdp5_data)
			mfd->mdp.signal_retire_fence(mfd,
						mdp5_data->retire_cnt);
		return 0;
	}

	output_layer_user = commit.commit_v1.output_layer;
	if (output_layer_user) {
		buffer_size = sizeof(struct mdp_output_layer);