[PATCH] drm/i915: new_crtc_state->event is always set when doing vblank evasion?

Maarten Lankhorst maarten.lankhorst at linux.intel.com
Tue Feb 13 08:10:49 UTC 2018


I'm pretty sure we can keep the vblank reference in intel_pipe_update_start,
because new_crtc_state->base.event should always be set when this is called.
Lets use science to find out.

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

diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index e098e4b2c85c..66749e6197c3 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,7 +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
@@ -196,15 +195,10 @@ void intel_pipe_update_end(struct intel_crtc_state *new_crtc_state)
 	 * Would be slightly nice to just grab the vblank count and arm the
 	 * 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;
-	}
+	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;
 
 	local_irq_enable();
 
-- 
2.16.1



More information about the Intel-gfx-trybot mailing list