summaryrefslogtreecommitdiff
path: root/src/sna/sna_composite.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-12-22 14:30:04 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2011-12-22 14:34:43 +0000
commit1f2cd536bc712843233de3f5c50802c388d63c72 (patch)
tree9e4e9098817d838db8553e76d307e940d691afb6 /src/sna/sna_composite.c
parent7a6a2c5d4cc98da76c73152cb7eafcbdb0c088ec (diff)
sna: Reduce damage after complete solid fills
RenderFillRectangles is often used to initially clear a pixmap after creation by flooding it with a solid colour, as is PolyRect. We can reduce further damage operations by checking for this condition. 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.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/sna/sna_composite.c b/src/sna/sna_composite.c
index 7adbbfb5..98bf8716 100644
--- a/src/sna/sna_composite.c
+++ b/src/sna/sna_composite.c
@@ -742,7 +742,17 @@ sna_composite_rectangles(CARD8 op,
}
assert_pixmap_contains_box(pixmap, RegionExtents(&region));
- sna_damage_add(&priv->gpu_damage, &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);
goto done;
@@ -759,7 +769,7 @@ fallback:
!sna_drawable_move_to_cpu(dst->alphaMap->pDrawable, error))
goto done;
- if (op == PictOpSrc || op == PictOpClear) {
+ if (op <= PictOpSrc) {
int nbox = REGION_NUM_RECTS(&region);
BoxPtr box = REGION_RECTS(&region);
uint32_t pixel;