diff mbox

drm/i915: Check whether the output is running after completing the modeswitch

Message ID 1301406226-13396-1-git-send-email-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson March 29, 2011, 1:43 p.m. UTC
None
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 5c7385b..ac9050d 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3161,7 +3161,22 @@  static void i9xx_crtc_prepare(struct drm_crtc *crtc)
 
 static void i9xx_crtc_commit(struct drm_crtc *crtc)
 {
+	struct drm_i915_private *dev_priv = crtc->dev->dev_private;
+	int pipe = to_intel_crtc(crtc)->pipe;
+
 	i9xx_crtc_enable(crtc);
+
+	if (INTEL_INFO(crtc->dev)->gen >= 4) {
+		u32 reg = PIPEDSL(pipe);
+		u32 line = I915_READ(reg);
+		if (wait_for(I915_READ(reg) != line, 50))
+			DRM_ERROR("failed to switch modes, output not running\n");
+	} else {
+		u32 reg = PIPEFRAMEPIXEL(pipe);
+		u32 pixel = I915_READ(reg) & PIPE_PIXEL_MASK;
+		if (wait_for((I915_READ(reg) & PIPE_PIXEL_MASK) != pixel, 50))
+			DRM_ERROR("failed to switch modes, output not running\n");
+	}
 }
 
 static void ironlake_crtc_prepare(struct drm_crtc *crtc)
@@ -3171,7 +3186,16 @@  static void ironlake_crtc_prepare(struct drm_crtc *crtc)
 
 static void ironlake_crtc_commit(struct drm_crtc *crtc)
 {
+	struct drm_i915_private *dev_priv = crtc->dev->dev_private;
+	int pipe = to_intel_crtc(crtc)->pipe;
+	u32 reg = PIPEDSL(pipe);
+	u32 line;
+
 	ironlake_crtc_enable(crtc);
+
+	line = I915_READ(reg);
+	if (wait_for(I915_READ(reg) != line, 50))
+		DRM_ERROR("failed to switch modes, output not running\n");
 }
 
 void intel_encoder_prepare (struct drm_encoder *encoder)