diff options
-rw-r--r-- | src/sna/gen2_render.c | 5 | ||||
-rw-r--r-- | src/sna/gen3_render.c | 32 | ||||
-rw-r--r-- | src/sna/gen4_render.c | 1 | ||||
-rw-r--r-- | src/sna/gen5_render.c | 2 | ||||
-rw-r--r-- | src/sna/gen6_render.c | 2 | ||||
-rw-r--r-- | src/sna/gen7_render.c | 1 | ||||
-rw-r--r-- | src/sna/sna_render_inline.h | 20 |
7 files changed, 34 insertions, 29 deletions
diff --git a/src/sna/gen2_render.c b/src/sna/gen2_render.c index 8e099155..1b1c8aa7 100644 --- a/src/sna/gen2_render.c +++ b/src/sna/gen2_render.c @@ -1201,7 +1201,8 @@ gen2_composite_set_target(struct sna_composite_op *op, return FALSE; op->dst.bo = priv->gpu_bo; - if (!priv->gpu_only) + if (!sna_damage_is_all(&priv->gpu_damage, + op->dst.width, op->dst.height)) op->damage = &priv->gpu_damage; get_drawable_deltas(dst->pDrawable, op->dst.pixmap, @@ -1289,6 +1290,7 @@ gen2_render_composite(struct sna *sna, __FUNCTION__)); return FALSE; } + sna_render_reduce_damage(tmp, dst_x, dst_y, width, height); tmp->op = op; if (tmp->dst.width > 2048 || @@ -1714,6 +1716,7 @@ gen2_render_composite_spans(struct sna *sna, __FUNCTION__)); return FALSE; } + sna_render_reduce_damage(&tmp->base, dst_x, dst_y, width, height); tmp->base.op = op; if (tmp->base.dst.width > 2048 || diff --git a/src/sna/gen3_render.c b/src/sna/gen3_render.c index 0a17e4c3..682fdd7c 100644 --- a/src/sna/gen3_render.c +++ b/src/sna/gen3_render.c @@ -2171,26 +2171,6 @@ gen3_align_vertex(struct sna *sna, } } -static void -reduce_damage(struct sna_composite_op *op, - int dst_x, int dst_y, - int width, int height) -{ - BoxRec r; - - if (op->damage == NULL) - return; - - r.x1 = dst_x + op->dst.x; - r.x2 = r.x1 + width; - - r.y1 = dst_y + op->dst.y; - r.y2 = r.y1 + height; - - if (sna_damage_contains_box(*op->damage, &r) == PIXMAN_REGION_IN) - op->damage = NULL; -} - static Bool gen3_composite_set_target(struct sna_composite_op *op, PicturePtr dst) { @@ -2207,8 +2187,8 @@ gen3_composite_set_target(struct sna_composite_op *op, PicturePtr dst) return FALSE; op->dst.bo = priv->gpu_bo; - if (!priv->gpu_only && - !sna_damage_is_all(&priv->gpu_damage, op->dst.width, op->dst.height)) + if (!sna_damage_is_all(&priv->gpu_damage, + op->dst.width, op->dst.height)) op->damage = &priv->gpu_damage; get_drawable_deltas(dst->pDrawable, op->dst.pixmap, @@ -2310,9 +2290,7 @@ gen3_render_composite(struct sna *sna, __FUNCTION__)); return FALSE; } - - if (width && height) - reduce_damage(tmp, dst_x, dst_y, width, height); + sna_render_reduce_damage(tmp, dst_x, dst_y, width, height); tmp->op = op; tmp->rb_reversed = gen3_dst_rb_reversed(tmp->dst.format); @@ -2848,9 +2826,7 @@ gen3_render_composite_spans(struct sna *sna, __FUNCTION__)); return FALSE; } - - if (width && height) - reduce_damage(&tmp->base, dst_x, dst_y, width, height); + sna_render_reduce_damage(&tmp->base, dst_x, dst_y, width, height); tmp->base.op = op; tmp->base.rb_reversed = gen3_dst_rb_reversed(tmp->base.dst.format); diff --git a/src/sna/gen4_render.c b/src/sna/gen4_render.c index ae535b10..7224e838 100644 --- a/src/sna/gen4_render.c +++ b/src/sna/gen4_render.c @@ -1932,6 +1932,7 @@ gen4_render_composite(struct sna *sna, if (!gen4_composite_set_target(dst, tmp)) return FALSE; + sna_render_reduce_damage(tmp, dst_x, dst_y, width, height); if (tmp->dst.width > 8192 || tmp->dst.height > 8192) { if (!sna_render_composite_redirect(sna, tmp, diff --git a/src/sna/gen5_render.c b/src/sna/gen5_render.c index 0b8a947a..de1f9765 100644 --- a/src/sna/gen5_render.c +++ b/src/sna/gen5_render.c @@ -1962,6 +1962,7 @@ gen5_render_composite(struct sna *sna, DBG(("%s: failed to set composite target\n", __FUNCTION__)); return FALSE; } + sna_render_reduce_damage(tmp, dst_x, dst_y, width, height); if (tmp->dst.width > 8192 || tmp->dst.height > 8192) { if (!sna_render_composite_redirect(sna, tmp, @@ -2314,6 +2315,7 @@ gen5_render_composite_spans(struct sna *sna, tmp->base.op = op; if (!gen5_composite_set_target(dst, &tmp->base)) return FALSE; + sna_render_reduce_damage(&tmp->base, dst_x, dst_y, width, height); if (tmp->base.dst.width > 8192 || tmp->base.dst.height > 8192) { if (!sna_render_composite_redirect(sna, &tmp->base, diff --git a/src/sna/gen6_render.c b/src/sna/gen6_render.c index 12fcd312..66bbb9e9 100644 --- a/src/sna/gen6_render.c +++ b/src/sna/gen6_render.c @@ -2129,6 +2129,7 @@ gen6_render_composite(struct sna *sna, tmp->op = op; if (!gen6_composite_set_target(tmp, dst)) return FALSE; + sna_render_reduce_damage(tmp, dst_x, dst_y, width, height); if (tmp->dst.width > 8192 || tmp->dst.height > 8192) { if (!sna_render_composite_redirect(sna, tmp, @@ -2482,6 +2483,7 @@ gen6_render_composite_spans(struct sna *sna, tmp->base.op = op; if (!gen6_composite_set_target(&tmp->base, dst)) return FALSE; + sna_render_reduce_damage(&tmp->base, dst_x, dst_y, width, height); if (tmp->base.dst.width > 8192 || tmp->base.dst.height > 8192) { if (!sna_render_composite_redirect(sna, &tmp->base, diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c index f620285e..ca32cc35 100644 --- a/src/sna/gen7_render.c +++ b/src/sna/gen7_render.c @@ -2260,6 +2260,7 @@ gen7_render_composite(struct sna *sna, tmp->op = op; if (!gen7_composite_set_target(tmp, dst)) return FALSE; + sna_render_reduce_damage(tmp, dst_x, dst_y, width, height); if (tmp->dst.width > GEN7_MAX_SIZE || tmp->dst.height > GEN7_MAX_SIZE) { if (!sna_render_composite_redirect(sna, tmp, diff --git a/src/sna/sna_render_inline.h b/src/sna/sna_render_inline.h index 91aa7e4e..6dd93a40 100644 --- a/src/sna/sna_render_inline.h +++ b/src/sna/sna_render_inline.h @@ -125,4 +125,24 @@ sna_render_get_alpha_gradient(struct sna *sna) return kgem_bo_reference(sna->render.alpha_cache.cache_bo); } +static inline void +sna_render_reduce_damage(struct sna_composite_op *op, + int dst_x, int dst_y, + int width, int height) +{ + BoxRec r; + + if (width == 0 || height == 0 || op->damage == NULL) + return; + + r.x1 = dst_x + op->dst.x; + r.x2 = r.x1 + width; + + r.y1 = dst_y + op->dst.y; + r.y2 = r.y1 + height; + + if (sna_damage_contains_box(*op->damage, &r) == PIXMAN_REGION_IN) + op->damage = NULL; +} + #endif /* SNA_RENDER_INLINE_H */ |