summaryrefslogtreecommitdiff
path: root/src/sna/sna_composite.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-01-11 16:39:45 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-01-12 02:16:49 +0000
commita3c42565a8f557b2e7f7ff7bfa45b13b606f2968 (patch)
tree13330caa23d7a116afcb43492930c593f397b03a /src/sna/sna_composite.c
parentc64a9d0683e047a7eb041df78db746f6dd387b5e (diff)
sna: Store damage-all in the low bit of the damage pointer
Avoid the function call overhead by inspecting the low bit to see if it is all-damaged already. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna_composite.c')
-rw-r--r--src/sna/sna_composite.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/sna/sna_composite.c b/src/sna/sna_composite.c
index b1bee98b..f8f61f5a 100644
--- a/src/sna/sna_composite.c
+++ b/src/sna/sna_composite.c
@@ -763,18 +763,20 @@ sna_composite_rectangles(CARD8 op,
goto fallback;
}
- assert_pixmap_contains_box(pixmap, RegionExtents(&region));
-
/* Clearing a pixmap after creation is a common operation, so take
* advantage and reduce further damage operations.
*/
- if (region.data == NULL &&
- region.extents.x2 - region.extents.x1 == pixmap->drawable.width &&
- region.extents.y2 - region.extents.y1 == pixmap->drawable.height)
- sna_damage_all(&priv->gpu_damage,
- pixmap->drawable.width, pixmap->drawable.height);
- else
- sna_damage_add(&priv->gpu_damage, &region);
+ if (!DAMAGE_IS_ALL(priv->gpu_damage)) {
+ assert_pixmap_contains_box(pixmap, RegionExtents(&region));
+
+ if (region.data == NULL &&
+ region.extents.x2 - region.extents.x1 == pixmap->drawable.width &&
+ region.extents.y2 - region.extents.y1 == pixmap->drawable.height)
+ sna_damage_all(&priv->gpu_damage,
+ pixmap->drawable.width, pixmap->drawable.height);
+ else
+ sna_damage_add(&priv->gpu_damage, &region);
+ }
goto done;