i915: Do not wait for pending flips on both pipes at the same time.
authorMichel Dänzer <michel@tungstengraphics.com>
Fri, 9 Mar 2007 15:39:13 +0000 (16:39 +0100)
committerMichel Dänzer <michel@tungstengraphics.com>
Fri, 9 Mar 2007 15:39:13 +0000 (16:39 +0100)
The MI_WAIT_FOR_EVENT instruction does not support waiting for several events
at once, so this should fix the lockups with page flipping when both pipes are
enabled.

shared-core/i915_dma.c

index b9dea8a..14e0117 100644 (file)
@@ -589,11 +589,12 @@ static void i915_do_dispatch_flip(drm_device_t * dev, int pipe, int sync)
                  dspbase);
 
        BEGIN_LP_RING(4);
+       OUT_RING(MI_WAIT_FOR_EVENT | (pipe ? MI_WAIT_FOR_PLANE_B_FLIP :
+                                     MI_WAIT_FOR_PLANE_A_FLIP));
        OUT_RING(CMD_OP_DISPLAYBUFFER_INFO | (sync ? 0 : ASYNC_FLIP) |
                 (pipe ? DISPLAY_PLANE_B : DISPLAY_PLANE_A));
        OUT_RING(dev_priv->sarea_priv->pitch * dev_priv->cpp);
        OUT_RING(dspbase);
-       OUT_RING(0);
        ADVANCE_LP_RING();
 
        dev_priv->sarea_priv->pf_current_page &= ~(0x3 << shift);
@@ -604,7 +605,6 @@ void i915_dispatch_flip(drm_device_t * dev, int pipes, int sync)
 {
        drm_i915_private_t *dev_priv = dev->dev_private;
        int i;
-       RING_LOCALS;
 
        DRM_DEBUG("%s: pipes=0x%x pfCurrentPage=%d\n",
                  __FUNCTION__,
@@ -612,22 +612,6 @@ void i915_dispatch_flip(drm_device_t * dev, int pipes, int sync)
 
        i915_emit_mi_flush(dev, MI_READ_FLUSH | MI_EXE_FLUSH);
 
-       if (!sync) {
-               u32 mi_wait = MI_WAIT_FOR_EVENT;
-
-               /* Wait for pending flips to take effect */
-               if (pipes & 0x1)
-                       mi_wait |= MI_WAIT_FOR_PLANE_A_FLIP;
-
-               if (pipes & 0x2)
-                       mi_wait |= MI_WAIT_FOR_PLANE_B_FLIP;
-
-               BEGIN_LP_RING(2);
-               OUT_RING(mi_wait);
-               OUT_RING(0);
-               ADVANCE_LP_RING();
-       }
-
        for (i = 0; i < 2; i++)
                if (pipes & (1 << i))
                        i915_do_dispatch_flip(dev, i, sync);