sna: Only check for all-damaged CPU bo if we may discard the GPU bo

The goal of the optimisation is to discard the GPU bo early, so we
can skip the extra damage reduction if there is no gpu bo.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2011-11-26 17:12:03 +00:00
parent ccee730e45
commit f11e9f1891
1 changed files with 4 additions and 2 deletions

View File

@ -741,7 +741,8 @@ done:
DBG(("%s: applying cpu damage\n", __FUNCTION__));
assert_pixmap_contains_box(pixmap, RegionExtents(region));
sna_damage_add(&priv->cpu_damage, region);
if (sna_damage_is_all(&priv->cpu_damage,
if (priv->gpu_bo &&
sna_damage_is_all(&priv->cpu_damage,
pixmap->drawable.width,
pixmap->drawable.height)) {
DBG(("%s: replaced entire pixmap\n", __FUNCTION__));
@ -1437,7 +1438,8 @@ sna_put_zpixmap_blt(DrawablePtr drawable, GCPtr gc, RegionPtr region,
assert_pixmap_contains_box(pixmap, RegionExtents(region));
sna_damage_subtract(&priv->gpu_damage, region);
sna_damage_add(&priv->cpu_damage, region);
if (sna_damage_is_all(&priv->cpu_damage,
if (priv->gpu_bo &&
sna_damage_is_all(&priv->cpu_damage,
pixmap->drawable.width,
pixmap->drawable.height)) {
DBG(("%s: replaced entire pixmap\n", __FUNCTION__));