@@ -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)