diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2015-02-09 10:32:48 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2015-02-09 10:38:50 +0000 |
commit | f7f68d50797f0a5e6a3c7f931c827845464acd3f (patch) | |
tree | e1dea895363efdf7e90f89b9afcbb470f16dbf0c /src/sna | |
parent | 733a88bda7a654473ffc5961d08ac246ca12a28b (diff) |
sna: Convert pixel values into ARGB values for render operations
When converting from a Pixmap into a Solid, we need to remember to
convert from the stored pixel format into the a8r8g8b8 used by the solid
fill.
This was exposed by
commit aef2f99d051dfa37717e5d6d6de9b548d706a520
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date: Tue Feb 3 21:31:16 2015 +0000
sna: Convert CompositeRectangles ADD white to SRC white
but is a regression from
commit 31a4c7bc13c5f4560482b450b9ee4788a58930cd [2.99.912]
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date: Fri Apr 4 10:46:48 2014 +0100
sna/gen2+: Replace composite sources with solids where possible
Reported-by: andrew@atomspring.com
Reported-by: Matti Hämäläinen <ccr@tnsp.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89030
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna')
-rw-r--r-- | src/sna/gen2_render.c | 6 | ||||
-rw-r--r-- | src/sna/gen3_render.c | 8 | ||||
-rw-r--r-- | src/sna/gen4_render.c | 8 | ||||
-rw-r--r-- | src/sna/gen5_render.c | 6 | ||||
-rw-r--r-- | src/sna/gen6_render.c | 6 | ||||
-rw-r--r-- | src/sna/gen7_render.c | 7 | ||||
-rw-r--r-- | src/sna/gen8_render.c | 6 | ||||
-rw-r--r-- | src/sna/sna_blt.c | 16 | ||||
-rw-r--r-- | src/sna/sna_render_inline.h | 6 |
9 files changed, 37 insertions, 32 deletions
diff --git a/src/sna/gen2_render.c b/src/sna/gen2_render.c index 1104f462..12b741cc 100644 --- a/src/sna/gen2_render.c +++ b/src/sna/gen2_render.c @@ -1572,12 +1572,12 @@ gen2_composite_picture(struct sna *sna, if (channel->repeat && (x >= 0 && y >= 0 && - x + w < pixmap->drawable.width && - y + h < pixmap->drawable.height)) { + x + w <= pixmap->drawable.width && + y + h <= pixmap->drawable.height)) { struct sna_pixmap *priv = sna_pixmap(pixmap); if (priv && 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); + return gen2_composite_solid_init(sna, channel, solid_color(picture->format, priv->clear_color)); } } } else diff --git a/src/sna/gen3_render.c b/src/sna/gen3_render.c index 78289f00..a6add062 100644 --- a/src/sna/gen3_render.c +++ b/src/sna/gen3_render.c @@ -3065,7 +3065,7 @@ gen3_composite_picture(struct sna *sna, if (sna_picture_is_clear(picture, x, y, w, h, &color)) { DBG(("%s: clear drawable [%08x]\n", __FUNCTION__, color)); - return gen3_init_solid(channel, color_convert(color, picture->format, PICT_a8r8g8b8)); + return gen3_init_solid(channel, solid_color(picture->format, color)); } if (!gen3_check_repeat(picture)) @@ -3097,12 +3097,12 @@ gen3_composite_picture(struct sna *sna, if (channel->repeat || (x >= 0 && y >= 0 && - x + w < pixmap->drawable.width && - y + h < pixmap->drawable.height)) { + x + w <= pixmap->drawable.width && + y + h <= pixmap->drawable.height)) { struct sna_pixmap *priv = sna_pixmap(pixmap); if (priv && priv->clear) { DBG(("%s: converting large pixmap source into solid [%08x]\n", __FUNCTION__, priv->clear_color)); - return gen3_init_solid(channel, priv->clear_color); + return gen3_init_solid(channel, solid_color(picture->format, priv->clear_color)); } } } else { diff --git a/src/sna/gen4_render.c b/src/sna/gen4_render.c index 6c2d3808..89cf07aa 100644 --- a/src/sna/gen4_render.c +++ b/src/sna/gen4_render.c @@ -1585,12 +1585,14 @@ gen4_composite_picture(struct sna *sna, if (channel->repeat && (x >= 0 && y >= 0 && - x + w < pixmap->drawable.width && - y + h < pixmap->drawable.height)) { + x + w <= pixmap->drawable.width && + y + h <= pixmap->drawable.height)) { struct sna_pixmap *priv = sna_pixmap(pixmap); if (priv && 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); + return gen4_channel_init_solid(sna, channel, + solid_color(picture->format, + priv->clear_color)); } } } else diff --git a/src/sna/gen5_render.c b/src/sna/gen5_render.c index 37cf1ff9..0f9f6736 100644 --- a/src/sna/gen5_render.c +++ b/src/sna/gen5_render.c @@ -1524,12 +1524,12 @@ gen5_composite_picture(struct sna *sna, if (channel->repeat || (x >= 0 && y >= 0 && - x + w < pixmap->drawable.width && - y + h < pixmap->drawable.height)) { + x + w <= pixmap->drawable.width && + y + h <= pixmap->drawable.height)) { struct sna_pixmap *priv = sna_pixmap(pixmap); if (priv && 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); + return gen4_channel_init_solid(sna, channel, solid_color(picture->format, priv->clear_color)); } } } else diff --git a/src/sna/gen6_render.c b/src/sna/gen6_render.c index 60deccfe..973af9d2 100644 --- a/src/sna/gen6_render.c +++ b/src/sna/gen6_render.c @@ -1815,12 +1815,12 @@ gen6_composite_picture(struct sna *sna, if (channel->repeat && (x >= 0 && y >= 0 && - x + w < pixmap->drawable.width && - y + h < pixmap->drawable.height)) { + x + w <= pixmap->drawable.width && + y + h <= pixmap->drawable.height)) { struct sna_pixmap *priv = sna_pixmap(pixmap); if (priv && 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); + return gen4_channel_init_solid(sna, channel, solid_color(picture->format, priv->clear_color)); } } } else diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c index 8d6c6b3a..ed5044dd 100644 --- a/src/sna/gen7_render.c +++ b/src/sna/gen7_render.c @@ -2048,12 +2048,13 @@ gen7_composite_picture(struct sna *sna, if (channel->repeat || (x >= 0 && y >= 0 && - x + w < pixmap->drawable.width && - y + h < pixmap->drawable.height)) { + x + w <= pixmap->drawable.width && + y + h <= pixmap->drawable.height)) { struct sna_pixmap *priv = sna_pixmap(pixmap); if (priv && 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); + return gen4_channel_init_solid(sna, channel, + solid_color(picture->format, priv->clear_color)); } } } else diff --git a/src/sna/gen8_render.c b/src/sna/gen8_render.c index 8a8837b8..5f260883 100644 --- a/src/sna/gen8_render.c +++ b/src/sna/gen8_render.c @@ -1876,12 +1876,12 @@ gen8_composite_picture(struct sna *sna, if (channel->repeat || (x >= 0 && y >= 0 && - x + w < pixmap->drawable.width && - y + h < pixmap->drawable.height)) { + x + w <= pixmap->drawable.width && + y + h <= pixmap->drawable.height)) { struct sna_pixmap *priv = sna_pixmap(pixmap); if (priv && 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); + return gen4_channel_init_solid(sna, channel, solid_color(picture->format, priv->clear_color)); } } } else diff --git a/src/sna/sna_blt.c b/src/sna/sna_blt.c index c9a02287..59b8141c 100644 --- a/src/sna/sna_blt.c +++ b/src/sna/sna_blt.c @@ -2624,24 +2624,20 @@ clear: op = PictOpSrc; if (op == PictOpOver) { color = over(get_solid_color(src, PICT_a8r8g8b8), - color_convert(sna_pixmap(tmp->dst.pixmap)->clear_color, - dst->format, PICT_a8r8g8b8)); + solid_color(dst->format, sna_pixmap(tmp->dst.pixmap)->clear_color)); op = PictOpSrc; DBG(("%s: precomputing solid OVER (%08x, %08x) -> %08x\n", __FUNCTION__, get_solid_color(src, PICT_a8r8g8b8), - color_convert(sna_pixmap(tmp->dst.pixmap)->clear_color, - dst->format, PICT_a8r8g8b8), + solid_color(dst->format, sna_pixmap(tmp->dst.pixmap)->clear_color), color)); } if (op == PictOpAdd) { color = add(get_solid_color(src, PICT_a8r8g8b8), - color_convert(sna_pixmap(tmp->dst.pixmap)->clear_color, - dst->format, PICT_a8r8g8b8)); + solid_color(dst->format, sna_pixmap(tmp->dst.pixmap)->clear_color)); op = PictOpSrc; DBG(("%s: precomputing solid ADD (%08x, %08x) -> %08x\n", __FUNCTION__, get_solid_color(src, PICT_a8r8g8b8), - color_convert(sna_pixmap(tmp->dst.pixmap)->clear_color, - dst->format, PICT_a8r8g8b8), + solid_color(dst->format, sna_pixmap(tmp->dst.pixmap)->clear_color), color)); } } @@ -2747,8 +2743,8 @@ fill: if (is_clear(src_pixmap)) { if (src->repeat || (x >= 0 && y >= 0 && - x + width < src_pixmap->drawable.width && - y + height < src_pixmap->drawable.height)) { + 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; diff --git a/src/sna/sna_render_inline.h b/src/sna/sna_render_inline.h index 10fbbfe2..e162e37f 100644 --- a/src/sna/sna_render_inline.h +++ b/src/sna/sna_render_inline.h @@ -304,6 +304,12 @@ color_convert(uint32_t pixel, return pixel; } +inline static uint32_t +solid_color(uint32_t format, uint32_t pixel) +{ + return color_convert(pixel, format, PICT_a8r8g8b8); +} + inline static bool dst_use_gpu(PixmapPtr pixmap) { struct sna_pixmap *priv = sna_pixmap(pixmap); |