diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/sna/sna_composite.c | 3 | ||||
-rw-r--r-- | src/sna/sna_glyphs.c | 4 | ||||
-rw-r--r-- | src/sna/sna_render_inline.h | 28 | ||||
-rw-r--r-- | src/sna/sna_trapezoids.c | 8 | ||||
-rw-r--r-- | src/sna/sna_trapezoids_boxes.c | 2 |
5 files changed, 34 insertions, 11 deletions
diff --git a/src/sna/sna_composite.c b/src/sna/sna_composite.c index d5c229c5..74dfc9ed 100644 --- a/src/sna/sna_composite.c +++ b/src/sna/sna_composite.c @@ -676,7 +676,8 @@ sna_composite(CARD8 op, } if (use_cpu(pixmap, priv, op, width, height) && - !picture_is_gpu(sna, src) && !picture_is_gpu(sna, mask)) { + !picture_is_gpu(sna, src, PREFER_GPU_RENDER) && + !picture_is_gpu(sna, mask, PREFER_GPU_RENDER)) { DBG(("%s: fallback, dst pixmap=%ld is too small (or completely damaged)\n", __FUNCTION__, pixmap->drawable.serialNumber)); goto fallback; diff --git a/src/sna/sna_glyphs.c b/src/sna/sna_glyphs.c index eca0df0e..8b44f1f3 100644 --- a/src/sna/sna_glyphs.c +++ b/src/sna/sna_glyphs.c @@ -1915,7 +1915,7 @@ sna_glyphs(CARD8 op, } if ((too_small(priv) || DAMAGE_IS_ALL(priv->cpu_damage)) && - !picture_is_gpu(sna, src)) { + !picture_is_gpu(sna, src, 0)) { DBG(("%s: fallback -- too small (%dx%d)\n", __FUNCTION__, dst->pDrawable->width, dst->pDrawable->height)); goto fallback; @@ -2244,7 +2244,7 @@ sna_glyphs__shared(CARD8 op, } if ((too_small(priv) || DAMAGE_IS_ALL(priv->cpu_damage)) && - !picture_is_gpu(sna, src)) { + !picture_is_gpu(sna, src, 0)) { DBG(("%s: fallback -- too small (%dx%d)\n", __FUNCTION__, dst->pDrawable->width, dst->pDrawable->height)); goto fallback; diff --git a/src/sna/sna_render_inline.h b/src/sna/sna_render_inline.h index 3f74341f..e292949c 100644 --- a/src/sna/sna_render_inline.h +++ b/src/sna/sna_render_inline.h @@ -117,11 +117,33 @@ unattached(DrawablePtr drawable) } static inline bool -picture_is_gpu(struct sna *sna, PicturePtr picture) +picture_is_gpu(struct sna *sna, PicturePtr picture, unsigned flags) { - if (!picture || !picture->pDrawable) + if (!picture) return false; - return is_gpu(sna, picture->pDrawable, PREFER_GPU_RENDER); + + if (!picture->pDrawable) { + switch (flags) { + case PREFER_GPU_RENDER: + switch (picture->pSourcePict->type) { + case SourcePictTypeSolidFill: + case SourcePictTypeLinear: + return false; + default: + return true; + } + case PREFER_GPU_SPANS: + return true; + default: + return false; + } + } else { + if (picture->repeat && + (picture->pDrawable->width | picture->pDrawable->height) == 1) + return flags == PREFER_GPU_SPANS; + } + + return is_gpu(sna, picture->pDrawable, flags); } static inline bool diff --git a/src/sna/sna_trapezoids.c b/src/sna/sna_trapezoids.c index c42053dd..4ad61bf9 100644 --- a/src/sna/sna_trapezoids.c +++ b/src/sna/sna_trapezoids.c @@ -318,7 +318,7 @@ trapezoids_fallback(struct sna *sna, DBG(("%s: mask (%dx%d) depth=%d, format=%08x\n", __FUNCTION__, width, height, depth, format)); if (is_gpu(sna, dst->pDrawable, PREFER_GPU_RENDER) || - picture_is_gpu(sna, src)) { + picture_is_gpu(sna, src, PREFER_GPU_RENDER)) { int num_threads; scratch = sna_pixmap_create_upload(screen, @@ -487,7 +487,7 @@ trapezoid_spans_maybe_inplace(struct sna *sna, case PICT_x8r8g8b8: case PICT_a8r8g8b8: - if (picture_is_gpu(sna, src)) + if (picture_is_gpu(sna, src, 0)) return false; switch (op) { @@ -596,11 +596,11 @@ sna_composite_trapezoids(CARD8 op, if (FORCE_FALLBACK == 0 && (too_small(priv) || DAMAGE_IS_ALL(priv->cpu_damage)) && - !picture_is_gpu(sna, src) && untransformed(src)) { + !picture_is_gpu(sna, src, 0) && untransformed(src)) { DBG(("%s: force fallbacks -- (too small, %dx%d? %d || all-cpu? %d) && (src-is-cpu? %d && untransformed? %d)\n", __FUNCTION__, dst->pDrawable->width, dst->pDrawable->height, too_small(priv), (int)DAMAGE_IS_ALL(priv->cpu_damage), - !picture_is_gpu(sna, src), untransformed(src))); + !picture_is_gpu(sna, src, 0), untransformed(src))); force_fallback: force_fallback = true; diff --git a/src/sna/sna_trapezoids_boxes.c b/src/sna/sna_trapezoids_boxes.c index 2a476dc0..898efb5e 100644 --- a/src/sna/sna_trapezoids_boxes.c +++ b/src/sna/sna_trapezoids_boxes.c @@ -1057,7 +1057,7 @@ composite_unaligned_boxes_inplace(struct sna *sna, { if (!force_fallback && (is_gpu(sna, dst->pDrawable, PREFER_GPU_SPANS) || - picture_is_gpu(sna, src))) { + picture_is_gpu(sna, src, PREFER_GPU_SPANS))) { DBG(("%s: fallback -- not forcing\n", __FUNCTION__)); return false; } |