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>
This commit is contained in:
Chris Wilson 2012-06-13 22:48:43 +01:00
parent 0db789e180
commit 221534abe2
1 changed files with 3 additions and 8 deletions

View File

@ -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;
}