Bug 30313

Summary: [r300g] Several (big) textures are corrupted when you look at them from certain distances
Product: Mesa Reporter: Gerwin <gerwin_kramer>
Component: Drivers/Gallium/r300Assignee: Default DRI bug account <dri-devel>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: xeros
Version: git   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
See Also: https://bugs.freedesktop.org/show_bug.cgi?id=28800
Whiteboard:
i915 platform: i915 features:
Attachments: This texture is corrupted
At this distance it is okay
The bug in Extreme Tux Racer (also the mouse pointer in the menu is corrupted)
Bug in Blender
Bug in Blender 2
possible fix
Corrupted textures in Nexuiz on RV350
Corrupted textures in Nexuiz on RV350 #2
Corrupted textures in Nexuiz on RV350 #3
Corrupted textures in Nexuiz on RV350 #4
Corrupted textures in Nexuiz on RV350 #5 (one place)
Corrupted textures in Nexuiz on RV350 #6 (one place)
Graphics setings in Nexuiz on RV350 #1
Graphics setings in Nexuiz on RV350 #2

Description Gerwin 2010-09-21 12:11:00 UTC
Created attachment 38848 [details]
This texture is corrupted

In several 3d applications some textures are rendered wrong. If the distance to the texture changes, the textures can be rendered correct again.

In OpenArena the textures are not or rarely distorted when the 'texture detail' setting is at it's lowest. At the highest setting, several textures are distorted. If i move away or towards to the texture, the texture can be rendered correct again. 

The bug is similar to https://bugs.freedesktop.org/show_bug.cgi?id=28800 , but with some differences:

- This bug wasn't there with r300c
- It is with several apps i tested, Extreme Tux Racer, Octagaplayer, Blender, OpenArena.
- I don't know if the WoW bug has the distance and texture detail thing.


I'm using 

