i915: Don't emit waits for pending flips before emitting synchronous flips.
authorMichel Dänzer <michel@tungstengraphics.com>
Wed, 28 Feb 2007 14:23:19 +0000 (15:23 +0100)
committerMichel Dänzer <michel@tungstengraphics.com>
Wed, 28 Feb 2007 14:23:19 +0000 (15:23 +0100)
The assumption is that synchronous flips are not isolated usually, and waiting
for all of them could result in stalling the pipeline for long periods of time.

Also use i915_emit_mi_flush() instead of an old-fashioned way to achieve the
same effect.

shared-core/i915_dma.c
shared-core/i915_drv.h

index 883f3b9..7078ec9 100644 (file)
@@ -604,7 +604,6 @@ static void i915_do_dispatch_flip(drm_device_t * dev, int pipe, int sync)
 void i915_dispatch_flip(drm_device_t * dev, int pipes, int sync)
 {
        drm_i915_private_t *dev_priv = dev->dev_private;
-       u32 mi_wait = MI_WAIT_FOR_EVENT;
        int i;
        RING_LOCALS;
 
@@ -613,24 +612,23 @@ void i915_dispatch_flip(drm_device_t * dev, int pipes, int sync)
                  pipes, dev_priv->current_page,
                  dev_priv->sarea_priv->pf_current_page);
 
-       if (pipes & 0x1)
-               mi_wait |= MI_WAIT_FOR_PLANE_A_FLIP;
+       i915_emit_mi_flush(dev, MI_READ_FLUSH | MI_EXE_FLUSH);
 
-       if (pipes & 0x2)
-               mi_wait |= MI_WAIT_FOR_PLANE_B_FLIP;
+       if (!sync) {
+               u32 mi_wait = MI_WAIT_FOR_EVENT;
 
-       i915_kernel_lost_context(dev);
+               /* Wait for pending flips to take effect */
+               if (pipes & 0x1)
+                       mi_wait |= MI_WAIT_FOR_PLANE_A_FLIP;
 
-       BEGIN_LP_RING(2);
-       OUT_RING(INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE);
-       OUT_RING(0);
-       ADVANCE_LP_RING();
+               if (pipes & 0x2)
+                       mi_wait |= MI_WAIT_FOR_PLANE_B_FLIP;
 
-       /* Wait for pending flips to take effect */
-       BEGIN_LP_RING(2);
-       OUT_RING(mi_wait);
-       OUT_RING(0);
-       ADVANCE_LP_RING();
+               BEGIN_LP_RING(2);
+               OUT_RING(mi_wait);
+               OUT_RING(0);
+               ADVANCE_LP_RING();
+       }
 
        for (i = 0; i < 2; i++)
                if (pipes & (1 << i))
index cc6c12d..de9105a 100644 (file)
@@ -252,10 +252,6 @@ extern int i915_wait_ring(drm_device_t * dev, int n, const char *caller);
 #define CMD_STORE_DWORD_IDX            ((0x21<<23) | 0x1)
 #define CMD_OP_BATCH_BUFFER  ((0x0<<29)|(0x30<<23)|0x1)
 
-#define INST_PARSER_CLIENT   0x00000000
-#define INST_OP_FLUSH        0x02000000
-#define INST_FLUSH_MAP_CACHE 0x00000001
-
 #define CMD_MI_FLUSH         (0x04 << 23)
 #define MI_NO_WRITE_FLUSH    (1 << 2)
 #define MI_READ_FLUSH        (1 << 0)