summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-02-28 10:42:19 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-02-28 10:51:49 +0000
commit8198e5872c3771e2aefabe1e3e93afa94d2ea0ec (patch)
treed777107efeacd05a56c8e7931df3abcca63b5972
parent3c4f29820bca336af2c997bafc7ef288b455813c (diff)
sna/gen3: Tweak glyph rendering fast paths
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/gen3_render.c68
1 files changed, 62 insertions, 6 deletions
diff --git a/src/sna/gen3_render.c b/src/sna/gen3_render.c
index 8f597cfa..bd1eddd2 100644
--- a/src/sna/gen3_render.c
+++ b/src/sna/gen3_render.c
@@ -524,6 +524,31 @@ gen3_emit_composite_primitive_identity_source(struct sna *sna,
}
fastcall static void
+gen3_emit_composite_primitive_identity_source_no_offset(struct sna *sna,
+ const struct sna_composite_op *op,
+ const struct sna_composite_rectangles *r)
+{
+ float w = r->width;
+ float h = r->height;
+ float *v;
+
+ v = sna->render.vertices + sna->render.vertex_used;
+ sna->render.vertex_used += 12;
+
+ v[8] = v[4] = r->dst.x;
+ v[9] = r->dst.y;
+
+ v[0] = v[4] + w;
+ v[5] = v[1] = v[9] + h;
+
+ v[10] = v[6] = r->src.x * op->src.scale[0];
+ v[11] = r->src.y * op->src.scale[1];
+
+ v[2] = v[6] + w * op->src.scale[0];
+ v[7] = v[3] = v[11] + h * op->src.scale[1];
+}
+
+fastcall static void
gen3_emit_composite_primitive_affine_source(struct sna *sna,
const struct sna_composite_op *op,
const struct sna_composite_rectangles *r)
@@ -584,6 +609,31 @@ gen3_emit_composite_primitive_constant_identity_mask(struct sna *sna,
}
fastcall static void
+gen3_emit_composite_primitive_constant_identity_mask_no_offset(struct sna *sna,
+ const struct sna_composite_op *op,
+ const struct sna_composite_rectangles *r)
+{
+ float w = r->width;
+ float h = r->height;
+ float *v;
+
+ v = sna->render.vertices + sna->render.vertex_used;
+ sna->render.vertex_used += 12;
+
+ v[8] = v[4] = r->dst.x;
+ v[9] = r->dst.y;
+
+ v[0] = v[4] + w;
+ v[5] = v[1] = v[9] + h;
+
+ v[10] = v[6] = r->mask.x * op->mask.scale[0];
+ v[11] = r->mask.y * op->mask.scale[1];
+
+ v[2] = v[6] + w * op->mask.scale[0];
+ v[7] = v[3] = v[11] + h * op->mask.scale[1];
+}
+
+fastcall static void
gen3_emit_composite_primitive_identity_source_mask(struct sna *sna,
const struct sna_composite_op *op,
const struct sna_composite_rectangles *r)
@@ -2831,17 +2881,23 @@ gen3_render_composite(struct sna *sna,
tmp->prim_emit = gen3_emit_composite_primitive_affine_gradient;
break;
case SHADER_TEXTURE:
- if (tmp->src.transform == NULL)
- tmp->prim_emit = gen3_emit_composite_primitive_identity_source;
- else if (tmp->src.is_affine)
+ if (tmp->src.transform == NULL) {
+ if ((tmp->src.offset[0]|tmp->src.offset[1]|tmp->dst.x|tmp->dst.y) == 0)
+ tmp->prim_emit = gen3_emit_composite_primitive_identity_source_no_offset;
+ else
+ tmp->prim_emit = gen3_emit_composite_primitive_identity_source;
+ } else if (tmp->src.is_affine)
tmp->prim_emit = gen3_emit_composite_primitive_affine_source;
break;
}
} else if (tmp->mask.u.gen3.type == SHADER_TEXTURE) {
if (tmp->mask.transform == NULL) {
- if (is_constant_ps(tmp->src.u.gen3.type))
- tmp->prim_emit = gen3_emit_composite_primitive_constant_identity_mask;
- else if (tmp->src.transform == NULL)
+ if (is_constant_ps(tmp->src.u.gen3.type)) {
+ if ((tmp->mask.offset[0]|tmp->mask.offset[1]|tmp->dst.x|tmp->dst.y) == 0)
+ tmp->prim_emit = gen3_emit_composite_primitive_constant_identity_mask_no_offset;
+ else
+ tmp->prim_emit = gen3_emit_composite_primitive_constant_identity_mask;
+ } else if (tmp->src.transform == NULL)
tmp->prim_emit = gen3_emit_composite_primitive_identity_source_mask;
else if (tmp->src.is_affine)
tmp->prim_emit = gen3_emit_composite_primitive_affine_source_mask;