summaryrefslogtreecommitdiff
path: root/src/sna/sna_composite.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-01-22 12:41:31 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-01-22 14:10:24 +0000
commit92badc9c9c2636284af8bc56b098d24ff222f167 (patch)
tree4420a0841dc91eb5fd7327a11d2a7d77eec42cbe /src/sna/sna_composite.c
parent67a166d1247a1197fc851308c33c4970868f6a21 (diff)
sna: Avoid a common readback after clearing
It is surprisingly common for a pixmap to be created, cleared and then used as an upload target or, even worse, as a source for a ShmGetImage. In order to prevent this folly, we can trivially track when we clear an entire pixmap and its GPU bo and avoid the readback in such cases. 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.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/sna/sna_composite.c b/src/sna/sna_composite.c
index 47eac636..6fb2d275 100644
--- a/src/sna/sna_composite.c
+++ b/src/sna/sna_composite.c
@@ -778,6 +778,19 @@ sna_composite_rectangles(CARD8 op,
sna_damage_all(&priv->gpu_damage,
pixmap->drawable.width, pixmap->drawable.height);
priv->undamaged = false;
+ if (op <= PictOpSrc) {
+ priv->clear = true;
+ priv->clear_color = 0;
+ if (op == PictOpSrc)
+ sna_get_pixel_from_rgba(&priv->clear_color,
+ color->red,
+ color->green,
+ color->blue,
+ color->alpha,
+ dst->format);
+ DBG(("%s: marking clear [%08x]\n",
+ __FUNCTION__, priv->clear_color));
+ }
} else
sna_damage_add(&priv->gpu_damage, &region);
}