summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-10-18 00:29:18 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2011-10-18 10:29:33 +0100
commit4b1398f26d4de44167096c6548ff7384c24d5e06 (patch)
treed149d2b1ad1d284d8cdf2bc12cde252fef1dcad3
parentb2d842df5e3198dab401fbd450d4af83d44917dd (diff)
sna/gen6: Micro-optimise gen6_rectangle_begin
We can only emit state between primitives, ergo we need only check for state updates if we've finished the vbo or are starting a new operation. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/gen6_render.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/sna/gen6_render.c b/src/sna/gen6_render.c
index 2ba7c395..147693d5 100644
--- a/src/sna/gen6_render.c
+++ b/src/sna/gen6_render.c
@@ -1448,25 +1448,19 @@ static void gen6_emit_primitive(struct sna *sna)
static bool gen6_rectangle_begin(struct sna *sna,
const struct sna_composite_op *op)
{
- int id = op->u.gen6.ve_id;
+ int id = 1 << op->u.gen6.ve_id;
int ndwords;
- ndwords = 0;
- if ((sna->render_state.gen6.vb_id & (1 << id)) == 0)
+ ndwords = op->need_magic_ca_pass ? 60 : 6;
+ if ((sna->render_state.gen6.vb_id & id) == 0)
ndwords += 5;
- if (sna->render_state.gen6.vertex_offset == 0)
- ndwords += op->need_magic_ca_pass ? 60 : 6;
- if (ndwords == 0)
- return true;
-
if (!kgem_check_batch(&sna->kgem, ndwords))
return false;
- if ((sna->render_state.gen6.vb_id & (1 << id)) == 0)
+ if ((sna->render_state.gen6.vb_id & id) == 0)
gen6_emit_vertex_buffer(sna, op);
- if (sna->render_state.gen6.vertex_offset == 0)
- gen6_emit_primitive(sna);
+ gen6_emit_primitive(sna);
return true;
}
@@ -1499,7 +1493,8 @@ inline static int gen6_get_rectangles(struct sna *sna,
return 0;
}
- if (!gen6_rectangle_begin(sna, op))
+ if (sna->render_state.gen6.vertex_offset == 0 &&
+ !gen6_rectangle_begin(sna, op))
return 0;
if (want > 1 && want * op->floats_per_vertex*3 > rem)