summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-01-07 13:43:35 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2014-01-07 14:04:18 +0000
commit9d8473c5d9489db439aca73f470bda29a22ebab6 (patch)
tree144177a5821d4e0b7f8773476ac2c402d88f451a
parent3b177a5e972a8eed63f99b0cd7b048a1229683f5 (diff)
sna/gen4: Check for available batch space before restoring state after CA pass
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73348 References: https://bugs.freedesktop.org/show_bug.cgi?id=55500 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/gen4_render.c12
-rw-r--r--src/sna/gen5_render.c2
2 files changed, 8 insertions, 6 deletions
diff --git a/src/sna/gen4_render.c b/src/sna/gen4_render.c
index 5e18fd05..98e56e78 100644
--- a/src/sna/gen4_render.c
+++ b/src/sna/gen4_render.c
@@ -601,7 +601,7 @@ static bool gen4_rectangle_begin(struct sna *sna,
return true;
/* 7xpipelined pointers + 6xprimitive + 1xflush */
- ndwords = op->need_magic_ca_pass? 20 : 6;
+ ndwords = op->need_magic_ca_pass? 19 : 6;
if ((sna->render.vb_id & id) == 0)
ndwords += 5;
ndwords += 2*FORCE_FLUSH;
@@ -628,7 +628,7 @@ static int gen4_get_rectangles__flush(struct sna *sna,
}
if (!kgem_check_batch(&sna->kgem,
- 2*FORCE_FLUSH + (op->need_magic_ca_pass ? 25 : 6)))
+ 2*FORCE_FLUSH + (op->need_magic_ca_pass ? 2*19+6 : 6)))
return 0;
if (!kgem_check_reloc_and_exec(&sna->kgem, 2))
return 0;
@@ -660,9 +660,11 @@ inline static int gen4_get_rectangles(struct sna *sna,
if (rem <= 0) {
if (sna->render.vertex_offset) {
gen4_vertex_flush(sna);
- if (gen4_magic_ca_pass(sna, op))
- gen4_emit_pipelined_pointers(sna, op, op->op,
- op->u.gen4.wm_kernel);
+ if (gen4_magic_ca_pass(sna, op)) {
+ if (kgem_check_batch(&sna->kgem, 19+6))
+ gen4_emit_pipelined_pointers(sna, op, op->op,
+ op->u.gen4.wm_kernel);
+ }
}
OUT_BATCH(MI_FLUSH | MI_INHIBIT_RENDER_CACHE_FLUSH);
rem = MAX_FLUSH_VERTICES;
diff --git a/src/sna/gen5_render.c b/src/sna/gen5_render.c
index 9266f903..8ec25877 100644
--- a/src/sna/gen5_render.c
+++ b/src/sna/gen5_render.c
@@ -611,7 +611,7 @@ static int gen5_get_rectangles__flush(struct sna *sna,
return rem;
}
- if (!kgem_check_batch(&sna->kgem, op->need_magic_ca_pass ? 20 : 6))
+ if (!kgem_check_batch(&sna->kgem, op->need_magic_ca_pass ? 40 : 6))
return 0;
if (!kgem_check_reloc_and_exec(&sna->kgem, 2))
return 0;