summaryrefslogtreecommitdiff
path: root/src/sna/sna_damage.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-06-13 22:48:43 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-06-13 22:52:50 +0100
commit221534abe2dc04fae8b8fc332104bca275d4863b (patch)
tree545c643142b7e4eeec39dfe0750bc33ef52be72d /src/sna/sna_damage.c
parent0db789e180b6b01fb8aff547879387058f52a0b9 (diff)
sna: Only reduce damage addition to a region operation if clean
Some paths bypass operating upon the region as they do not have an YX-banded set of boxes and so prefer to defer the costly construction of the region till later. As a result, we have to be careful not to overwrite any existing information if we do operate on the region after setting the dirty boxes. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=50744 Reported-by: Zdenek Kabelac <zdenek.kabelac@gmail.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna_damage.c')
-rw-r--r--src/sna/sna_damage.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/sna/sna_damage.c b/src/sna/sna_damage.c
index 1ea9e3c0..6149be7f 100644
--- a/src/sna/sna_damage.c
+++ b/src/sna/sna_damage.c
@@ -574,14 +574,9 @@ static struct sna_damage *__sna_damage_add_box(struct sna_damage *damage,
break;
}
- switch (REGION_NUM_RECTS(&damage->region)) {
- case 0:
- pixman_region_init_rects(&damage->region, box, 1);
- damage->extents = *box;
- return damage;
- case 1:
+ if (REGION_NUM_RECTS(&damage->region) <= 1) {
_pixman_region_union_box(&damage->region, box);
- damage->extents = damage->region.extents;
+ damage_union(damage, box);
return damage;
}
@@ -616,7 +611,7 @@ inline static struct sna_damage *__sna_damage_add(struct sna_damage *damage,
if (REGION_NUM_RECTS(&damage->region) <= 1) {
pixman_region_union(&damage->region, &damage->region, region);
- damage->extents = damage->region.extents;
+ damage_union(damage, &region->extents);
return damage;
}