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

Commit 97dc5159 authored by Veera Sundaram Sankaran's avatar Veera Sundaram Sankaran
Browse files

drm/msm/sde: avoid multiple CRTC enable



Add proper validation to avoid executing the crtc enable
multiple times. Add logs to capture invalid usecases.

Change-Id: I642729038960483fea20062aec167a3cf6fb6be5
Signed-off-by: default avatarVeera Sundaram Sankaran <veeras@codeaurora.org>
parent e795ead2
Loading
Loading
Loading
Loading
+17 −3
Original line number Diff line number Diff line
@@ -3933,6 +3933,22 @@ static void sde_crtc_enable(struct drm_crtc *crtc)
	SDE_EVT32_VERBOSE(DRMID(crtc));
	sde_crtc = to_sde_crtc(crtc);

	mutex_lock(&sde_crtc->crtc_lock);
	SDE_EVT32(DRMID(crtc), sde_crtc->enabled, sde_crtc->suspend,
			sde_crtc->vblank_requested);

	/* return early if crtc is already enabled */
	if (sde_crtc->enabled) {
		if (msm_is_mode_seamless_dms(&crtc->state->adjusted_mode))
			SDE_DEBUG("%s extra crtc enable expected during DMS\n",
					sde_crtc->name);
		else
			WARN(1, "%s unexpected crtc enable\n", sde_crtc->name);

		mutex_unlock(&sde_crtc->crtc_lock);
		return;
	}

	drm_for_each_encoder(encoder, crtc->dev) {
		if (encoder->crtc != crtc)
			continue;
@@ -3940,9 +3956,6 @@ static void sde_crtc_enable(struct drm_crtc *crtc)
				sde_crtc_frame_event_cb, (void *)crtc);
	}

	mutex_lock(&sde_crtc->crtc_lock);
	SDE_EVT32(DRMID(crtc), sde_crtc->enabled, sde_crtc->suspend,
			sde_crtc->vblank_requested);
	if (!sde_crtc->enabled && !sde_crtc->suspend &&
			sde_crtc->vblank_requested) {
		ret = _sde_crtc_vblank_enable_no_lock(sde_crtc, true);
@@ -5367,6 +5380,7 @@ struct drm_crtc *sde_crtc_init(struct drm_device *dev, struct drm_plane *plane)
	INIT_LIST_HEAD(&sde_crtc->rp_head);

	init_completion(&sde_crtc->frame_done_comp);
	sde_crtc->enabled = false;

	INIT_LIST_HEAD(&sde_crtc->frame_event_list);
	INIT_LIST_HEAD(&sde_crtc->user_event_list);