etnaviv: fix 16bpp clears
authorLucas Stach <l.stach@pengutronix.de>
Fri, 22 Sep 2017 09:24:08 +0000 (11:24 +0200)
committerChristian Gmeiner <christian.gmeiner@gmail.com>
Fri, 22 Sep 2017 18:48:32 +0000 (20:48 +0200)
util_pack_color may leave undefined values in the upper half of the packed
integer. As our hardware needs the upper 16 bits to mirror the lower 16bits,
this breaks clears of those formats if the undefined values aren't masked off.

I've only observed the issue with R5G6B5_UNORM surfaces, other 16bpp
formats seem to work fine.

Fixes: d6aa2ba2b2 (etnaviv: replace translate_clear_color with util_pack_color)
Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Wladimir J. van der Laan <laanwj@gmail.com>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
src/gallium/drivers/etnaviv/etnaviv_clear_blit.c

index 92c91073434a92de6b35d762737a42623451fa01..d73d0e30b3e02d78dbd5a74a4133f5075303915b 100644 (file)
@@ -106,7 +106,7 @@ pack_rgba(enum pipe_format format, const float *rgba)
    union util_color uc;
    util_pack_color(rgba, format, &uc);
    if (util_format_get_blocksize(format) == 2)
-      return uc.ui[0] << 16 | uc.ui[0];
+      return uc.ui[0] << 16 | (uc.ui[0] & 0xffff);
    else
       return uc.ui[0];
 }