drm/i915: fix ironlake CRTC enable/disable
authorJesse Barnes <jbarnes@virtuousgeek.org>
Thu, 7 Oct 2010 23:01:19 +0000 (16:01 -0700)
committerChris Wilson <chris@chris-wilson.co.uk>
Fri, 8 Oct 2010 09:28:24 +0000 (10:28 +0100)
Wait for vblank after enabling a pipe, make the error messages more
informative, and wait for the pipe to turn off when we disable it.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
drivers/gpu/drm/i915/intel_display.c

index acd7180ba7c791268db4d30ff020c1dbbe093f2e..29ecaa0b1344aa8ed20634eb54edeee5382331e9 100644 (file)
@@ -2041,7 +2041,7 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc)
        if ((temp & PIPECONF_ENABLE) == 0) {
                I915_WRITE(reg, temp | PIPECONF_ENABLE);
                POSTING_READ(reg);
-               udelay(100);
+               intel_wait_for_vblank(dev, intel_crtc->pipe);
        }
 
        /* configure and enable CPU plane */
@@ -2131,7 +2131,7 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc)
        temp |= I915_READ(PIPECONF(pipe)) & PIPE_BPC_MASK;
        I915_WRITE(reg, temp | TRANS_ENABLE);
        if (wait_for(I915_READ(reg) & TRANS_STATE_ENABLE, 100))
-               DRM_ERROR("failed to enable transcoder\n");
+               DRM_ERROR("failed to enable transcoder %d\n", pipe);
 
        intel_crtc_load_lut(crtc);
        intel_update_fbc(dev);
@@ -2171,9 +2171,9 @@ static void ironlake_crtc_disable(struct drm_crtc *crtc)
        temp = I915_READ(reg);
        if (temp & PIPECONF_ENABLE) {
                I915_WRITE(reg, temp & ~PIPECONF_ENABLE);
+               POSTING_READ(reg);
                /* wait for cpu pipe off, pipe state */
-               if (wait_for((I915_READ(reg) & I965_PIPECONF_ACTIVE) == 0, 50))
-                       DRM_ERROR("failed to turn off cpu pipe\n");
+               intel_wait_for_pipe_off(dev, intel_crtc->pipe);
        }
 
        /* Disable PF */