From a78de0a2c735e7b3ad2e115a9ae16c5c6398df24 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sun, 10 Apr 2011 22:21:03 +0200 Subject: [PATCH] texstore: stricter check for memcpy path for unorm88 and unorm1616 (bfdo34280) According to https://bugs.freedesktop.org/show_bug.cgi?id=34280 commit 5d1387b2da3626326410804026f8b92f1a121fdc causes the font corruption problems people have been seeing under various apps and gnome-shell on r200 cards. This commit changed (loosened) the check for using the memcpy path in the former al88 / al1616 texstore functions, which are now also used to store rg texures. This patch restores the old strict check in case of al textures. I've no idea why this fixes things, since I don't know the code in question at all. But after seeing the bisect in bfdo34280 point to this commit, I gave this fix a try and it fixes the font issues seen on r200 cards. Many thanks to Nicolas Kaiser who did all the hard work of tracking this down! Signed-off-by: Hans de Goede --- src/mesa/main/texstore.c | 14 ++++++++++---- 1 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index eb37490..c58f806 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -2186,8 +2186,11 @@ _mesa_texstore_unorm88(TEXSTORE_PARAMS) if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && - (dstFormat == MESA_FORMAT_AL88 || dstFormat == MESA_FORMAT_RG88) && - baseInternalFormat == srcFormat && + ((dstFormat == MESA_FORMAT_AL88 && + baseInternalFormat == GL_LUMINANCE_ALPHA && + srcFormat == GL_LUMINANCE_ALPHA) || + (dstFormat == MESA_FORMAT_RG88 && + baseInternalFormat == srcFormat)) && srcType == GL_UNSIGNED_BYTE && littleEndian) { /* simple memcpy path */ @@ -2305,8 +2308,11 @@ _mesa_texstore_unorm1616(TEXSTORE_PARAMS) if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && - (dstFormat == MESA_FORMAT_AL1616 || dstFormat == MESA_FORMAT_RG1616) && - baseInternalFormat == srcFormat && + ((dstFormat == MESA_FORMAT_AL1616 && + baseInternalFormat == GL_LUMINANCE_ALPHA && + srcFormat == GL_LUMINANCE_ALPHA) || + (dstFormat == MESA_FORMAT_RG1616 && + baseInternalFormat == srcFormat)) && srcType == GL_UNSIGNED_SHORT && littleEndian) { /* simple memcpy path */ -- 1.7.4.2