sna/gen6: Special case spans with no transform

As the no transform is a special case of affine, we were attempting to
deference the NULL transform in order to determine if it was a simple
no-rotation matrix. As the operation is extremely simple, add a special
case vertex program to speed it up.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2012-01-11 12:13:18 +00:00
parent 0a5313900e
commit e94807759e
1 changed files with 42 additions and 2 deletions

View File

@ -2602,6 +2602,44 @@ gen6_emit_composite_spans_solid(struct sna *sna,
OUT_VERTEX_F(opacity); OUT_VERTEX_F(0);
}
fastcall static void
gen6_emit_composite_spans_identity(struct sna *sna,
const struct sna_composite_spans_op *op,
const BoxRec *box,
float opacity)
{
float *v;
union {
struct sna_coordinate p;
float f;
} dst;
float sx = op->base.src.scale[0];
float sy = op->base.src.scale[1];
int16_t tx = op->base.src.offset[0];
int16_t ty = op->base.src.offset[1];
v = sna->render.vertex_data + sna->render.vertex_used;
sna->render.vertex_used += 3*5;
dst.p.x = box->x2;
dst.p.y = box->y2;
v[0] = dst.f;
v[1] = (box->x2 + tx) * sx;
v[7] = v[2] = (box->y2 + ty) * sy;
v[13] = v[8] = v[3] = opacity;
v[9] = v[4] = 1;
dst.p.x = box->x1;
v[5] = dst.f;
v[11] = v[6] = (box->x1 + tx) * sx;
dst.p.y = box->y1;
v[10] = dst.f;
v[12] = (box->y1 + ty) * sy;
v[14] = 0;
}
fastcall static void
gen6_emit_composite_spans_simple(struct sna *sna,
const struct sna_composite_spans_op *op,
@ -2795,9 +2833,11 @@ gen6_render_composite_spans(struct sna *sna,
gen6_composite_alpha_gradient_init(sna, &tmp->base.mask);
tmp->prim_emit = gen6_emit_composite_spans_primitive;
if (tmp->base.src.is_solid)
if (tmp->base.src.is_solid) {
tmp->prim_emit = gen6_emit_composite_spans_solid;
else if (tmp->base.is_affine) {
} else if (tmp->base.src.transform == NULL) {
tmp->prim_emit = gen6_emit_composite_spans_identity;
} else if (tmp->base.is_affine) {
if (tmp->base.src.transform->matrix[0][1] == 0 &&
tmp->base.src.transform->matrix[1][0] == 0) {
tmp->base.src.scale[0] /= tmp->base.src.transform->matrix[2][2];