- ubuntu maverick with the 
- xorg edgers ppa, 
- so, gallium r300g driver
- kernel 2.6.35-22
- R350 agp ati radeon 9800 pro card.
Comment 1 Gerwin 2010-09-21 12:11:50 UTC
Created attachment 38849 [details]
At this distance it is okay
Comment 2 Gerwin 2010-09-21 12:13:10 UTC
Created attachment 38850 [details]
The bug in Extreme Tux Racer (also the mouse pointer in the menu is corrupted)
Comment 3 Gerwin 2010-09-21 12:14:03 UTC
Created attachment 38851 [details]
Bug in Blender
Comment 4 Gerwin 2010-09-21 12:14:37 UTC
Created attachment 38852 [details]
Bug in Blender 2
Comment 5 Marek Olšák 2010-09-24 18:34:35 UTC
This looks like a tiling issue and r300c doesn't implement tiling fully. I can't reproduce it on R500. Try to set the environment variable RADEON_DEBUG=notiling and please let me know if it fixes the issue.
Comment 6 Gerwin 2010-09-25 05:48:54 UTC
(In reply to comment #5)
> This looks like a tiling issue and r300c doesn't implement tiling fully. I
> can't reproduce it on R500. Try to set the environment variable
> RADEON_DEBUG=notiling and please let me know if it fixes the issue.

Yes, RADEON_DEBUG=notiling fixes the issue!
Comment 7 Marek Olšák 2010-09-25 06:02:49 UTC
Created attachment 38951 [details] [review]
possible fix

Could you please try this patch?

And please attach you glxinfo of r300c (I'd like to know the PCI ID, which is in the renderer string).
Comment 8 Gerwin 2010-09-25 07:05:17 UTC
(In reply to comment #7)
> Created an attachment (id=38951) [details]
> possible fix
> 
> Could you please try this patch?
> 
> And please attach you glxinfo of r300c (I'd like to know the PCI ID, which is
> in the renderer string).

Renderer string of r300c:

OpenGL renderer string: Mesa DRI R300 (R350 4E48) 20090101  TCL DRI2

I don't have the source of the driver (I am using this r300g driver from the xorg-edgers ppa)

I can download the source from this ppa, patch and build it, but I am not experienced with building this driver so then I would need detailed instructions...
Comment 9 Marek Olšák 2010-09-25 08:08:49 UTC
See: https://bugs.freedesktop.org/show_bug.cgi?id=29066#c10

After git clone, apply the patch using: git am < patch
Also skip the "ln" command.
Comment 10 Gerwin 2010-09-25 09:51:01 UTC
(In reply to comment #9)
> See: https://bugs.freedesktop.org/show_bug.cgi?id=29066#c10
> 
> After git clone, apply the patch using: git am < patch
> Also skip the "ln" command.

The patch worked!

I did:

git clone git://anongit.freedesktop.org/git/mesa/mesa
git am < 0001-r300g-attempt-to-fix-tiling-on-R350.patch
./autogen.sh
make

made a backup of the old gallium driver, copied the new one using

sudo cp lib/gallium/*_dri.so /usr/lib/dri/

Double checked it by putting the backup back and the issue was back, putting the new one back and the issue was gone, so the patch worked, thanks!
Comment 11 Tomasz Czapiewski 2010-09-25 16:29:11 UTC
(In reply to comment #5)
> This looks like a tiling issue and r300c doesn't implement tiling fully. I
> can't reproduce it on R500. Try to set the environment variable
> RADEON_DEBUG=notiling and please let me know if it fixes the issue.

I have the same issue and RADEON_DEBUG=notiling variable helps here, too.
Tested on Nexuiz.

kernel: linux-image-2.6.35-22-generic (2.6.35-22.33)                            
xorg: 7.5+6ubuntu3                                                              
xserver-xorg-core: 2:1.9.0-0ubuntu7                                             
mesa: 7.10.0~git20100925+gallium+r300.58c24390-0ubuntu0tormod                   
graphic card: Sapphire Radeon 9600 256MB AGP (RV350)

OpenGL vendor string: X.Org R300 Project
OpenGL renderer string: Gallium 0.4 on RV350
OpenGL version string: 2.1 Mesa 7.10-devel
OpenGL shading language version string: 1.20

01:00.0 VGA compatible controller [0300]: ATI Technologies Inc RV350 AP [Radeon 9600] [1002:4150]
01:00.1 Display controller [0380]: ATI Technologies Inc RV350 AP [Radeon 9600] (Secondary) [1002:4170]

I've got RV370 card, too but now I was not able to test if it's got the same issue:
02:00.0 VGA compatible controller [0300]: ATI Technologies Inc RV370 5B60 [Radeon X300 (PCIE)] [1002:5b60]
02:00.1 Display controller [0380]: ATI Technologies Inc RV370 [Radeon X300SE] [1002:5b70]

And I've got one more problem with r300g - at the same (custom low) settings I've had for about 50% more FPS on r300c than on r300g in most places (for example 20FPS to 30FPS on many map objects on the screen) but when I enable GLSL in Nexuiz on r300g I have many more FPS, even than in r300c (40-50FPS in the same places) but then I have other graphic issue. I thought it is something connected with this issue but for it RADEON_DEBUG=notiling doesn't help.
The issue with GLSL looks like some textures are flashing (once there are visible (drawn properly) and once not visible at all (only grey color (maybe other colors, too) in the place of texture). It's flashing very quickly and cannot be seen on screenshots (I've done almost 100 of them).
Searching bug reports I've saw only this:
https://bugs.freedesktop.org/show_bug.cgi?id=23545 and
https://bugs.freedesktop.org/show_bug.cgi?id=25027
which reading from the description it looks the same.
Comment 12 Tomasz Czapiewski 2010-09-25 16:38:48 UTC
> The issue with GLSL looks like some textures are flashing (once there are
> visible (drawn properly) and once not visible at all (only grey color (maybe
> other colors, too) in the place of texture). 

Now, I've tested other maps in Nexuiz and I see that where the textures are flashing there are not some colors but textures dissappear and I see through the walls even the sky in closed places. It can be seen in game menu, too where 'Settings', 'About' and 'Quit' menus are flashing.
Shoud I write a new bug report or comment somewhere in the other bug reports?
Comment 13 Tomasz Czapiewski 2010-09-25 16:45:51 UTC
> Now, I've tested other maps in Nexuiz and I see that where the textures are
> flashing there are not some colors but textures dissappear and I see through
> the walls even the sky in closed places. It can be seen in game menu, too where
> 'Settings', 'About' and 'Quit' menus are flashing.
> Shoud I write a new bug report or comment somewhere in the other bug reports?

Sorry for so many comments but...
Now I've found the same issue with Blur effect in KDE 4.5.1 on Kubuntu 10.10 - textures are dissapearing and showing again and when I disable Blur and set other effects to default desktop, panel and windows are visible.
Comment 14 Marek Olšák 2010-09-26 06:31:58 UTC
Tomasz>

RADEON_DEBUG=notiling may have some side effects and may even change behavior of other bugs. That patch was just a guess of mine. But you have an RV350 GPU so the patch won't help you, it only makes R350 be considered as RV350-based with regard to tiling.

Please file separate bugs for your issues. I consider this issue fixed and am waiting for a clarification on why R350 behaves like that, and then I'll close the bug.
Comment 15 Tomasz Czapiewski 2010-09-26 09:41:41 UTC
> RADEON_DEBUG=notiling may have some side effects and may even change behavior
> of other bugs. That patch was just a guess of mine. But you have an RV350 GPU
> so the patch won't help you, it only makes R350 be considered as RV350-based
> with regard to tiling.

But RADEON_DEBUG=notiling does help without GLSL. With this option Nexuiz renders everything properly on my settings. Without this option on RV350 I have textures corruption like Gerwin on R300 so there's a problem with tiling on my RV350 with r300g. I haven't noticed any other side effects of this environment variable, yet but I haven't done much testing. The textures disappearing problem looks the same with this variable set or without it when I enable GLSL in Nexuiz and in Blur with KDE 4.5.1.
Comment 16 Tomasz Czapiewski 2010-09-26 11:54:24 UTC
Created attachment 38963 [details]
Corrupted textures in Nexuiz on RV350
Comment 17 Tomasz Czapiewski 2010-09-26 11:55:43 UTC
Created attachment 38964 [details]
Corrupted textures in Nexuiz on RV350 #2
Comment 18 Tomasz Czapiewski 2010-09-26 11:56:40 UTC
Created attachment 38965 [details]
Corrupted textures in Nexuiz on RV350 #3
Comment 19 Tomasz Czapiewski 2010-09-26 11:57:18 UTC
Created attachment 38966 [details]
Corrupted textures in Nexuiz on RV350 #4
Comment 20 Tomasz Czapiewski 2010-09-26 11:58:17 UTC
Created attachment 38967 [details]
Corrupted textures in Nexuiz on RV350 #5 (one place)
Comment 21 Tomasz Czapiewski 2010-09-26 11:58:38 UTC
Created attachment 38968 [details]
Corrupted textures in Nexuiz on RV350 #6 (one place)
Comment 22 Tomasz Czapiewski 2010-09-26 12:00:11 UTC
Created attachment 38969 [details]
Graphics setings in Nexuiz on RV350 #1
Comment 23 Tomasz Czapiewski 2010-09-26 12:01:13 UTC
Created attachment 38970 [details]
Graphics setings in Nexuiz on RV350 #2
Comment 24 Tomasz Czapiewski 2010-09-26 12:04:17 UTC
After looking more at screenshots I'm thinking it's rather shading (lightning(?)) problem on textures than textures corruption but as I've said before, setting "RADEON_DEBUG=notiling" fixes the problem here, too.
Comment 25 Marek Olšák 2010-09-26 14:04:08 UTC
The patch has been committed to master. Closing..
Comment 26 Marek Olšák 2010-09-26 14:59:04 UTC
Thomasz,

your issue seems to be similar to bug 28800. I guess Nexuiz uses some auxiliary textures to compute lighting.
Comment 27 Tomasz Czapiewski 2010-10-12 16:00:40 UTC
(In reply to comment #26)
> Thomasz,
> 
> your issue seems to be similar to bug 28800. I guess Nexuiz uses some auxiliary
> textures to compute lighting.

My problem has been fixed after I've upgraded from yesterday's (11 October 2010) xorg-edgers/radeon ppa packages for Ubuntu 10.10 Maverick.

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.