diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2011-10-28 13:39:17 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2011-10-28 13:39:43 +0100 |
commit | a4762ed891a50238abddf6c762a053db5c34b87f (patch) | |
tree | 9e0f69915600f2ba09e91e50dd17c5ecc76a13c5 | |
parent | a02069df2ddc259d65ad468834f7968d283b713f (diff) |
sna: Call directly into tiled rects for tiled spans.
As we already know the extents and that this is a candidate for
GPU-acceleration, we can skip over those steps and emit the tiled rects.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna_accel.c | 50 |
1 files changed, 32 insertions, 18 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index 2a9f2a4a..61fe190f 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -2182,8 +2182,12 @@ reduce_damage(DrawablePtr drawable, return damage; } -static void -sna_poly_fill_rect(DrawablePtr draw, GCPtr gc, int n, xRectangle *rect); +static Bool +sna_poly_fill_rect_tiled(DrawablePtr drawable, + struct kgem_bo *bo, + struct sna_damage **damage, + GCPtr gc, int n, xRectangle *rect, + const BoxRec *extents, unsigned clipped); static bool can_fill_spans(DrawablePtr drawable, GCPtr gc) @@ -2253,26 +2257,36 @@ sna_fill_spans(DrawablePtr drawable, GCPtr gc, int n, ®ion.extents, flags & 2)) return; } else if (gc->fillStyle == FillTiled) { - xRectangle *rect; - int i; - /* Try converting these to a set of rectangles instead */ - DBG(("%s: converting to rectagnles\n", __FUNCTION__)); - rect = malloc (n * sizeof (xRectangle)); - if (rect == NULL) - return; + if (sna_drawable_use_gpu_bo(drawable, ®ion.extents)) { + struct sna_pixmap *priv = sna_pixmap_from_drawable(drawable); + xRectangle *rect; + int i; - for (i = 0; i < n; i++) { - rect[i].x = pt[i].x; - rect[i].width = width[i]; - rect[i].y = pt[i].y; - rect[i].height = 1; - } + DBG(("%s: converting to rectagnles\n", __FUNCTION__)); - sna_poly_fill_rect(drawable, gc, n, rect); - free (rect); - return; + rect = malloc (n * sizeof (xRectangle)); + if (rect == NULL) + return; + + for (i = 0; i < n; i++) { + rect[i].x = pt[i].x; + rect[i].width = width[i]; + rect[i].y = pt[i].y; + rect[i].height = 1; + } + + i = sna_poly_fill_rect_tiled(drawable, + priv->gpu_bo, + priv->gpu_only ? NULL : reduce_damage(drawable, &priv->gpu_damage, ®ion.extents), + gc, n, rect, + ®ion.extents, flags & 2); + free (rect); + + if (i) + return; + } } fallback: |