diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-01-31 21:57:41 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-01-31 22:51:31 +0000 |
commit | 268285d9a64fc47fe81fe5bfbfbd1890dad53e1e (patch) | |
tree | 9f3dacfe044c600d10122c958ba978e776a2cf65 /src/sna/gen3_render.c | |
parent | 1239e012ae6d4f00ce73f32d7244905a601170ea (diff) |
sna/gen3+: Flush vertex threads before touching global state
We need to be careful not just when finishing the current vbo to
synchronize with the sharing threads, but also before we emit the batch
state that no other thread will try and do the same.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/gen3_render.c')
-rw-r--r-- | src/sna/gen3_render.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/sna/gen3_render.c b/src/sna/gen3_render.c index 06c4e784..6b9a2f81 100644 --- a/src/sna/gen3_render.c +++ b/src/sna/gen3_render.c @@ -1900,6 +1900,9 @@ static bool gen3_rectangle_begin(struct sna *sna, struct gen3_render_state *state = &sna->render_state.gen3; int ndwords, i1_cmd = 0, i1_len = 0; + if (sna_vertex_wait__locked(&sna->render) && sna->render.vertex_offset) + return true; + ndwords = 2; if (op->need_magic_ca_pass) ndwords += 100; @@ -1939,6 +1942,13 @@ static bool gen3_rectangle_begin(struct sna *sna, static int gen3_get_rectangles__flush(struct sna *sna, const struct sna_composite_op *op) { + /* Preventing discarding new vbo after lock contention */ + if (sna_vertex_wait__locked(&sna->render)) { + int rem = vertex_space(sna); + if (rem > op->floats_per_rect) + return rem; + } + if (!kgem_check_batch(&sna->kgem, op->need_magic_ca_pass ? 105: 5)) return 0; if (!kgem_check_reloc_and_exec(&sna->kgem, 1)) @@ -1955,17 +1965,6 @@ static int gen3_get_rectangles__flush(struct sna *sna, } } - /* Preventing discarding new vbo after lock contention */ - if (sna->render.active) { - int rem; - - sna_vertex_wait__locked(&sna->render); - - rem = vertex_space(sna); - if (rem > op->floats_per_rect) - return rem; - } - return gen3_vertex_finish(sna); } |