diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-03-26 16:28:26 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-03-26 16:28:26 +0000 |
commit | 1d6f4078c1e405749ff688058ef76c287ab36201 (patch) | |
tree | df697795d29b719d7040f02e9f2c1544edd75c4b /src/sna/gen4_vertex.c | |
parent | 0b479504c82bd81c0b93de0e6529eae928eea3bf (diff) |
sna/gen4+: Reorder code to compile on squeeze
Remember to only use sse4_2, avx2 in their restricted sections that
check for compiler support.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/gen4_vertex.c')
-rw-r--r-- | src/sna/gen4_vertex.c | 636 |
1 files changed, 318 insertions, 318 deletions
diff --git a/src/sna/gen4_vertex.c b/src/sna/gen4_vertex.c index 78d89722..cd366c96 100644 --- a/src/sna/gen4_vertex.c +++ b/src/sna/gen4_vertex.c @@ -739,160 +739,6 @@ emit_boxes_identity_mask(const struct sna_composite_op *op, } while (--nbox); } -sse4_2 fastcall static void -emit_primitive_identity_mask__sse4_2(struct sna *sna, - const struct sna_composite_op *op, - const struct sna_composite_rectangles *r) -{ - union { - struct sna_coordinate p; - float f; - } dst; - float msk_x, msk_y; - float w, h; - float *v; - - msk_x = r->mask.x + op->mask.offset[0]; - msk_y = r->mask.y + op->mask.offset[1]; - w = r->width; - h = r->height; - - DBG(("%s: dst=(%d, %d), mask=(%f, %f) x (%f, %f)\n", - __FUNCTION__, r->dst.x, r->dst.y, msk_x, msk_y, w, h)); - - assert(op->floats_per_rect == 12); - assert((sna->render.vertex_used % 4) == 0); - v = sna->render.vertices + sna->render.vertex_used; - sna->render.vertex_used += 12; - - dst.p.x = r->dst.x + r->width; - dst.p.y = r->dst.y + r->height; - v[0] = dst.f; - v[2] = (msk_x + w) * op->mask.scale[0]; - v[7] = v[3] = (msk_y + h) * op->mask.scale[1]; - - dst.p.x = r->dst.x; - v[4] = dst.f; - v[10] = v[6] = msk_x * op->mask.scale[0]; - - dst.p.y = r->dst.y; - v[8] = dst.f; - v[11] = msk_y * op->mask.scale[1]; - - v[9] = v[5] = v[1] = .5; -} - -sse4_2 fastcall static void -emit_boxes_identity_mask__sse4_2(const struct sna_composite_op *op, - const BoxRec *box, int nbox, - float *v) -{ - float msk_x = op->mask.offset[0]; - float msk_y = op->mask.offset[1]; - - do { - union { - struct sna_coordinate p; - float f; - } dst; - - dst.p.x = box->x2; - dst.p.y = box->y2; - v[0] = dst.f; - v[2] = (msk_x + box->x2) * op->mask.scale[0]; - v[7] = v[3] = (msk_y + box->y2) * op->mask.scale[1]; - - dst.p.x = box->x1; - v[4] = dst.f; - v[10] = v[6] = (msk_x + box->x1) * op->mask.scale[0]; - - dst.p.y = box->y1; - v[8] = dst.f; - v[11] = (msk_y + box->y1) * op->mask.scale[1]; - - v[9] = v[5] = v[1] = .5; - v += 12; - box++; - } while (--nbox); -} - -avx2 fastcall static void -emit_primitive_identity_mask__avx2(struct sna *sna, - const struct sna_composite_op *op, - const struct sna_composite_rectangles *r) -{ - union { - struct sna_coordinate p; - float f; - } dst; - float msk_x, msk_y; - float w, h; - float *v; - - msk_x = r->mask.x + op->mask.offset[0]; - msk_y = r->mask.y + op->mask.offset[1]; - w = r->width; - h = r->height; - - DBG(("%s: dst=(%d, %d), mask=(%f, %f) x (%f, %f)\n", - __FUNCTION__, r->dst.x, r->dst.y, msk_x, msk_y, w, h)); - - assert(op->floats_per_rect == 12); - assert((sna->render.vertex_used % 4) == 0); - v = sna->render.vertices + sna->render.vertex_used; - sna->render.vertex_used += 12; - - dst.p.x = r->dst.x + r->width; - dst.p.y = r->dst.y + r->height; - v[0] = dst.f; - v[2] = (msk_x + w) * op->mask.scale[0]; - v[7] = v[3] = (msk_y + h) * op->mask.scale[1]; - - dst.p.x = r->dst.x; - v[4] = dst.f; - v[10] = v[6] = msk_x * op->mask.scale[0]; - - dst.p.y = r->dst.y; - v[8] = dst.f; - v[11] = msk_y * op->mask.scale[1]; - - v[9] = v[5] = v[1] = .5; -} - -avx2 fastcall static void -emit_boxes_identity_mask__avx2(const struct sna_composite_op *op, - const BoxRec *box, int nbox, - float *v) -{ - float msk_x = op->mask.offset[0]; - float msk_y = op->mask.offset[1]; - - do { - union { - struct sna_coordinate p; - float f; - } dst; - - dst.p.x = box->x2; - dst.p.y = box->y2; - v[0] = dst.f; - v[2] = (msk_x + box->x2) * op->mask.scale[0]; - v[7] = v[3] = (msk_y + box->y2) * op->mask.scale[1]; - - dst.p.x = box->x1; - v[4] = dst.f; - v[10] = v[6] = (msk_x + box->x1) * op->mask.scale[0]; - - dst.p.y = box->y1; - v[8] = dst.f; - v[11] = (msk_y + box->y1) * op->mask.scale[1]; - - v[9] = v[5] = v[1] = .5; - v += 12; - box++; - } while (--nbox); -} - sse2 fastcall static void emit_primitive_linear_identity_mask(struct sna *sna, const struct sna_composite_op *op, @@ -975,170 +821,6 @@ emit_boxes_linear_identity_mask(const struct sna_composite_op *op, } while (--nbox); } -sse4_2 fastcall static void -emit_primitive_linear_identity_mask__sse4_2(struct sna *sna, - const struct sna_composite_op *op, - const struct sna_composite_rectangles *r) -{ - union { - struct sna_coordinate p; - float f; - } dst; - float msk_x, msk_y; - float w, h; - float *v; - - msk_x = r->mask.x + op->mask.offset[0]; - msk_y = r->mask.y + op->mask.offset[1]; - w = r->width; - h = r->height; - - DBG(("%s: dst=(%d, %d), mask=(%f, %f) x (%f, %f)\n", - __FUNCTION__, r->dst.x, r->dst.y, msk_x, msk_y, w, h)); - - assert(op->floats_per_rect == 12); - assert((sna->render.vertex_used % 4) == 0); - v = sna->render.vertices + sna->render.vertex_used; - sna->render.vertex_used += 12; - - dst.p.x = r->dst.x + r->width; - dst.p.y = r->dst.y + r->height; - v[0] = dst.f; - v[2] = (msk_x + w) * op->mask.scale[0]; - v[7] = v[3] = (msk_y + h) * op->mask.scale[1]; - - dst.p.x = r->dst.x; - v[4] = dst.f; - v[10] = v[6] = msk_x * op->mask.scale[0]; - - dst.p.y = r->dst.y; - v[8] = dst.f; - v[11] = msk_y * op->mask.scale[1]; - - v[1] = compute_linear(&op->src, r->src.x+r->width, r->src.y+r->height); - v[5] = compute_linear(&op->src, r->src.x, r->src.y+r->height); - v[9] = compute_linear(&op->src, r->src.x, r->src.y); -} - -sse4_2 fastcall static void -emit_boxes_linear_identity_mask__sse4_2(const struct sna_composite_op *op, - const BoxRec *box, int nbox, - float *v) -{ - float msk_x = op->mask.offset[0]; - float msk_y = op->mask.offset[1]; - - do { - union { - struct sna_coordinate p; - float f; - } dst; - - dst.p.x = box->x2; - dst.p.y = box->y2; - v[0] = dst.f; - v[2] = (msk_x + box->x2) * op->mask.scale[0]; - v[7] = v[3] = (msk_y + box->y2) * op->mask.scale[1]; - - dst.p.x = box->x1; - v[4] = dst.f; - v[10] = v[6] = (msk_x + box->x1) * op->mask.scale[0]; - - dst.p.y = box->y1; - v[8] = dst.f; - v[11] = (msk_y + box->y1) * op->mask.scale[1]; - - v[1] = compute_linear(&op->src, box->x2, box->y2); - v[5] = compute_linear(&op->src, box->x1, box->y2); - v[9] = compute_linear(&op->src, box->x1, box->y1); - - v += 12; - box++; - } while (--nbox); -} - -avx2 fastcall static void -emit_primitive_linear_identity_mask__avx2(struct sna *sna, - const struct sna_composite_op *op, - const struct sna_composite_rectangles *r) -{ - union { - struct sna_coordinate p; - float f; - } dst; - float msk_x, msk_y; - float w, h; - float *v; - - msk_x = r->mask.x + op->mask.offset[0]; - msk_y = r->mask.y + op->mask.offset[1]; - w = r->width; - h = r->height; - - DBG(("%s: dst=(%d, %d), mask=(%f, %f) x (%f, %f)\n", - __FUNCTION__, r->dst.x, r->dst.y, msk_x, msk_y, w, h)); - - assert(op->floats_per_rect == 12); - assert((sna->render.vertex_used % 4) == 0); - v = sna->render.vertices + sna->render.vertex_used; - sna->render.vertex_used += 12; - - dst.p.x = r->dst.x + r->width; - dst.p.y = r->dst.y + r->height; - v[0] = dst.f; - v[2] = (msk_x + w) * op->mask.scale[0]; - v[7] = v[3] = (msk_y + h) * op->mask.scale[1]; - - dst.p.x = r->dst.x; - v[4] = dst.f; - v[10] = v[6] = msk_x * op->mask.scale[0]; - - dst.p.y = r->dst.y; - v[8] = dst.f; - v[11] = msk_y * op->mask.scale[1]; - - v[1] = compute_linear(&op->src, r->src.x+r->width, r->src.y+r->height); - v[5] = compute_linear(&op->src, r->src.x, r->src.y+r->height); - v[9] = compute_linear(&op->src, r->src.x, r->src.y); -} - -avx2 fastcall static void -emit_boxes_linear_identity_mask__avx2(const struct sna_composite_op *op, - const BoxRec *box, int nbox, - float *v) -{ - float msk_x = op->mask.offset[0]; - float msk_y = op->mask.offset[1]; - - do { - union { - struct sna_coordinate p; - float f; - } dst; - - dst.p.x = box->x2; - dst.p.y = box->y2; - v[0] = dst.f; - v[2] = (msk_x + box->x2) * op->mask.scale[0]; - v[7] = v[3] = (msk_y + box->y2) * op->mask.scale[1]; - - dst.p.x = box->x1; - v[4] = dst.f; - v[10] = v[6] = (msk_x + box->x1) * op->mask.scale[0]; - - dst.p.y = box->y1; - v[8] = dst.f; - v[11] = (msk_y + box->y1) * op->mask.scale[1]; - - v[1] = compute_linear(&op->src, box->x2, box->y2); - v[5] = compute_linear(&op->src, box->x1, box->y2); - v[9] = compute_linear(&op->src, box->x1, box->y1); - - v += 12; - box++; - } while (--nbox); -} - sse2 fastcall static void emit_primitive_identity_source_mask(struct sna *sna, const struct sna_composite_op *op, @@ -1488,6 +1170,165 @@ emit_boxes_simple_source__sse4_2(const struct sna_composite_op *op, } while (--nbox); } +sse4_2 fastcall static void +emit_primitive_identity_mask__sse4_2(struct sna *sna, + const struct sna_composite_op *op, + const struct sna_composite_rectangles *r) +{ + union { + struct sna_coordinate p; + float f; + } dst; + float msk_x, msk_y; + float w, h; + float *v; + + msk_x = r->mask.x + op->mask.offset[0]; + msk_y = r->mask.y + op->mask.offset[1]; + w = r->width; + h = r->height; + + DBG(("%s: dst=(%d, %d), mask=(%f, %f) x (%f, %f)\n", + __FUNCTION__, r->dst.x, r->dst.y, msk_x, msk_y, w, h)); + + assert(op->floats_per_rect == 12); + assert((sna->render.vertex_used % 4) == 0); + v = sna->render.vertices + sna->render.vertex_used; + sna->render.vertex_used += 12; + + dst.p.x = r->dst.x + r->width; + dst.p.y = r->dst.y + r->height; + v[0] = dst.f; + v[2] = (msk_x + w) * op->mask.scale[0]; + v[7] = v[3] = (msk_y + h) * op->mask.scale[1]; + + dst.p.x = r->dst.x; + v[4] = dst.f; + v[10] = v[6] = msk_x * op->mask.scale[0]; + + dst.p.y = r->dst.y; + v[8] = dst.f; + v[11] = msk_y * op->mask.scale[1]; + + v[9] = v[5] = v[1] = .5; +} + +sse4_2 fastcall static void +emit_boxes_identity_mask__sse4_2(const struct sna_composite_op *op, + const BoxRec *box, int nbox, + float *v) +{ + float msk_x = op->mask.offset[0]; + float msk_y = op->mask.offset[1]; + + do { + union { + struct sna_coordinate p; + float f; + } dst; + + dst.p.x = box->x2; + dst.p.y = box->y2; + v[0] = dst.f; + v[2] = (msk_x + box->x2) * op->mask.scale[0]; + v[7] = v[3] = (msk_y + box->y2) * op->mask.scale[1]; + + dst.p.x = box->x1; + v[4] = dst.f; + v[10] = v[6] = (msk_x + box->x1) * op->mask.scale[0]; + + dst.p.y = box->y1; + v[8] = dst.f; + v[11] = (msk_y + box->y1) * op->mask.scale[1]; + + v[9] = v[5] = v[1] = .5; + v += 12; + box++; + } while (--nbox); +} + +sse4_2 fastcall static void +emit_primitive_linear_identity_mask__sse4_2(struct sna *sna, + const struct sna_composite_op *op, + const struct sna_composite_rectangles *r) +{ + union { + struct sna_coordinate p; + float f; + } dst; + float msk_x, msk_y; + float w, h; + float *v; + + msk_x = r->mask.x + op->mask.offset[0]; + msk_y = r->mask.y + op->mask.offset[1]; + w = r->width; + h = r->height; + + DBG(("%s: dst=(%d, %d), mask=(%f, %f) x (%f, %f)\n", + __FUNCTION__, r->dst.x, r->dst.y, msk_x, msk_y, w, h)); + + assert(op->floats_per_rect == 12); + assert((sna->render.vertex_used % 4) == 0); + v = sna->render.vertices + sna->render.vertex_used; + sna->render.vertex_used += 12; + + dst.p.x = r->dst.x + r->width; + dst.p.y = r->dst.y + r->height; + v[0] = dst.f; + v[2] = (msk_x + w) * op->mask.scale[0]; + v[7] = v[3] = (msk_y + h) * op->mask.scale[1]; + + dst.p.x = r->dst.x; + v[4] = dst.f; + v[10] = v[6] = msk_x * op->mask.scale[0]; + + dst.p.y = r->dst.y; + v[8] = dst.f; + v[11] = msk_y * op->mask.scale[1]; + + v[1] = compute_linear(&op->src, r->src.x+r->width, r->src.y+r->height); + v[5] = compute_linear(&op->src, r->src.x, r->src.y+r->height); + v[9] = compute_linear(&op->src, r->src.x, r->src.y); +} + +sse4_2 fastcall static void +emit_boxes_linear_identity_mask__sse4_2(const struct sna_composite_op *op, + const BoxRec *box, int nbox, + float *v) +{ + float msk_x = op->mask.offset[0]; + float msk_y = op->mask.offset[1]; + + do { + union { + struct sna_coordinate p; + float f; + } dst; + + dst.p.x = box->x2; + dst.p.y = box->y2; + v[0] = dst.f; + v[2] = (msk_x + box->x2) * op->mask.scale[0]; + v[7] = v[3] = (msk_y + box->y2) * op->mask.scale[1]; + + dst.p.x = box->x1; + v[4] = dst.f; + v[10] = v[6] = (msk_x + box->x1) * op->mask.scale[0]; + + dst.p.y = box->y1; + v[8] = dst.f; + v[11] = (msk_y + box->y1) * op->mask.scale[1]; + + v[1] = compute_linear(&op->src, box->x2, box->y2); + v[5] = compute_linear(&op->src, box->x1, box->y2); + v[9] = compute_linear(&op->src, box->x1, box->y1); + + v += 12; + box++; + } while (--nbox); +} + #endif /* AVX2 */ @@ -1691,6 +1532,165 @@ emit_boxes_simple_source__avx2(const struct sna_composite_op *op, } while (--nbox); } +avx2 fastcall static void +emit_primitive_identity_mask__avx2(struct sna *sna, + const struct sna_composite_op *op, + const struct sna_composite_rectangles *r) +{ + union { + struct sna_coordinate p; + float f; + } dst; + float msk_x, msk_y; + float w, h; + float *v; + + msk_x = r->mask.x + op->mask.offset[0]; + msk_y = r->mask.y + op->mask.offset[1]; + w = r->width; + h = r->height; + + DBG(("%s: dst=(%d, %d), mask=(%f, %f) x (%f, %f)\n", + __FUNCTION__, r->dst.x, r->dst.y, msk_x, msk_y, w, h)); + + assert(op->floats_per_rect == 12); + assert((sna->render.vertex_used % 4) == 0); + v = sna->render.vertices + sna->render.vertex_used; + sna->render.vertex_used += 12; + + dst.p.x = r->dst.x + r->width; + dst.p.y = r->dst.y + r->height; + v[0] = dst.f; + v[2] = (msk_x + w) * op->mask.scale[0]; + v[7] = v[3] = (msk_y + h) * op->mask.scale[1]; + + dst.p.x = r->dst.x; + v[4] = dst.f; + v[10] = v[6] = msk_x * op->mask.scale[0]; + + dst.p.y = r->dst.y; + v[8] = dst.f; + v[11] = msk_y * op->mask.scale[1]; + + v[9] = v[5] = v[1] = .5; +} + +avx2 fastcall static void +emit_boxes_identity_mask__avx2(const struct sna_composite_op *op, + const BoxRec *box, int nbox, + float *v) +{ + float msk_x = op->mask.offset[0]; + float msk_y = op->mask.offset[1]; + + do { + union { + struct sna_coordinate p; + float f; + } dst; + + dst.p.x = box->x2; + dst.p.y = box->y2; + v[0] = dst.f; + v[2] = (msk_x + box->x2) * op->mask.scale[0]; + v[7] = v[3] = (msk_y + box->y2) * op->mask.scale[1]; + + dst.p.x = box->x1; + v[4] = dst.f; + v[10] = v[6] = (msk_x + box->x1) * op->mask.scale[0]; + + dst.p.y = box->y1; + v[8] = dst.f; + v[11] = (msk_y + box->y1) * op->mask.scale[1]; + + v[9] = v[5] = v[1] = .5; + v += 12; + box++; + } while (--nbox); +} + +avx2 fastcall static void +emit_primitive_linear_identity_mask__avx2(struct sna *sna, + const struct sna_composite_op *op, + const struct sna_composite_rectangles *r) +{ + union { + struct sna_coordinate p; + float f; + } dst; + float msk_x, msk_y; + float w, h; + float *v; + + msk_x = r->mask.x + op->mask.offset[0]; + msk_y = r->mask.y + op->mask.offset[1]; + w = r->width; + h = r->height; + + DBG(("%s: dst=(%d, %d), mask=(%f, %f) x (%f, %f)\n", + __FUNCTION__, r->dst.x, r->dst.y, msk_x, msk_y, w, h)); + + assert(op->floats_per_rect == 12); + assert((sna->render.vertex_used % 4) == 0); + v = sna->render.vertices + sna->render.vertex_used; + sna->render.vertex_used += 12; + + dst.p.x = r->dst.x + r->width; + dst.p.y = r->dst.y + r->height; + v[0] = dst.f; + v[2] = (msk_x + w) * op->mask.scale[0]; + v[7] = v[3] = (msk_y + h) * op->mask.scale[1]; + + dst.p.x = r->dst.x; + v[4] = dst.f; + v[10] = v[6] = msk_x * op->mask.scale[0]; + + dst.p.y = r->dst.y; + v[8] = dst.f; + v[11] = msk_y * op->mask.scale[1]; + + v[1] = compute_linear(&op->src, r->src.x+r->width, r->src.y+r->height); + v[5] = compute_linear(&op->src, r->src.x, r->src.y+r->height); + v[9] = compute_linear(&op->src, r->src.x, r->src.y); +} + +avx2 fastcall static void +emit_boxes_linear_identity_mask__avx2(const struct sna_composite_op *op, + const BoxRec *box, int nbox, + float *v) +{ + float msk_x = op->mask.offset[0]; + float msk_y = op->mask.offset[1]; + + do { + union { + struct sna_coordinate p; + float f; + } dst; + + dst.p.x = box->x2; + dst.p.y = box->y2; + v[0] = dst.f; + v[2] = (msk_x + box->x2) * op->mask.scale[0]; + v[7] = v[3] = (msk_y + box->y2) * op->mask.scale[1]; + + dst.p.x = box->x1; + v[4] = dst.f; + v[10] = v[6] = (msk_x + box->x1) * op->mask.scale[0]; + + dst.p.y = box->y1; + v[8] = dst.f; + v[11] = (msk_y + box->y1) * op->mask.scale[1]; + + v[1] = compute_linear(&op->src, box->x2, box->y2); + v[5] = compute_linear(&op->src, box->x1, box->y2); + v[9] = compute_linear(&op->src, box->x1, box->y1); + + v += 12; + box++; + } while (--nbox); +} + #endif unsigned gen4_choose_composite_emitter(struct sna *sna, struct sna_composite_op *tmp) |