Bug 32296

Summary: [r300g] Screen corruption with WoW when HyperZ enabled.
Product: Mesa Reporter: Chris Rankin <rankincj>
Component: Drivers/Gallium/r300Assignee: Default DRI bug account <dri-devel>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: git   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: Screen corruption with HyperZ enabled.
sauerbraten screenshot with second patch

Description Chris Rankin 2010-12-10 08:06:07 UTC
Created attachment 40990 [details]
Screen corruption with HyperZ enabled.

I have upgraded to the 2.6.36.2 Linux kernel, and tried to enable HyperZ for World of Warcraft using RADEON_HYPERZ=1. Upon entering the game, the bottom part of the screen is corrupt. (See attachment.)

This happens with both my RV350 and my M66. The blank area starts of correctly textured, but quickly becomes a blank area in a single colour.
Comment 1 Dave Airlie 2010-12-24 12:48:00 UTC
can you please retest with latest mesa master? fixed one hyper-z issue.
Comment 2 Chris Rankin 2010-12-25 03:26:05 UTC
(In reply to comment #1)
> can you please retest with latest mesa master? fixed one hyper-z issue.

No difference, I'm afraid. I still get that blank area across the bottom of the screen. (Tested with the RV350.)
Comment 3 Chris Rankin 2011-01-08 15:02:19 UTC
HyperZ is now working with my M66GL (0x71D4); I'm not sure why.

The RV350 (0x4153) is still broken, but the corruption disappears if I comment out the "Fast Z clear" code in r300_clear() (r300_blit.c, lines 184-195).

Given that the RV350 doesn't support Hierarchical-Z in the first place, I'm not sure how much of HyperZ is actually left without Fast Z clears, but anyway... ;-).
Comment 4 Marek Olšák 2011-01-08 15:39:14 UTC
None. Fast Z Clear is the only feature that's left and is required to initialize ZMASK RAM so that zbuffer compression can be used.

I know that the compression doesn't always work and I can reproduce it. But it's one of the features that are hard to fix.
Comment 5 Marek Olšák 2011-01-24 20:59:04 UTC
Does this patch fix anything?

https://bugs.freedesktop.org/attachment.cgi?id=42432
Comment 6 Fabio Pedretti 2011-01-25 00:56:40 UTC
> Does this patch fix anything?
> 
> https://bugs.freedesktop.org/attachment.cgi?id=42432

Hi, I tested this patch on my RV530 with linux 2.6.37 and current mesa git:
- openarena: no corruption with or without the patch but fps went from 51.8 to 47.2
- sauerbraten: without the patch there was a colored fog and little squares of corruption; with the patch the fog disappeared but the object edges now are zigzagged and there is still some local zones of corruption
Comment 7 Marek Olšák 2011-01-25 07:53:05 UTC
The zigzagged edges (those little deterministic squares of corruption) are a HiZ issue. Currently I am only fixing Zmask (zbuffer compression).

I've made a new patch, which contains new bug fixes and performance should no longer regress. Could you give it a try?

