Patchwork drm/i915: Wait for pending flips to complete before tearing down the encoders

login
register
mail settings
Submitter TImo Aaltonen
Date Feb. 13, 2013, 6:35 p.m.
Message ID <511BDD05.4080307@ubuntu.com>
Download mbox | patch
Permalink /patch/220228/
State New
Headers show

Comments

TImo Aaltonen - Feb. 13, 2013, 6:35 p.m.
Can we add this to the current kernel?

-------- Original Message --------
Subject: [PATCH] drm/i915: Wait for pending flips to complete before tearing down the encoders
Date: Wed, 13 Feb 2013 18:16:48 +0000
From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org

If we start disabling the encoders, there is a potential for a pending
flip to never occur - and so we will end up waiting indefinitely.

v2: Also pre-emptively perform the drm_vblank_off() before switching off
the encoders.

References: https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-intel/+bug/1097315
Cc: Timo Aaltonen <tjaalton@ubuntu.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/intel_display.c |   17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
Tim Gardner - Feb. 13, 2013, 7:28 p.m.

Patch

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index da1ad9c..15cc838 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3486,15 +3486,15 @@  static void ironlake_crtc_disable(struct drm_crtc *crtc)
 	int plane = intel_crtc->plane;
 	u32 reg, temp;
 
-
 	if (!intel_crtc->active)
 		return;
 
+	intel_crtc_wait_for_pending_flips(crtc);
+	drm_vblank_off(dev, pipe);
+
 	for_each_encoder_on_crtc(dev, crtc, encoder)
 		encoder->disable(encoder);
 
-	intel_crtc_wait_for_pending_flips(crtc);
-	drm_vblank_off(dev, pipe);
 	intel_crtc_update_cursor(crtc, false);
 
 	intel_disable_plane(dev_priv, plane, pipe);
@@ -3570,13 +3570,14 @@  static void haswell_crtc_disable(struct drm_crtc *crtc)
 	if (!intel_crtc->active)
 		return;
 
+	intel_crtc_wait_for_pending_flips(crtc);
+	drm_vblank_off(dev, pipe);
+
 	is_pch_port = haswell_crtc_driving_pch(crtc);
 
 	for_each_encoder_on_crtc(dev, crtc, encoder)
 		encoder->disable(encoder);
 
-	intel_crtc_wait_for_pending_flips(crtc);
-	drm_vblank_off(dev, pipe);
 	intel_crtc_update_cursor(crtc, false);
 
 	intel_disable_plane(dev_priv, plane, pipe);
@@ -3687,16 +3688,16 @@  static void i9xx_crtc_disable(struct drm_crtc *crtc)
 	int pipe = intel_crtc->pipe;
 	int plane = intel_crtc->plane;
 
-
 	if (!intel_crtc->active)
 		return;
 
+	intel_crtc_wait_for_pending_flips(crtc);
+	drm_vblank_off(dev, pipe);
+
 	for_each_encoder_on_crtc(dev, crtc, encoder)
 		encoder->disable(encoder);
 
 	/* Give the overlay scaler a chance to disable if it's on this pipe */
-	intel_crtc_wait_for_pending_flips(crtc);
-	drm_vblank_off(dev, pipe);
 	intel_crtc_dpms_overlay(intel_crtc, false);
 	intel_crtc_update_cursor(crtc, false);