diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2014-04-04 10:46:48 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2014-04-04 11:45:53 +0100 |
commit | 31a4c7bc13c5f4560482b450b9ee4788a58930cd (patch) | |
tree | a9f5d8aa9aae4547ff2615ed1ff2865bde3ba479 /src | |
parent | f0565852b668832d4988e875bc12e23abb6e1829 (diff) |
sna/gen2+: Replace composite sources with solids where possible
If the composite reads entirely from within a large pixmap which is a
clear color, just replace the source with a solid.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r-- | src/sna/gen2_render.c | 12 | ||||
-rw-r--r-- | src/sna/gen3_render.c | 12 | ||||
-rw-r--r-- | src/sna/gen4_render.c | 12 | ||||
-rw-r--r-- | src/sna/gen5_render.c | 12 | ||||
-rw-r--r-- | src/sna/gen6_render.c | 12 | ||||
-rw-r--r-- | src/sna/gen7_render.c | 12 | ||||
-rw-r--r-- | src/sna/gen8_render.c | 12 | ||||
-rw-r--r-- | src/sna/sna_blt.c | 11 |
8 files changed, 92 insertions, 3 deletions
diff --git a/src/sna/gen2_render.c b/src/sna/gen2_render.c index e3931e3e..698ed99b 100644 --- a/src/sna/gen2_render.c +++ b/src/sna/gen2_render.c @@ -1557,6 +1557,18 @@ gen2_composite_picture(struct sna *sna, y += dy; channel->transform = NULL; channel->filter = PictFilterNearest; + + if (channel->repeat && + (x >= 0 && + y >= 0 && + x + w < pixmap->drawable.width && + y + h < pixmap->drawable.height)) { + struct sna_pixmap *priv = sna_pixmap(pixmap); + if (priv->clear) { + DBG(("%s: converting large pixmap source into solid [%08x]\n", __FUNCTION__, priv->clear_color)); + return gen2_composite_solid_init(sna, channel, priv->clear_color); + } + } } else channel->transform = picture->transform; diff --git a/src/sna/gen3_render.c b/src/sna/gen3_render.c index bb98bebc..a30ee441 100644 --- a/src/sna/gen3_render.c +++ b/src/sna/gen3_render.c @@ -3093,6 +3093,18 @@ gen3_composite_picture(struct sna *sna, y += dy; channel->transform = NULL; channel->filter = PictFilterNearest; + + if (channel->repeat || + (x >= 0 && + y >= 0 && + x + w < pixmap->drawable.width && + y + h < pixmap->drawable.height)) { + struct sna_pixmap *priv = sna_pixmap(pixmap); + if (priv->clear) { + DBG(("%s: converting large pixmap source into solid [%08x]\n", __FUNCTION__, priv->clear_color)); + return gen3_init_solid(channel, priv->clear_color); + } + } } else { channel->transform = picture->transform; channel->is_affine = sna_transform_is_affine(picture->transform); diff --git a/src/sna/gen4_render.c b/src/sna/gen4_render.c index 88db06ef..9994bf57 100644 --- a/src/sna/gen4_render.c +++ b/src/sna/gen4_render.c @@ -1584,6 +1584,18 @@ gen4_composite_picture(struct sna *sna, y += dy; channel->transform = NULL; channel->filter = PictFilterNearest; + + if (channel->repeat && + (x >= 0 && + y >= 0 && + x + w < pixmap->drawable.width && + y + h < pixmap->drawable.height)) { + struct sna_pixmap *priv = sna_pixmap(pixmap); + if (priv->clear) { + DBG(("%s: converting large pixmap source into solid [%08x]\n", __FUNCTION__, priv->clear_color)); + return gen4_channel_init_solid(sna, channel, priv->clear_color); + } + } } else channel->transform = picture->transform; diff --git a/src/sna/gen5_render.c b/src/sna/gen5_render.c index 5508d491..6408eec0 100644 --- a/src/sna/gen5_render.c +++ b/src/sna/gen5_render.c @@ -1523,6 +1523,18 @@ gen5_composite_picture(struct sna *sna, y += dy; channel->transform = NULL; channel->filter = PictFilterNearest; + + if (channel->repeat || + (x >= 0 && + y >= 0 && + x + w < pixmap->drawable.width && + y + h < pixmap->drawable.height)) { + struct sna_pixmap *priv = sna_pixmap(pixmap); + if (priv->clear) { + DBG(("%s: converting large pixmap source into solid [%08x]\n", __FUNCTION__, priv->clear_color)); + return gen4_channel_init_solid(sna, channel, priv->clear_color); + } + } } else channel->transform = picture->transform; diff --git a/src/sna/gen6_render.c b/src/sna/gen6_render.c index f1f79463..867108b3 100644 --- a/src/sna/gen6_render.c +++ b/src/sna/gen6_render.c @@ -1773,6 +1773,18 @@ gen6_composite_picture(struct sna *sna, y += dy; channel->transform = NULL; channel->filter = PictFilterNearest; + + if (channel->repeat && + (x >= 0 && + y >= 0 && + x + w < pixmap->drawable.width && + y + h < pixmap->drawable.height)) { + struct sna_pixmap *priv = sna_pixmap(pixmap); + if (priv->clear) { + DBG(("%s: converting large pixmap source into solid [%08x]\n", __FUNCTION__, priv->clear_color)); + return gen4_channel_init_solid(sna, channel, priv->clear_color); + } + } } else channel->transform = picture->transform; diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c index 6c1fe267..c7ce70c0 100644 --- a/src/sna/gen7_render.c +++ b/src/sna/gen7_render.c @@ -2036,6 +2036,18 @@ gen7_composite_picture(struct sna *sna, y += dy; channel->transform = NULL; channel->filter = PictFilterNearest; + + if (channel->repeat || + (x >= 0 && + y >= 0 && + x + w < pixmap->drawable.width && + y + h < pixmap->drawable.height)) { + struct sna_pixmap *priv = sna_pixmap(pixmap); + if (priv->clear) { + DBG(("%s: converting large pixmap source into solid [%08x]\n", __FUNCTION__, priv->clear_color)); + return gen4_channel_init_solid(sna, channel, priv->clear_color); + } + } } else channel->transform = picture->transform; diff --git a/src/sna/gen8_render.c b/src/sna/gen8_render.c index 9e634832..0c851c88 100644 --- a/src/sna/gen8_render.c +++ b/src/sna/gen8_render.c @@ -1813,6 +1813,18 @@ gen8_composite_picture(struct sna *sna, y += dy; channel->transform = NULL; channel->filter = PictFilterNearest; + + if (channel->repeat || + (x >= 0 && + y >= 0 && + x + w < pixmap->drawable.width && + y + h < pixmap->drawable.height)) { + struct sna_pixmap *priv = sna_pixmap(pixmap); + if (priv->clear) { + DBG(("%s: converting large pixmap source into solid [%08x]\n", __FUNCTION__, priv->clear_color)); + return gen4_channel_init_solid(sna, channel, priv->clear_color); + } + } } else channel->transform = picture->transform; diff --git a/src/sna/sna_blt.c b/src/sna/sna_blt.c index c6219776..b83e6b20 100644 --- a/src/sna/sna_blt.c +++ b/src/sna/sna_blt.c @@ -2564,9 +2564,14 @@ fill: src_pixmap = get_drawable_pixmap(src->pDrawable); if (is_clear(src_pixmap)) { - color = color_convert(sna_pixmap(src_pixmap)->clear_color, - src->format, tmp->dst.format); - goto fill; + if (src->repeat || + (x >= 0 && y >= 0 && + x + width < src_pixmap->drawable.width && + y + height < src_pixmap->drawable.height)) { + color = color_convert(sna_pixmap(src_pixmap)->clear_color, + src->format, tmp->dst.format); + goto fill; + } } alpha_fixup = 0; |