Bug 34280 - r200 mesa-7.10 font distortion
Summary: r200 mesa-7.10 font distortion
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/r200 (show other bugs)
Version: 7.10
Hardware: x86 (IA32) Linux (All)
: medium normal
Assignee: Ian Romanick
QA Contact:
URL:
Whiteboard:
Keywords:
: 36289 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-02-14 16:42 UTC by Nicolas Kaiser
Modified: 2011-05-20 00:55 UTC (History)
7 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Celestia screenshot mesa-7.10 (913.96 KB, image/x-xcf)
2011-02-14 16:42 UTC, Nicolas Kaiser
Details
Celestia screenshot mesa-7.9.1 (922.36 KB, image/x-xcf)
2011-02-14 16:44 UTC, Nicolas Kaiser
Details
screenshot extreme-tuxracer mesa-git (89.76 KB, image/png)
2011-02-20 10:42 UTC, Nicolas Kaiser
Details
PATCH: texstore: stricter check for memcpy path for unorm88 and unorm1616 (2.44 KB, patch)
2011-04-10 15:42 UTC, Hans de Goede
Details | Splinter Review

Description Nicolas Kaiser 2011-02-14 16:42:56 UTC
Created attachment 43358 [details]
Celestia screenshot mesa-7.10

r200 mesa-7.10 font distortion

With r200 and mesa-7.10, fonts appear distorted in some OpenGL applications, like Celestia, extreme-tuxracer, or oolite. In other applications they look alright, like Stellarium, or Supertuxracer.
The same distortions appear with mesa-git (as of below commit).

With mesa-7.9.1, all fonts look alright.

