diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-01-26 23:03:33 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-01-27 13:06:46 +0000 |
commit | 9a7bf70365980809d0f02190f2f620a957ff1ba8 (patch) | |
tree | 754fc42b19f596a697c41e8045abf0223fb6b5be /src/sna/gen5_render.c | |
parent | 8178cff5718e69e14d3953a7f754d7585a06838f (diff) |
sna: Enable threaded rasterisation for non-antialiased geometry
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/gen5_render.c')
-rw-r--r-- | src/sna/gen5_render.c | 68 |
1 files changed, 64 insertions, 4 deletions
diff --git a/src/sna/gen5_render.c b/src/sna/gen5_render.c index 81e6635a..998d55e2 100644 --- a/src/sna/gen5_render.c +++ b/src/sna/gen5_render.c @@ -1095,9 +1095,9 @@ gen5_render_composite_box(struct sna *sna, } static void -gen5_render_composite_boxes(struct sna *sna, - const struct sna_composite_op *op, - const BoxRec *box, int nbox) +gen5_render_composite_boxes__blt(struct sna *sna, + const struct sna_composite_op *op, + const BoxRec *box, int nbox) { DBG(("%s(%d) delta=(%d, %d), src=(%d, %d)/(%d, %d), mask=(%d, %d)/(%d, %d)\n", __FUNCTION__, nbox, op->dst.x, op->dst.y, @@ -1131,6 +1131,62 @@ gen5_render_composite_boxes(struct sna *sna, } while (nbox); } +static void +gen5_render_composite_boxes(struct sna *sna, + const struct sna_composite_op *op, + const BoxRec *box, int nbox) +{ + DBG(("%s: nbox=%d\n", nbox)); + + do { + int nbox_this_time; + float *v; + + nbox_this_time = gen5_get_rectangles(sna, op, nbox, + gen5_bind_surfaces); + assert(nbox_this_time); + nbox -= nbox_this_time; + + v = sna->render.vertices + sna->render.vertex_used; + sna->render.vertex_used += nbox_this_time * op->floats_per_rect; + + op->emit_boxes(op, box, nbox_this_time, v); + box += nbox_this_time; + } while (nbox); +} + +static void +gen5_render_composite_boxes__thread(struct sna *sna, + const struct sna_composite_op *op, + const BoxRec *box, int nbox) +{ + DBG(("%s: nbox=%d\n", nbox)); + + sna_vertex_lock(&sna->render); + do { + int nbox_this_time; + float *v; + + nbox_this_time = gen5_get_rectangles(sna, op, nbox, + gen5_bind_surfaces); + assert(nbox_this_time); + nbox -= nbox_this_time; + + v = sna->render.vertices + sna->render.vertex_used; + sna->render.vertex_used += nbox_this_time * op->floats_per_rect; + + sna_vertex_acquire__locked(&sna->render); + sna_vertex_unlock(&sna->render); + + op->emit_boxes(op, box, nbox_this_time, v); + box += nbox_this_time; + + sna_vertex_lock(&sna->render); + sna_vertex_release__locked(&sna->render); + } while (nbox); + sna_vertex_unlock(&sna->render); +} + #ifndef MAX #define MAX(a,b) ((a) > (b) ? (a) : (b)) #endif @@ -1874,7 +1930,11 @@ gen5_render_composite(struct sna *sna, tmp->blt = gen5_render_composite_blt; tmp->box = gen5_render_composite_box; - tmp->boxes = gen5_render_composite_boxes; + tmp->boxes = gen5_render_composite_boxes__blt; + if (tmp->emit_boxes) { + tmp->boxes = gen5_render_composite_boxes; + tmp->thread_boxes = gen5_render_composite_boxes__thread; + } tmp->done = gen5_render_composite_done; if (!kgem_check_bo(&sna->kgem, |