[Intel-gfx] [PATCH 2/3] drm/i915: Move drm_crtc_vblank_get out of disabled pre-emption area.

Dhinakaran Pandiyan dhinakaran.pandiyan at intel.com
Thu Jun 9 01:46:03 UTC 2016


From: Rodrigo Vivi <rodrigo.vivi at intel.com>

drm_crtc_vblank_get call the drm_vblank_prepare that will be used soon
to control power saving states or anything else that needs a mutex
before the vblank happens.

local_irq_disable disables kernel preemption so we won't be able
to use mutex inside drm_crtc_vblank_get. For this reason we need
to move the drm_crtc_vblank_get a little up before disabling the
interruptions.

Another option would be to use local_irq_enable + local_irq_disable
around the drm_crtc_vblank_get, but let's avoid touching the kernel
states if we can call the vblank_get a bit earlier.

Signed-off-by: Rodrigo Vivi <rodrigo.vivi at intel.com>
---
 drivers/gpu/drm/i915/intel_sprite.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index 97b1a54..3351c7e 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -94,13 +94,15 @@ void intel_pipe_update_start(struct intel_crtc *crtc)
 	min = vblank_start - usecs_to_scanlines(adjusted_mode, 100);
 	max = vblank_start - 1;
 
-	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)))
+	local_irq_disable();
+
+	if (min <= 0 || max <= 0) {
+		drm_crtc_vblank_put(&crtc->base);
 		return;
+	}
 
 	crtc->debug.min_vbl = min;
 	crtc->debug.max_vbl = max;
-- 
2.5.0



More information about the Intel-gfx mailing list