sna: Clear damage tracking when marking as all-clear

In the middle of a composite op, we take the opportunity to note when a
fill clears the entire surface - and mark up the surface as clear. This
includes marking it as all damaged, to the surprise of the upper layer.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2016-09-08 08:30:02 +01:00
parent 5735b3ce3c
commit 15c5ff1245
3 changed files with 10 additions and 0 deletions

View File

@ -2036,6 +2036,8 @@ gen9_composite_set_target(struct sna *sna,
if (op->dst.bo == NULL)
return false;
assert(!op->damage || !DAMAGE_IS_ALL(*op->damage));
if (unaligned(op->dst.bo, dst->pDrawable->bitsPerPixel))
return false;

View File

@ -1204,12 +1204,14 @@ static inline void _sna_blt_maybe_clear(const struct sna_composite_op *op, const
struct sna_pixmap *priv = sna_pixmap(op->dst.pixmap);
if (op->dst.bo == priv->gpu_bo) {
sna_damage_all(&priv->gpu_damage, op->dst.pixmap);
sna_damage_destroy(&priv->cpu_damage);
priv->clear = true;
priv->clear_color = op->u.blt.pixel;
DBG(("%s: pixmap=%ld marking clear [%08x]\n",
__FUNCTION__,
op->dst.pixmap->drawable.serialNumber,
op->u.blt.pixel));
((struct sna_composite_op *)op)->damage = NULL;
}
}
}
@ -2614,6 +2616,7 @@ nop:
}
tmp->dst.bo = sna_drawable_use_bo(dst->pDrawable, hint,
&dst_box, &tmp->damage);
assert(!tmp->damage || !DAMAGE_IS_ALL(*tmp->damage));
if (tmp->dst.bo) {
if (!kgem_bo_can_blt(&sna->kgem, tmp->dst.bo)) {
DBG(("%s: can not blit to dst, tiling? %d, pitch? %d\n",
@ -2714,6 +2717,7 @@ fill:
}
tmp->dst.bo = sna_drawable_use_bo(dst->pDrawable, hint,
&dst_box, &tmp->damage);
assert(!tmp->damage || !DAMAGE_IS_ALL(*tmp->damage));
if (tmp->dst.bo) {
if (!kgem_bo_can_blt(&sna->kgem, tmp->dst.bo)) {
DBG(("%s: can not blit to dst, tiling? %d, pitch? %d\n",
@ -2884,6 +2888,7 @@ fill:
}
tmp->dst.bo = sna_drawable_use_bo(dst->pDrawable, hint,
&dst_box, &tmp->damage);
assert(!tmp->damage || !DAMAGE_IS_ALL(*tmp->damage));
if (tmp->dst.bo && hint & REPLACES) {
struct sna_pixmap *priv = sna_pixmap(tmp->dst.pixmap);

View File

@ -452,6 +452,8 @@ static void apply_damage(struct sna_composite_op *op, RegionPtr region)
op->damage = NULL;
} else
sna_damage_add(op->damage, region);
assert(!op->damage || !DAMAGE_IS_ALL(*op->damage));
}
static inline bool use_cpu(PixmapPtr pixmap, struct sna_pixmap *priv,
@ -757,6 +759,7 @@ sna_composite(CARD8 op,
DBG(("%s: fallback due unhandled composite op\n", __FUNCTION__));
goto fallback;
}
assert(!tmp.damage || !DAMAGE_IS_ALL(*tmp.damage));
if (region.data == NULL)
tmp.box(sna, &tmp, &region.extents);