summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-03-18 11:10:14 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-03-18 15:11:31 +0000
commit82023397cd05c05cfcb8939829a95e287d438875 (patch)
tree0c7427cfdfbe69d9ff04e9a58c20a4741bf439fe
parent7ce5f4a11389b2fe9f27a6f09c4848ac71424d5d (diff)
sna/gen3: Improve clear-to-solid reduction
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/gen3_render.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/sna/gen3_render.c b/src/sna/gen3_render.c
index 8c88722d..b2367611 100644
--- a/src/sna/gen3_render.c
+++ b/src/sna/gen3_render.c
@@ -2258,6 +2258,27 @@ gen3_init_radial(struct sna *sna,
}
static Bool
+sna_picture_is_clear(PicturePtr picture,
+ int x, int y, int w, int h,
+ uint32_t *color)
+{
+ struct sna_pixmap *priv;
+
+ if (!picture->pDrawable)
+ return FALSE;
+
+ priv = sna_pixmap(get_drawable_pixmap(picture->pDrawable));
+ if (priv == NULL || !priv->clear)
+ return FALSE;
+
+ if (!source_is_covered(picture, x, y, w, h))
+ return FALSE;
+
+ *color = priv->clear_color;
+ return TRUE;
+}
+
+static Bool
gen3_composite_picture(struct sna *sna,
PicturePtr picture,
struct sna_composite_op *op,
@@ -2310,6 +2331,9 @@ gen3_composite_picture(struct sna *sna,
if (sna_picture_is_solid(picture, &color))
return gen3_init_solid(channel, color);
+ if (sna_picture_is_clear(picture, x, y, w, h, &color))
+ return gen3_init_solid(channel, color);
+
if (!gen3_check_repeat(picture))
return sna_render_picture_fixup(sna, picture, channel,
x, y, w, h, dst_x, dst_y);