summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-01-11 12:13:18 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-01-11 12:13:18 +0000
commite94807759eb6cfb10bd2d372fa71cc64a730bc7c (patch)
tree8f91a19f05ed083189d965251d12a617212d9d2c /src
parent0a5313900ec9a7c499eb5051f3a5f078a9b0bbde (diff)
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>
Diffstat (limited to 'src')
-rw-r--r--src/sna/gen6_render.c44
1 files changed, 42 insertions, 2 deletions
diff --git a/src/sna/gen6_render.c b/src/sna/gen6_render.c
index 38d7f96d..c7d4e7b3 100644
--- a/src/sna/gen6_render.c
+++ b/src/sna/gen6_render.c
@@ -2603,6 +2603,44 @@ gen6_emit_composite_spans_solid(struct sna *sna,
}
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,
const BoxRec *box,
@@ -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];