From f11e9f189111f53ace20381a0bd4f559ccd3605f Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sat, 26 Nov 2011 17:12:03 +0000 Subject: [PATCH] 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 --- src/sna/sna_accel.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index 1cb79b8b..4b013c91 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -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__));