diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2011-10-01 10:45:18 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2011-10-01 20:39:08 +0100 |
commit | cd11bd69f4c1b961593886945946c7d7c9269900 (patch) | |
tree | d9ec0324467c569a4793bb52bbf92fcc54a80fc9 | |
parent | d07256cc3360cf94d131d9a1b24d9f1c6a70ee04 (diff) |
sna/accel: Use miPolyArc to convert arcs into spans for gpu bo
This is actually tricker than it looks since miPolyArc() sometimes uses
an intermediate bitmap which performs worse than the fbPolyArc() fallback.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna_accel.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index 2614e479..4f50c811 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -2469,6 +2469,21 @@ sna_poly_arc_extents(DrawablePtr drawable, GCPtr gc, return box_empty(&box); } +static bool +arc_to_spans(GCPtr gc, int n) +{ + if (gc->lineStyle != LineSolid) + return false; + + if (gc->lineWidth == 0) + return true; + + if (n == 1) + return true; + + return false; +} + static void sna_poly_arc(DrawablePtr drawable, GCPtr gc, int n, xArc *arc) { @@ -2481,6 +2496,14 @@ sna_poly_arc(DrawablePtr drawable, GCPtr gc, int n, xArc *arc) DBG(("%s: extents=(%d, %d), (%d, %d)\n", __FUNCTION__, extents.x1, extents.y1, extents.x2, extents.y2)); + /* For "simple" cases use the miPolyArc to spans path */ + if (arc_to_spans(gc, n) && + sna_drawable_use_gpu_bo(drawable, &extents)) { + DBG(("%s: converting arcs into spans\n", __FUNCTION__)); + miPolyArc(drawable, gc, n, arc); + return; + } + RegionInit(®ion, &extents, 1); if (gc->pCompositeClip) RegionIntersect(®ion, ®ion, gc->pCompositeClip); |