System environment:
-- system architecture: i686
-- Linux distribution: Gentoo
-- GPU: R200 514D
-- Model: ATI Radeon 9100 QM (AGP)
-- Display connector: VGA
-- xf86-video-ati: 6.14.0
-- xserver: 1.9.2
-- mesa: 07eb660fc92b63213b542d47671b0d944286b77a
-- drm: 550fe2ca3b29ad2191eab4fdfbed9ed21e25492d
-- kernel: 2.6.38-rc3
Comment 1 Nicolas Kaiser 2011-02-14 16:44:55 UTC
Created attachment 43359 [details]
Celestia screenshot mesa-7.9.1
Comment 2 Alex Deucher 2011-02-14 22:15:28 UTC
Can you bisect?
Comment 3 Nicolas Kaiser 2011-02-15 07:38:24 UTC
(In reply to comment #2)
> Can you bisect?

Sure, I bisected to 5d1387b2da3626326410804026f8b92f1a121fdc
 Ian Romanick, "ARB_texture_rg: Add R8, R16, RG88, and RG1616 internal formats".
Comment 4 Nicolas Kaiser 2011-02-18 14:24:35 UTC
I tried to partially revert the commit.

It looks to me like I can add R8, R16, and RG1616 without a problem.
But when I add RG88, the distortions appear.
Comment 5 Nicolas Kaiser 2011-02-20 10:42:58 UTC
Created attachment 43579 [details]
screenshot extreme-tuxracer mesa-git

This screenshot from extreme-tuxracer might give a better impression of the problem. Every letter appears to get duplicated.
Comment 6 Ian Romanick 2011-02-21 14:34:36 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > Can you bisect?
> 
> Sure, I bisected to 5d1387b2da3626326410804026f8b92f1a121fdc
>  Ian Romanick, "ARB_texture_rg: Add R8, R16, RG88, and RG1616 internal
> formats".

That's pretty weird.  I don't see how that change could impact r200.  The only thing that seems to have a chance is if something weird happens in the GL_LUMINANCE8_ALPHA8 case.  What happens if you apply this mini-patch?  This isn't a fix, but it may help illuminate what's going wrong.

diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c
index cf85a5b..75dc107 100644
--- a/src/mesa/drivers/dri/radeon/radeon_texture.c
+++ b/src/mesa/drivers/dri/radeon/radeon_texture.c
@@ -464,7 +464,7 @@ gl_format radeonChooseTextureFormat(struct gl_context * ctx,
        case GL_LUMINANCE12_ALPHA12:
        case GL_LUMINANCE16_ALPHA16:
        case GL_COMPRESSED_LUMINANCE_ALPHA:
-               return _dri_texformat_al88;
+               return radeonChoose8888TexFormat(rmesa, format, type, fbo);
 
        case GL_INTENSITY:
        case GL_INTENSITY4:
Comment 7 Nicolas Kaiser 2011-02-21 17:03:14 UTC
(In reply to comment #6)
> What happens if you apply this mini-patch?  This
> isn't a fix, but it may help illuminate what's going wrong.

I had a look at Celestia and extreme-tuxracer, but I don't see any difference.
Comment 8 Nicolas Kaiser 2011-02-22 13:19:52 UTC
This is a mini-patch against mesa commit 12f25eb6d5521ad2dc61eab08331c1ea8d3c67f7
that fixes the distortions at my place.

diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index 7dd4a1f..47851c4 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -2185,7 +2185,8 @@ _mesa_texstore_unorm88(TEXSTORE_PARAMS)
    if (!ctx->_ImageTransferState &&
        !srcPacking->SwapBytes &&
        (dstFormat == MESA_FORMAT_AL88 || dstFormat == MESA_FORMAT_RG88) &&
-       baseInternalFormat == srcFormat &&
+       baseInternalFormat == GL_LUMINANCE_ALPHA &&
+       srcFormat == GL_LUMINANCE_ALPHA &&
        srcType == GL_UNSIGNED_BYTE &&
        littleEndian) {
       /* simple memcpy path */
Comment 9 Nicolas Kaiser 2011-02-23 12:20:55 UTC
FWIW, I was able to reproduce the extreme-tuxracer distortion
with this i686 Fedora Live CD:
https://fedoraproject.org/wiki/Test_Day:2011-02-23_Radeon#Live_image

Additionally I noticed weird horizontal red lines in the snow, which I've never seen before.
Apparently they're using a Mesa 7.10 snapshot from January 7.
Comment 10 Adam Pribyl 2011-04-10 07:59:45 UTC
Please reffer also to:
https://bugzilla.redhat.com/show_bug.cgi?id=679579
https://bugzilla.redhat.com/show_bug.cgi?id=678803

I have now mesa 7.11 and gnome-shell is completely unusable due to text distrotion, incorrect shadows drawing and some more artifacts. It may or may not be related. Text corruption looks very similar.
Comment 11 Hans de Goede 2011-04-10 15:42:35 UTC
Created attachment 45460 [details] [review]
PATCH: texstore: stricter check for memcpy path for unorm88 and unorm1616

Hi,

The attached patch fixes the font corruption / gnome shell misrendering with r2xx cards. It does this by restoring the original texstore behavior from before commit 5d1387b2da3626326410804026f8b92f1a121fdc for al88 / al1616 textures.

Many thanks to Nicolas Kaiser who did all the hard work of tracking this down!

Regards,

Hans
Comment 12 Hans de Goede 2011-04-10 15:45:51 UTC
p.s.

I'm also doing a mesa scratch build for F-15 for those of you using that, see:
https://bugzilla.redhat.com/show_bug.cgi?id=678803
Comment 13 Dave Airlie 2011-04-11 03:44:02 UTC
problem is the texture being uploaded is GL_LUMINANCE_ALPHA with an srcFormat/internalFormat of GL_ALPHA, I think this is legal, but the new upload code tries to memcpy in this case which is incorrect.

trying to write a piglit test to show this.
Comment 14 Dave Airlie 2011-04-12 03:52:24 UTC
okay pushed a fix to mesa master + a piglit test to catch on r200.
Comment 15 Paul Bolle 2011-04-12 05:23:09 UTC
(In reply to comment #14)
> fix to mesa master
e338a1b0cea94f8c57968b01eebd795c6c8ce74e ("texstore: fix regression stricter check for memcpy path for unorm88 and unorm1616"): http://cgit.freedesktop.org/mesa/mesa/commit/?id=e338a1b0cea94f8c57968b01eebd795c6c8ce74e

> piglit test to catch on r200
b70f3a0d1cda78e9ec62be6a93f05df28f625dfc ("texture-al: simple texture text for ALPHA/LUMINANCE_ALPHA"): http://cgit.freedesktop.org/piglit/commit/?id=b70f3a0d1cda78e9ec62be6a93f05df28f625dfc
Comment 16 Nicolas Kaiser 2011-04-12 07:39:51 UTC
Thanks a lot! The commit fixes this specific problem at my place.
Comment 17 dnm 2011-04-16 01:42:21 UTC
*** Bug 36289 has been marked as a duplicate of this bug. ***
Comment 18 Cyril Brulebois 2011-05-20 00:55:50 UTC
Just had a quick look, maybe worth cherry-picking on top of 7.10? The c-p seems trivial (no conflict). Thanks for considering.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.