From 3c9759ef2ad755bbe720d4aa031ec67dbc3b7734 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Mon, 14 May 2012 14:12:06 +0100 Subject: [PATCH] sna/gen3: Fix pre-multiplication of opacity masks The return type for the multipliation was only 8-bits wide dating back to the time when the function just computed a single channel and didn't try to blend the output back into the argb pixel value. Inlining the shift into the function means that we need the output to be 32-bits wide instead. Reported-by: Jiri Slaby Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=49887 Signed-off-by: Chris Wilson --- src/sna/gen3_render.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sna/gen3_render.c b/src/sna/gen3_render.c index a0de1ee8..b8f09709 100644 --- a/src/sna/gen3_render.c +++ b/src/sna/gen3_render.c @@ -2543,7 +2543,7 @@ mul_8_8(uint8_t a, uint8_t b) return ((t >> 8) + t) >> 8; } -static inline uint8_t multa(uint32_t s, uint32_t m, int shift) +static inline uint32_t multa(uint32_t s, uint32_t m, int shift) { return mul_8_8((s >> shift) & 0xff, m >> 24) << shift; } @@ -2944,6 +2944,7 @@ gen3_render_composite(struct sna *sna, tmp->src.u.gen3.type = SHADER_CONSTANT; tmp->src.u.gen3.mode = v; + tmp->src.is_opaque = false; tmp->mask.u.gen3.type = SHADER_NONE; }