https://bugs.freedesktop.org/attachment.cgi?id=42464
Comment 8 Fabio Pedretti 2011-01-25 08:14:42 UTC
(In reply to comment #7)
> The zigzagged edges (those little deterministic squares of corruption) are a
> HiZ issue. Currently I am only fixing Zmask (zbuffer compression).
> 
> I've made a new patch, which contains new bug fixes and performance should no
> longer regress. Could you give it a try?
> 
> https://bugs.freedesktop.org/attachment.cgi?id=42464

This patch improved a lot. Openarena is still fast as before. Corruption on sauerbraten is almost fixed (other than object edges), there are however still some little white clouds in some zones.
Comment 9 Marek Olšák 2011-01-25 08:37:46 UTC
Could you possibly attach screenshots of the corruptions you are seeing?
Comment 10 Fabio Pedretti 2011-01-25 08:49:19 UTC
Created attachment 42472 [details]
sauerbraten screenshot with second patch

Note that the clouds appears mostly when moving your player. When he's stopped they are smaller, fewer and mostly only visible near edges, like a light that's entering from the outside. The attached screenshot was taken when moving the player (the tearing line you'll see is because of this, probably the screenshot included data from two different frames).
Comment 11 Chris Rankin 2011-01-25 13:32:11 UTC
(In reply to comment #7)
> I've made a new patch, which contains new bug fixes and performance should no
> longer regress. Could you give it a try?

And the corruption in WoW is now gone with my RV350 :-) !! Thanks.
Comment 12 Chris Rankin 2011-01-25 13:52:49 UTC
(In reply to comment #7)
> I've made a new patch, which contains new bug fixes and performance should no
> longer regress. Could you give it a try?

I should probably mention that an RV350 is the very lowest of the low when it comes to WoW, and so I'm hardly noticing a large performance increase with HyperZ. Is there any way that I can be sure that HyperZ is actually enabled, please ;-)?
Comment 13 Marek Olšák 2011-01-25 14:14:27 UTC
If you compile with --enable-debug, it should print the hyperz status to stderr.
Comment 14 Fabio Pedretti 2011-01-26 00:35:27 UTC
On testing the v3 patch at:
https://bugs.freedesktop.org/show_bug.cgi?id=32945#c12
with sauerbraten I got a lockup (mouse cursor still moving but I had to reboot).
Comment 15 Chris Rankin 2011-01-26 15:04:37 UTC
(In reply to comment #13)
> If you compile with --enable-debug, it should print the hyperz status to
> stderr.

RADEON_HYPERZ=1
RADEON_DEBUG=hyperz

and then I get lots of lines like:

hyper-z features: hiz: 0 @ deadbeef

RV350 has no HiZ, so that's not unexpected. The can_hyperz flag does appear to be being set as well.
Comment 16 Chris Rankin 2011-01-27 13:39:29 UTC
This latest commit does *not* fix the corruption with my RV350:

commit db299a9f8244d53d9041fcdbd396a77ebe1f9e3e
Author: Marek Olšák <maraeo@gmail.com>
Date:   Tue Jan 25 05:37:52 2011 +0100

    r300g: fix some bugs with zbuffer compression (v4)

I thought this commit was based upon the patch I tested earlier...?!
Comment 17 Marek Olšák 2011-01-27 13:54:35 UTC
(In reply to comment #16)
> This latest commit does *not* fix the corruption with my RV350:
> 
> commit db299a9f8244d53d9041fcdbd396a77ebe1f9e3e
> Author: Marek Olšák <maraeo@gmail.com>
> Date:   Tue Jan 25 05:37:52 2011 +0100
> 
>     r300g: fix some bugs with zbuffer compression (v4)
> 
> I thought this commit was based upon the patch I tested earlier...?!

It is. It's possible that some r500-specific fixes broke r300 again. I'll have a look at it tomorrow maybe.
Comment 18 Marek Olšák 2011-01-27 16:09:45 UTC
I have fixed the 8x8 compression mode in master. It should fix the bottom of the screen being uninitialized. Please test.
Comment 19 Chris Rankin 2011-01-27 16:24:12 UTC
(In reply to comment #18)
> I have fixed the 8x8 compression mode in master. It should fix the bottom of
> the screen being uninitialized. Please test.

Thanks, the latest commit:

commit 2050f2ab96f923112d3475a655b31c8f5145a800
Author: Marek Olšák <maraeo@gmail.com>
Date:   Fri Jan 28 01:01:01 2011 +0100

    r300g: fix and re-enable 8x8 zbuffer compression mode


does fix things.

r300: DRM version: 2.6.0, Name: ATI RV350, ID: 0x4153, GB: 1, Z: 1
r300: GART size: 253 MB, VRAM size: 256 MB
r300: AA compression: NO, Z compression: YES, HiZ: NO
Comment 20 Fabio Pedretti 2011-01-28 01:00:19 UTC
I am still seeing the white clouds but I suspect they are related to the zigzagged edges which seems to be a know issue. Also no more lockups. My card:

r300: DRM version: 2.7.0, Name: ATI RV530, ID: 0x71c5, GB: 1, Z: 2
r300: GART size: 509 MB, VRAM size: 256 MB
r300: AA compression: NO, Z compression: YES, HiZ: YES

Closing since Chris problem is fixed.
Comment 21 Chris Rankin 2011-01-29 06:47:19 UTC
Also fine for my M66GL:

r300: DRM version: 2.6.0, Name: ATI RV530, ID: 0x71d4, GB: 1, Z: 2
r300: GART size: 509 MB, VRAM size: 256 MB
r300: AA compression: NO, Z compression: YES, HiZ: YES

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.