[Intel-gfx] [PATCH 1/5] drm/i915: Keep vblank irq enabled during vblank evasion.

Maarten Lankhorst maarten.lankhorst at linux.intel.com
Fri Feb 9 09:54:00 UTC 2018


This is a nice preparation for grabbing the uncore lock during evasion.
Grabbing the spinlock with the lock held messes up the locking,
so it's easier to handover the reference to the event.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
---
 drivers/gpu/drm/i915/intel_sprite.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index 3be22c0fcfb5..971a1ea0db45 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -109,10 +109,10 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state)
 
 	local_irq_disable();
 
-	if (min <= 0 || max <= 0)
+	if (WARN_ON(drm_crtc_vblank_get(&crtc->base)))
 		return;
 
-	if (WARN_ON(drm_crtc_vblank_get(&crtc->base)))
+	if (min <= 0 || max <= 0)
 		return;
 
 	crtc->debug.min_vbl = min;
@@ -146,8 +146,6 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state)
 
 	finish_wait(wq, &wait);
 
-	drm_crtc_vblank_put(&crtc->base);
-
 	/*
 	 * On VLV/CHV DSI the scanline counter would appear to
 	 * increment approx. 1/3 of a scanline before start of vblank.
@@ -197,14 +195,13 @@ void intel_pipe_update_end(struct intel_crtc_state *new_crtc_state)
 	 * event outside of the critical section - the spinlock might spin for a
 	 * while ... */
 	if (new_crtc_state->base.event) {
-		WARN_ON(drm_crtc_vblank_get(&crtc->base) != 0);
-
 		spin_lock(&crtc->base.dev->event_lock);
 		drm_crtc_arm_vblank_event(&crtc->base, new_crtc_state->base.event);
 		spin_unlock(&crtc->base.dev->event_lock);
 
 		new_crtc_state->base.event = NULL;
-	}
+	} else
+		drm_crtc_vblank_put(&crtc->base);
 
 	local_irq_enable();
 
-- 
2.16.1



More information about the Intel-gfx mailing list