From d580a30aaf97687f9669ea72fbc3310c2fea26f1 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Thu, 31 Oct 2013 15:58:47 +0000 Subject: [PATCH] sna/gen7: Flush render cache when changing CC state References: https://bugs.freedesktop.org/show_bug.cgi?id=68410 Signed-off-by: Chris Wilson --- src/sna/gen7_render.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c index b8c46c0..6261f65 100644 --- a/src/sna/gen7_render.c +++ b/src/sna/gen7_render.c @@ -1109,10 +1109,14 @@ gen7_emit_state(struct sna *sna, if (ALWAYS_INVALIDATE) need_invalidate = true; - need_flush = sna->render_state.gen7.emit_flush; + need_flush = + sna->render_state.gen7.emit_flush || + wm_binding_table & GEN7_READS_DST(op->u.gen7.flags); if (ALWAYS_FLUSH) need_flush = true; + wm_binding_table &= ~1; + need_stall = sna->render_state.gen7.surface_table != wm_binding_table; need_stall &= gen7_emit_drawing_rectangle(sna, op); if (ALWAYS_STALL) @@ -1495,12 +1499,14 @@ static void gen7_emit_composite_state(struct sna *sna, const struct sna_composite_op *op) { uint32_t *binding_table; - uint16_t offset; + uint16_t offset, dirty; gen7_get_batch(sna, op); binding_table = gen7_composite_get_binding_table(sna, &offset); + dirty = kgem_bo_is_dirty(op->dst.bo); + binding_table[0] = gen7_bind_bo(sna, op->dst.bo, op->dst.width, op->dst.height, @@ -1529,7 +1535,7 @@ static void gen7_emit_composite_state(struct sna *sna, offset = sna->render_state.gen7.surface_table; } - gen7_emit_state(sna, op, offset); + gen7_emit_state(sna, op, offset | dirty); } static void @@ -1747,7 +1753,7 @@ static void gen7_emit_video_state(struct sna *sna, int src_height[6]; int src_pitch[6]; uint32_t *binding_table; - uint16_t offset; + uint16_t offset, dirty; int n_src, n; gen7_get_batch(sna, op); @@ -1785,6 +1791,8 @@ static void gen7_emit_video_state(struct sna *sna, binding_table = gen7_composite_get_binding_table(sna, &offset); + dirty = kgem_bo_is_dirty(op->dst.bo); + binding_table[0] = gen7_bind_bo(sna, op->dst.bo, op->dst.width, op->dst.height, @@ -1801,7 +1809,7 @@ static void gen7_emit_video_state(struct sna *sna, src_surf_format); } - gen7_emit_state(sna, op, offset); + gen7_emit_state(sna, op, offset | dirty); } static bool @@ -2777,12 +2785,14 @@ gen7_emit_copy_state(struct sna *sna, const struct sna_composite_op *op) { uint32_t *binding_table; - uint16_t offset; + uint16_t offset, dirty; gen7_get_batch(sna, op); binding_table = gen7_composite_get_binding_table(sna, &offset); + dirty = kgem_bo_is_dirty(op->dst.bo); + binding_table[0] = gen7_bind_bo(sna, op->dst.bo, op->dst.width, op->dst.height, @@ -2801,7 +2811,7 @@ gen7_emit_copy_state(struct sna *sna, } assert(!GEN7_READS_DST(op->u.gen7.flags)); - gen7_emit_state(sna, op, offset); + gen7_emit_state(sna, op, offset | dirty); } static inline bool @@ -3198,6 +3208,7 @@ fallback: static void gen7_emit_fill_state(struct sna *sna, const struct sna_composite_op *op) { + uint16_t dirty; uint32_t *binding_table; uint16_t offset; @@ -3211,6 +3222,8 @@ gen7_emit_fill_state(struct sna *sna, const struct sna_composite_op *op) binding_table = gen7_composite_get_binding_table(sna, &offset); + dirty = kgem_bo_is_dirty(op->dst.bo); + binding_table[0] = gen7_bind_bo(sna, op->dst.bo, op->dst.width, op->dst.height, @@ -3229,7 +3242,7 @@ gen7_emit_fill_state(struct sna *sna, const struct sna_composite_op *op) offset = sna->render_state.gen7.surface_table; } - gen7_emit_state(sna, op, offset); + gen7_emit_state(sna, op, offset | dirty); } static bool -- 1.8.4.rc3