diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-10-10 00:15:55 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-10-10 00:16:58 +0100 |
commit | 97d809c26bec2c0120f2dc0bcfd840379bd996fa (patch) | |
tree | ef30cc41b6b65535a03dfb7c7f58d1587e561015 /src | |
parent | b16999da214803a026d7246ec4aa62031e82dfc8 (diff) |
sna: Pass usage hint down to render fill routines
For the scanlines emitted for rendering Core drawing primitives, it is
preferable to use the BLT engine, so pass those hints down.
Reported-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r-- | src/sna/gen2_render.c | 2 | ||||
-rw-r--r-- | src/sna/gen3_render.c | 2 | ||||
-rw-r--r-- | src/sna/gen4_render.c | 2 | ||||
-rw-r--r-- | src/sna/gen5_render.c | 2 | ||||
-rw-r--r-- | src/sna/gen6_render.c | 15 | ||||
-rw-r--r-- | src/sna/gen7_render.c | 15 | ||||
-rw-r--r-- | src/sna/sna_accel.c | 48 | ||||
-rw-r--r-- | src/sna/sna_render.c | 2 | ||||
-rw-r--r-- | src/sna/sna_render.h | 5 |
9 files changed, 58 insertions, 35 deletions
diff --git a/src/sna/gen2_render.c b/src/sna/gen2_render.c index 9ae8352a..2ee534db 100644 --- a/src/sna/gen2_render.c +++ b/src/sna/gen2_render.c @@ -2943,7 +2943,7 @@ gen2_render_fill_op_done(struct sna *sna, const struct sna_fill_op *op) static bool gen2_render_fill(struct sna *sna, uint8_t alu, PixmapPtr dst, struct kgem_bo *dst_bo, - uint32_t color, + uint32_t color, unsigned flags, struct sna_fill_op *tmp) { #if NO_FILL diff --git a/src/sna/gen3_render.c b/src/sna/gen3_render.c index 2445b91a..cec35f45 100644 --- a/src/sna/gen3_render.c +++ b/src/sna/gen3_render.c @@ -6045,7 +6045,7 @@ gen3_render_fill_op_done(struct sna *sna, const struct sna_fill_op *op) static bool gen3_render_fill(struct sna *sna, uint8_t alu, PixmapPtr dst, struct kgem_bo *dst_bo, - uint32_t color, + uint32_t color, unsigned flags, struct sna_fill_op *tmp) { #if NO_FILL diff --git a/src/sna/gen4_render.c b/src/sna/gen4_render.c index 48a8852d..fe138737 100644 --- a/src/sna/gen4_render.c +++ b/src/sna/gen4_render.c @@ -2716,7 +2716,7 @@ gen4_render_fill_op_done(struct sna *sna, const struct sna_fill_op *op) static bool gen4_render_fill(struct sna *sna, uint8_t alu, PixmapPtr dst, struct kgem_bo *dst_bo, - uint32_t color, + uint32_t color, unsigned flags, struct sna_fill_op *op) { if (sna_blt_fill(sna, alu, diff --git a/src/sna/gen5_render.c b/src/sna/gen5_render.c index ca41a9a8..a0ef9b6e 100644 --- a/src/sna/gen5_render.c +++ b/src/sna/gen5_render.c @@ -2802,7 +2802,7 @@ gen5_render_fill_op_done(struct sna *sna, static bool gen5_render_fill(struct sna *sna, uint8_t alu, PixmapPtr dst, struct kgem_bo *dst_bo, - uint32_t color, + uint32_t color, unsigned flags, struct sna_fill_op *op) { DBG(("%s(alu=%d, color=%08x)\n", __FUNCTION__, alu, color)); diff --git a/src/sna/gen6_render.c b/src/sna/gen6_render.c index 401041c2..3773c27e 100644 --- a/src/sna/gen6_render.c +++ b/src/sna/gen6_render.c @@ -3110,11 +3110,15 @@ gen6_emit_fill_state(struct sna *sna, const struct sna_composite_op *op) } static inline bool prefer_blt_fill(struct sna *sna, - struct kgem_bo *bo) + struct kgem_bo *bo, + unsigned flags) { if (PREFER_RENDER) return PREFER_RENDER < 0; + if (flags & (FILL_POINTS | FILL_SPANS)) + return true; + if (untiled_tlb_miss(bo)) return true; @@ -3154,7 +3158,8 @@ gen6_render_fill_boxes(struct sna *sna, return false; } - if (prefer_blt_fill(sna, dst_bo) || !gen6_check_dst_format(format)) { + if (prefer_blt_fill(sna, dst_bo, FILL_BOXES) || + !gen6_check_dst_format(format)) { uint8_t alu = GXinvalid; if (op <= PictOpSrc) { @@ -3365,12 +3370,12 @@ gen6_render_op_fill_done(struct sna *sna, const struct sna_fill_op *op) static bool gen6_render_fill(struct sna *sna, uint8_t alu, PixmapPtr dst, struct kgem_bo *dst_bo, - uint32_t color, + uint32_t color, unsigned flags, struct sna_fill_op *op) { DBG(("%s: (alu=%d, color=%x)\n", __FUNCTION__, alu, color)); - if (prefer_blt_fill(sna, dst_bo) && + if (prefer_blt_fill(sna, dst_bo, flags) && sna_blt_fill(sna, alu, dst_bo, dst->drawable.bitsPerPixel, color, @@ -3454,7 +3459,7 @@ gen6_render_fill_one(struct sna *sna, PixmapPtr dst, struct kgem_bo *bo, int16_t *v; /* Prefer to use the BLT if already engaged */ - if (prefer_blt_fill(sna, bo) && + if (prefer_blt_fill(sna, bo, FILL_BOXES) && gen6_render_fill_one_try_blt(sna, dst, bo, color, x1, y1, x2, y2, alu)) return true; diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c index e17fc949..37eb8dd9 100644 --- a/src/sna/gen7_render.c +++ b/src/sna/gen7_render.c @@ -3346,8 +3346,12 @@ gen7_emit_fill_state(struct sna *sna, const struct sna_composite_op *op) } static inline bool prefer_blt_fill(struct sna *sna, - struct kgem_bo *bo) + struct kgem_bo *bo, + unsigned flags) { + if (flags & (FILL_POINTS | FILL_SPANS)) + return true; + if (untiled_tlb_miss(bo)) return true; @@ -3387,7 +3391,8 @@ gen7_render_fill_boxes(struct sna *sna, return false; } - if (prefer_blt_fill(sna, dst_bo) || !gen7_check_dst_format(format)) { + if (prefer_blt_fill(sna, dst_bo, FILL_BOXES) || + !gen7_check_dst_format(format)) { uint8_t alu = GXinvalid; if (op <= PictOpSrc) { @@ -3593,12 +3598,12 @@ gen7_render_fill_op_done(struct sna *sna, const struct sna_fill_op *op) static bool gen7_render_fill(struct sna *sna, uint8_t alu, PixmapPtr dst, struct kgem_bo *dst_bo, - uint32_t color, + uint32_t color, unsigned flags, struct sna_fill_op *op) { DBG(("%s: (alu=%d, color=%x)\n", __FUNCTION__, alu, color)); - if (prefer_blt_fill(sna, dst_bo) && + if (prefer_blt_fill(sna, dst_bo, flags) && sna_blt_fill(sna, alu, dst_bo, dst->drawable.bitsPerPixel, color, @@ -3680,7 +3685,7 @@ gen7_render_fill_one(struct sna *sna, PixmapPtr dst, struct kgem_bo *bo, int16_t *v; /* Prefer to use the BLT if already engaged */ - if (prefer_blt_fill(sna, bo) && + if (prefer_blt_fill(sna, bo, FILL_BOXES) && gen7_render_fill_one_try_blt(sna, dst, bo, color, x1, y1, x2, y2, alu)) return true; diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index 7891a5f6..21bda10c 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -422,9 +422,10 @@ sna_fill_init_blt(struct sna_fill_op *fill, PixmapPtr pixmap, struct kgem_bo *bo, uint8_t alu, - uint32_t pixel) + uint32_t pixel, + unsigned flags) { - return sna->render.fill(sna, alu, pixmap, bo, pixel, fill); + return sna->render.fill(sna, alu, pixmap, bo, pixel, flags, fill); } static bool @@ -5418,7 +5419,8 @@ sna_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc, if (!sna_fill_init_blt(&fill, sna, dst_pixmap, bo, - alu, src_priv->clear_color)) { + alu, src_priv->clear_color, + FILL_BOXES)) { DBG(("%s: unsupported fill\n", __FUNCTION__)); goto fallback; @@ -6140,7 +6142,8 @@ sna_poly_point__gpu(DrawablePtr drawable, GCPtr gc, if (!sna_fill_init_blt(&fill, data->sna, data->pixmap, - data->bo, gc->alu, gc->fgPixel)) + data->bo, gc->alu, gc->fgPixel, + FILL_POINTS)) return; DBG(("%s: count=%d\n", __FUNCTION__, n)); @@ -6541,7 +6544,7 @@ sna_fill_spans_blt(DrawablePtr drawable, DBG(("%s: alu=%d, fg=%08lx, damge=%p, clipped?=%d\n", __FUNCTION__, gc->alu, gc->fgPixel, damage, clipped)); - if (!sna_fill_init_blt(&fill, sna, pixmap, bo, gc->alu, pixel)) + if (!sna_fill_init_blt(&fill, sna, pixmap, bo, gc->alu, pixel, FILL_SPANS)) return false; get_drawable_deltas(drawable, pixmap, &dx, &dy); @@ -7625,7 +7628,7 @@ sna_poly_point_blt(DrawablePtr drawable, DBG(("%s: alu=%d, pixel=%08lx, clipped?=%d\n", __FUNCTION__, gc->alu, gc->fgPixel, clipped)); - if (!sna_fill_init_blt(&fill, sna, pixmap, bo, gc->alu, gc->fgPixel)) + if (!sna_fill_init_blt(&fill, sna, pixmap, bo, gc->alu, gc->fgPixel, FILL_POINTS)) return false; get_drawable_deltas(drawable, pixmap, &dx, &dy); @@ -7841,7 +7844,7 @@ sna_poly_zero_line_blt(DrawablePtr drawable, DBG(("%s: alu=%d, pixel=%lx, n=%d, clipped=%d, damage=%p\n", __FUNCTION__, gc->alu, gc->fgPixel, _n, clipped, damage)); - if (!sna_fill_init_blt(&fill, sna, pixmap, bo, gc->alu, gc->fgPixel)) + if (!sna_fill_init_blt(&fill, sna, pixmap, bo, gc->alu, gc->fgPixel, FILL_SPANS)) return false; get_drawable_deltas(drawable, pixmap, &dx, &dy); @@ -8212,7 +8215,7 @@ sna_poly_line_blt(DrawablePtr drawable, DBG(("%s: alu=%d, fg=%08x\n", __FUNCTION__, gc->alu, (unsigned)pixel)); - if (!sna_fill_init_blt(&fill, sna, pixmap, bo, gc->alu, pixel)) + if (!sna_fill_init_blt(&fill, sna, pixmap, bo, gc->alu, pixel, FILL_BOXES)) return false; get_drawable_deltas(drawable, pixmap, &dx, &dy); @@ -8709,7 +8712,8 @@ spans_fallback: if (gc->lineStyle == LineSolid) { if (!sna_fill_init_blt(&fill, data.sna, data.pixmap, - data.bo, gc->alu, color)) + data.bo, gc->alu, color, + FILL_POINTS | FILL_SPANS)) goto fallback; data.op = &fill; @@ -8768,7 +8772,8 @@ spans_fallback: DBG(("%s: miZeroLine (solid dash)\n", __FUNCTION__)); if (!sna_fill_init_blt(&fill, data.sna, data.pixmap, - data.bo, gc->alu, color)) + data.bo, gc->alu, color, + FILL_POINTS | FILL_SPANS)) goto fallback; gc->ops = &sna_gc_ops__tmp; @@ -8778,7 +8783,8 @@ spans_fallback: if (sna_fill_init_blt(&fill, data.sna, data.pixmap, data.bo, gc->alu, - gc->bgPixel)) { + gc->bgPixel, + FILL_POINTS | FILL_SPANS)) { miZeroDashLine(drawable, gc, mode, n, pt); fill.done(data.sna, &fill); } @@ -8911,7 +8917,7 @@ sna_poly_segment_blt(DrawablePtr drawable, DBG(("%s: n=%d, alu=%d, fg=%08lx, clipped=%d\n", __FUNCTION__, n, gc->alu, gc->fgPixel, clipped)); - if (!sna_fill_init_blt(&fill, sna, pixmap, bo, gc->alu, pixel)) + if (!sna_fill_init_blt(&fill, sna, pixmap, bo, gc->alu, pixel, FILL_SPANS)) return false; get_drawable_deltas(drawable, pixmap, &dx, &dy); @@ -9065,7 +9071,7 @@ sna_poly_zero_segment_blt(DrawablePtr drawable, DBG(("%s: alu=%d, pixel=%lx, n=%d, clipped=%d, damage=%p\n", __FUNCTION__, gc->alu, gc->fgPixel, _n, clipped, damage)); - if (!sna_fill_init_blt(&fill, sna, pixmap, bo, gc->alu, gc->fgPixel)) + if (!sna_fill_init_blt(&fill, sna, pixmap, bo, gc->alu, gc->fgPixel, FILL_BOXES)) return false; get_drawable_deltas(drawable, pixmap, &dx, &dy); @@ -9628,7 +9634,8 @@ spans_fallback: if (!sna_fill_init_blt(&fill, data.sna, data.pixmap, - data.bo, gc->alu, color)) + data.bo, gc->alu, color, + FILL_POINTS | FILL_SPANS)) goto fallback; data.op = &fill; @@ -9773,7 +9780,7 @@ sna_poly_rectangle_blt(DrawablePtr drawable, DBG(("%s: n=%d, alu=%d, width=%d, fg=%08lx, damge=%p, clipped?=%d\n", __FUNCTION__, n, gc->alu, gc->lineWidth, gc->fgPixel, damage, clipped)); - if (!sna_fill_init_blt(&fill, sna, pixmap, bo, gc->alu, gc->fgPixel)) + if (!sna_fill_init_blt(&fill, sna, pixmap, bo, gc->alu, gc->fgPixel, FILL_BOXES)) return false; get_drawable_deltas(drawable, pixmap, &dx, &dy); @@ -10428,7 +10435,8 @@ sna_poly_arc(DrawablePtr drawable, GCPtr gc, int n, xArc *arc) if (!sna_fill_init_blt(&fill, data.sna, data.pixmap, - data.bo, gc->alu, color)) + data.bo, gc->alu, color, + FILL_POINTS | FILL_SPANS)) goto fallback; if ((data.flags & 2) == 0) { @@ -10595,7 +10603,7 @@ sna_poly_fill_rect_blt(DrawablePtr drawable, return success; } - if (!sna_fill_init_blt(&fill, sna, pixmap, bo, gc->alu, pixel)) { + if (!sna_fill_init_blt(&fill, sna, pixmap, bo, gc->alu, pixel, FILL_BOXES)) { DBG(("%s: unsupported blt\n", __FUNCTION__)); return false; } @@ -10804,7 +10812,8 @@ sna_poly_fill_polygon(DrawablePtr draw, GCPtr gc, if (!sna_fill_init_blt(&fill, data.sna, data.pixmap, - data.bo, gc->alu, color)) + data.bo, gc->alu, color, + FILL_SPANS)) goto fallback; data.op = &fill; @@ -13252,7 +13261,8 @@ sna_poly_fill_arc(DrawablePtr draw, GCPtr gc, int n, xArc *arc) if (!sna_fill_init_blt(&fill, data.sna, data.pixmap, - data.bo, gc->alu, color)) + data.bo, gc->alu, color, + FILL_SPANS)) goto fallback; data.op = &fill; diff --git a/src/sna/sna_render.c b/src/sna/sna_render.c index f584ee4d..6f13c214 100644 --- a/src/sna/sna_render.c +++ b/src/sna/sna_render.c @@ -203,7 +203,7 @@ no_render_fill_boxes(struct sna *sna, static bool no_render_fill(struct sna *sna, uint8_t alu, PixmapPtr dst, struct kgem_bo *dst_bo, - uint32_t color, + uint32_t color, unsigned flags, struct sna_fill_op *tmp) { DBG(("%s (alu=%d, color=%08x)\n", __FUNCTION__, alu, color)); diff --git a/src/sna/sna_render.h b/src/sna/sna_render.h index 7f4b8e66..0262523b 100644 --- a/src/sna/sna_render.h +++ b/src/sna/sna_render.h @@ -255,8 +255,11 @@ struct sna_render { const BoxRec *box, int n); bool (*fill)(struct sna *sna, uint8_t alu, PixmapPtr dst, struct kgem_bo *dst_bo, - uint32_t color, + uint32_t color, unsigned flags, struct sna_fill_op *tmp); +#define FILL_BOXES 0x1 +#define FILL_POINTS 0x2 +#define FILL_SPANS 0x4 bool (*fill_one)(struct sna *sna, PixmapPtr dst, struct kgem_bo *dst_bo, uint32_t color, int16_t x1, int16_t y1, int16_t x2, int16_t y2, |