diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2011-10-01 11:19:49 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2011-10-01 20:39:09 +0100 |
commit | 8029765515399b130bee18db0a2830eb83f47a07 (patch) | |
tree | a71d463c64ed96cb99deaec4feea494259566ba6 | |
parent | cd11bd69f4c1b961593886945946c7d7c9269900 (diff) |
sna/accel: Don't attempt converting to spans if we will only fallback
As the span code does not yet handle plane masks or stippling, it is
disadvantageous to convert to spans only to fallback.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna_accel.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index 4f50c811..60ac9ddc 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -1652,6 +1652,15 @@ sna_spans_extents(DrawablePtr drawable, GCPtr gc, static void sna_poly_fill_rect(DrawablePtr draw, GCPtr gc, int n, xRectangle *rect); +static bool +can_fill_spans(DrawablePtr drawable, GCPtr gc) +{ + if (!PM_IS_SOLID(drawable, gc->planemask)) + return false; + + return gc->fillStyle == FillSolid || gc->fillStyle == FillTiled; +} + static void sna_fill_spans(DrawablePtr drawable, GCPtr gc, int n, DDXPointPtr pt, int *width, int sorted) @@ -2148,7 +2157,8 @@ sna_poly_line(DrawablePtr drawable, GCPtr gc, return; } - if (sna_drawable_use_gpu_bo(drawable, &extents)) { + if (can_fill_spans(drawable, gc) && + sna_drawable_use_gpu_bo(drawable, &extents)) { DBG(("%s: converting line into spans\n", __FUNCTION__)); switch (gc->lineStyle) { case LineSolid: @@ -2382,7 +2392,8 @@ sna_poly_segment(DrawablePtr drawable, GCPtr gc, int n, xSegment *seg) } /* XXX Do we really want to base this decision on the amalgam ? */ - if (sna_drawable_use_gpu_bo(drawable, &extents)) { + if (can_fill_spans(drawable, gc) && + sna_drawable_use_gpu_bo(drawable, &extents)) { void (*line)(DrawablePtr, GCPtr, int, int, DDXPointPtr); int i; @@ -2487,6 +2498,7 @@ arc_to_spans(GCPtr gc, int n) static void sna_poly_arc(DrawablePtr drawable, GCPtr gc, int n, xArc *arc) { + struct sna *sna = to_sna_from_drawable(drawable); BoxRec extents; RegionRec region; @@ -2496,14 +2508,23 @@ 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)); + if (FORCE_FALLBACK) + goto fallback; + + if (sna->kgem.wedged) { + DBG(("%s: fallback -- wedged\n", __FUNCTION__)); + goto fallback; + } + /* For "simple" cases use the miPolyArc to spans path */ - if (arc_to_spans(gc, n) && + if (arc_to_spans(gc, n) && can_fill_spans(drawable, gc) && sna_drawable_use_gpu_bo(drawable, &extents)) { DBG(("%s: converting arcs into spans\n", __FUNCTION__)); miPolyArc(drawable, gc, n, arc); return; } +fallback: RegionInit(®ion, &extents, 1); if (gc->pCompositeClip) RegionIntersect(®ion, ®ion, gc->pCompositeClip); |