sna/gen7: Rework random GPU flushing
authorChris Wilson <chris@chris-wilson.co.uk>
Mon, 18 Nov 2013 16:59:08 +0000 (16:59 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Mon, 18 Nov 2013 18:25:55 +0000 (18:25 +0000)
There seems to be no clear rationale for these flushes. They have been
empirically derived to pass test/render-copyarea and rendercheck,
without impacting upon a few simple benchmarks.

References: https://bugs.freedesktop.org/show_bug.cgi?id=68410
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
src/sna/gen7_render.c

index f940803..9a7be4c 100644 (file)
@@ -1109,9 +1109,7 @@ gen7_emit_state(struct sna *sna,
        if (ALWAYS_INVALIDATE)
                need_invalidate = true;
 
-       need_flush =
-               sna->render_state.gen7.emit_flush &&
-               wm_binding_table & GEN7_READS_DST(op->u.gen7.flags);
+       need_flush = wm_binding_table & 1 || sna->render_state.gen7.emit_flush;
        if (ALWAYS_FLUSH)
                need_flush = true;
 
@@ -1535,6 +1533,9 @@ static void gen7_emit_composite_state(struct sna *sna,
                offset = sna->render_state.gen7.surface_table;
        }
 
+       if (sna->kgem.batch[sna->render_state.gen7.surface_table] == binding_table[0])
+               dirty = 0;
+
        gen7_emit_state(sna, op, offset | dirty);
 }
 
@@ -2810,6 +2811,9 @@ gen7_emit_copy_state(struct sna *sna,
                offset = sna->render_state.gen7.surface_table;
        }
 
+       if (sna->kgem.batch[sna->render_state.gen7.surface_table] == binding_table[0])
+               dirty = 0;
+
        assert(!GEN7_READS_DST(op->u.gen7.flags));
        gen7_emit_state(sna, op, offset | dirty);
 }
@@ -3242,6 +3246,9 @@ gen7_emit_fill_state(struct sna *sna, const struct sna_composite_op *op)
                offset = sna->render_state.gen7.surface_table;
        }
 
+       if (sna->kgem.batch[sna->render_state.gen7.surface_table] == binding_table[0])
+               dirty = 0;
+
        gen7_emit_state(sna, op, offset | dirty);
 }