summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-06-11 14:00:04 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2014-06-11 14:02:54 +0100
commit21c150a873a77f983fad29b4517844a0b92e0609 (patch)
tree0c0e0418c7ad5e8a1e6b359e9a4056ab0e20f28b
parente1a4438f074f9cd5eba946cc1172c419c31b03c9 (diff)
sna: Skip redundant clears
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_composite.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/sna/sna_composite.c b/src/sna/sna_composite.c
index 1b236f40..c28cbb6e 100644
--- a/src/sna/sna_composite.c
+++ b/src/sna/sna_composite.c
@@ -946,6 +946,26 @@ sna_composite_rectangles(CARD8 op,
*/
hint = can_render(sna) ? PREFER_GPU : 0;
if (op <= PictOpSrc) {
+ if (priv->clear) {
+ uint32_t pixel;
+ bool ok;
+
+ if (op == PictOpClear) {
+ ok = sna_get_pixel_from_rgba(&pixel,
+ 0, 0, 0, 0,
+ dst->format);
+ } else {
+ ok = sna_get_pixel_from_rgba(&pixel,
+ color->red,
+ color->green,
+ color->blue,
+ color->alpha,
+ dst->format);
+ }
+ if (ok && priv->clear_color == pixel)
+ goto done;
+ }
+
if (region.data == NULL) {
hint |= IGNORE_CPU;
if (region_subsumes_drawable(&region, &pixmap->drawable))