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

Commit b65c0cd0 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: mdss: fix race condition between vsync handler and ctl_stop"

parents d985803d d765b48e
Loading
Loading
Loading
Loading
+15 −7
Original line number Diff line number Diff line
@@ -2620,27 +2620,35 @@ int mdss_mdp_overlay_vsync_ctrl(struct msm_fb_data_type *mfd, int en)

	if (!ctl)
		return -ENODEV;
	if (!ctl->ops.add_vsync_handler || !ctl->ops.remove_vsync_handler)
		return -EOPNOTSUPP;

	mutex_lock(&mdp5_data->ov_lock);
	if (!ctl->ops.add_vsync_handler || !ctl->ops.remove_vsync_handler) {
		rc = -EOPNOTSUPP;
		pr_err_once("fb%d vsync handlers are not registered\n",
			mfd->index);
		goto end;
	}

	if (!ctl->panel_data->panel_info.cont_splash_enabled
		&& (!mdss_mdp_ctl_is_power_on(ctl) ||
		mdss_panel_is_power_on_ulp(ctl->power_state))) {
		pr_debug("fb%d vsync pending first update en=%d\n",
				mfd->index, en);
		return -EPERM;
		pr_debug("fb%d vsync pending first update en=%d, ctl power state:%d\n",
				mfd->index, en, ctl->power_state);
		rc = -EPERM;
		goto end;
	}

	pr_debug("fb%d vsync en=%d\n", mfd->index, en);

	mutex_lock(&mdp5_data->ov_lock);
	mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_ON);
	if (en)
		rc = ctl->ops.add_vsync_handler(ctl, &ctl->vsync_handler);
	else
		rc = ctl->ops.remove_vsync_handler(ctl, &ctl->vsync_handler);
	mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_OFF);
	mutex_unlock(&mdp5_data->ov_lock);

end:
	mutex_unlock(&mdp5_data->ov_lock);
	return rc;
}