diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-01-01 20:39:23 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-01-02 11:52:58 +0000 |
commit | 24264af2912f9abae5aff2a6fb5a50383d9e33be (patch) | |
tree | 302eb1cbcc86918a537427b3a93325c3598a8171 | |
parent | e9a9f9b02978cb2d73c38163827eb7141ebed16c (diff) |
sna: Fast path inplace addition of solid trapezoids
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/gen2_render.c | 6 | ||||
-rw-r--r-- | src/sna/gen3_render.c | 6 | ||||
-rw-r--r-- | src/sna/gen4_render.c | 6 | ||||
-rw-r--r-- | src/sna/gen5_render.c | 6 | ||||
-rw-r--r-- | src/sna/gen6_render.c | 6 | ||||
-rw-r--r-- | src/sna/gen7_render.c | 6 | ||||
-rw-r--r-- | src/sna/kgem.c | 4 | ||||
-rw-r--r-- | src/sna/sna_render_inline.h | 7 | ||||
-rw-r--r-- | src/sna/sna_trapezoids.c | 64 |
9 files changed, 72 insertions, 39 deletions
diff --git a/src/sna/gen2_render.c b/src/sna/gen2_render.c index c8adcdb3..687ae1fd 100644 --- a/src/sna/gen2_render.c +++ b/src/sna/gen2_render.c @@ -1535,12 +1535,6 @@ has_alphamap(PicturePtr p) } static bool -untransformed(PicturePtr p) -{ - return !p->transform || pixman_transform_is_int_translate(p->transform); -} - -static bool need_upload(PicturePtr p) { return p->pDrawable && unattached(p->pDrawable) && untransformed(p); diff --git a/src/sna/gen3_render.c b/src/sna/gen3_render.c index 03b4cd83..6da30381 100644 --- a/src/sna/gen3_render.c +++ b/src/sna/gen3_render.c @@ -2583,12 +2583,6 @@ has_alphamap(PicturePtr p) } static bool -untransformed(PicturePtr p) -{ - return !p->transform || pixman_transform_is_int_translate(p->transform); -} - -static bool need_upload(PicturePtr p) { return p->pDrawable && unattached(p->pDrawable) && untransformed(p); diff --git a/src/sna/gen4_render.c b/src/sna/gen4_render.c index 5b137f0f..405eb7d7 100644 --- a/src/sna/gen4_render.c +++ b/src/sna/gen4_render.c @@ -1732,12 +1732,6 @@ has_alphamap(PicturePtr p) } static bool -untransformed(PicturePtr p) -{ - return !p->transform || pixman_transform_is_int_translate(p->transform); -} - -static bool need_upload(PicturePtr p) { return p->pDrawable && untransformed(p) && !is_gpu(p->pDrawable); diff --git a/src/sna/gen5_render.c b/src/sna/gen5_render.c index 5b48537e..5be56ddc 100644 --- a/src/sna/gen5_render.c +++ b/src/sna/gen5_render.c @@ -1708,12 +1708,6 @@ has_alphamap(PicturePtr p) } static bool -untransformed(PicturePtr p) -{ - return !p->transform || pixman_transform_is_int_translate(p->transform); -} - -static bool need_upload(PicturePtr p) { return p->pDrawable && untransformed(p) && !is_gpu(p->pDrawable); diff --git a/src/sna/gen6_render.c b/src/sna/gen6_render.c index 65b4dc41..c152fa4b 100644 --- a/src/sna/gen6_render.c +++ b/src/sna/gen6_render.c @@ -2028,12 +2028,6 @@ has_alphamap(PicturePtr p) } static bool -untransformed(PicturePtr p) -{ - return !p->transform || pixman_transform_is_int_translate(p->transform); -} - -static bool need_upload(PicturePtr p) { return p->pDrawable && unattached(p->pDrawable) && untransformed(p); diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c index 173a558d..0cbbf80e 100644 --- a/src/sna/gen7_render.c +++ b/src/sna/gen7_render.c @@ -2151,12 +2151,6 @@ has_alphamap(PicturePtr p) } static bool -untransformed(PicturePtr p) -{ - return !p->transform || pixman_transform_is_int_translate(p->transform); -} - -static bool need_upload(PicturePtr p) { return p->pDrawable && unattached(p->pDrawable) && untransformed(p); diff --git a/src/sna/kgem.c b/src/sna/kgem.c index f4c2b1c9..3cc79d34 100644 --- a/src/sna/kgem.c +++ b/src/sna/kgem.c @@ -4593,7 +4593,7 @@ void kgem_bo_sync__cpu(struct kgem *kgem, struct kgem_bo *bo) if (bo->domain != DOMAIN_CPU) { struct drm_i915_gem_set_domain set_domain; - DBG(("%s: sync: needs_flush? %d, domain? %d, busy? %d\n", __FUNCTION__, + DBG(("%s: SYNC: needs_flush? %d, domain? %d, busy? %d\n", __FUNCTION__, bo->needs_flush, bo->domain, kgem_busy(kgem, bo->handle))); VG_CLEAR(set_domain); @@ -4616,7 +4616,7 @@ void kgem_bo_sync__gtt(struct kgem *kgem, struct kgem_bo *bo) if (bo->domain != DOMAIN_GTT) { struct drm_i915_gem_set_domain set_domain; - DBG(("%s: sync: needs_flush? %d, domain? %d, busy? %d\n", __FUNCTION__, + DBG(("%s: SYNC: needs_flush? %d, domain? %d, busy? %d\n", __FUNCTION__, bo->needs_flush, bo->domain, kgem_busy(kgem, bo->handle))); VG_CLEAR(set_domain); diff --git a/src/sna/sna_render_inline.h b/src/sna/sna_render_inline.h index 7314889d..2feb7ca5 100644 --- a/src/sna/sna_render_inline.h +++ b/src/sna/sna_render_inline.h @@ -250,4 +250,11 @@ inline static bool dst_is_cpu(PixmapPtr pixmap) return priv == NULL || DAMAGE_IS_ALL(priv->cpu_damage); } +inline static bool +untransformed(PicturePtr p) +{ + return !p->transform || pixman_transform_is_int_translate(p->transform); +} + + #endif /* SNA_RENDER_INLINE_H */ diff --git a/src/sna/sna_trapezoids.c b/src/sna/sna_trapezoids.c index 8cd987e9..d4899e9e 100644 --- a/src/sna/sna_trapezoids.c +++ b/src/sna/sna_trapezoids.c @@ -4936,6 +4936,45 @@ unbounded_pass: } static void +pixmask_span_solid(struct sna *sna, + struct sna_composite_spans_op *op, + pixman_region16_t *clip, + const BoxRec *box, + int coverage) +{ + struct pixman_inplace *pi = (struct pixman_inplace *)op; + if (coverage != FAST_SAMPLES_XY) { + coverage = coverage * 256 / FAST_SAMPLES_XY; + coverage -= coverage >> 8; + *pi->bits = mul_4x8_8(pi->color, coverage); + } else + *pi->bits = pi->color; + pixman_image_composite(pi->op, pi->source, NULL, pi->image, + box->x1, box->y1, + 0, 0, + pi->dx + box->x1, pi->dy + box->y1, + box->x2 - box->x1, box->y2 - box->y1); +} +static void +pixmask_span_solid__clipped(struct sna *sna, + struct sna_composite_spans_op *op, + pixman_region16_t *clip, + const BoxRec *box, + int coverage) +{ + pixman_region16_t region; + int n; + + pixman_region_init_rects(®ion, box, 1); + RegionIntersect(®ion, ®ion, clip); + n = REGION_NUM_RECTS(®ion); + box = REGION_RECTS(®ion); + while (n--) + pixmask_span_solid(sna, op, NULL, box++, coverage); + pixman_region_fini(®ion); +} + +static void pixmask_span(struct sna *sna, struct sna_composite_spans_op *op, pixman_region16_t *clip, @@ -5102,6 +5141,29 @@ trapezoid_span_inplace__x8r8g8b8(CARD8 op, tor_render(NULL, &tor, (void*)&inplace, dst->pCompositeClip, span, false); tor_fini(&tor); + } else if (sna_picture_is_solid(src, &color)) { + struct pixman_inplace pi; + + pi.image = image_from_pict(dst, false, &pi.dx, &pi.dy); + pi.op = op; + pi.color = color; + + pi.source = pixman_image_create_bits(PIXMAN_a8r8g8b8, 1, 1, NULL, 0); + pixman_image_set_repeat(pi.source, PIXMAN_REPEAT_NORMAL); + pi.bits = pixman_image_get_data(pi.source); + + if (dst->pCompositeClip->data) + span = pixmask_span_solid__clipped; + else + span = pixmask_span_solid; + + tor_render(NULL, &tor, (void*)&pi, + dst->pCompositeClip, span, + false); + tor_fini(&tor); + + pixman_image_unref(pi.source); + pixman_image_unref(pi.image); } else { struct pixman_inplace pi; @@ -5546,7 +5608,7 @@ sna_composite_trapezoids(CARD8 op, force_fallback = FORCE_FALLBACK > 0; if ((too_small(priv) || DAMAGE_IS_ALL(priv->cpu_damage)) && - !picture_is_gpu(src)) { + !picture_is_gpu(src) && untransformed(src)) { DBG(("%s: force fallbacks --too small, %dx%d? %d, all-cpu? %d, src-is-cpu? %d\n", __FUNCTION__, dst->pDrawable->width, |