Bug 73672

Summary: Half Life 2 in Wine is broken since 4e549ddb
Product: Mesa Reporter: Stefan Dösinger <stefandoesinger>
Component: Mesa coreAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: alexandre.f.demers, b.bellec
Version: git   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: l4d2_with_msaa_bad
l4d2_without_mass_good

Description Stefan Dösinger 2014-01-15 17:45:29 UTC
Since a few revisions Half Life 2 running in Wine on r600g shows random garbage. A regression test revealed this result:

4e549ddb500cf677b6fa16d9ebdfa67cc23da097 is the first bad commit
commit 4e549ddb500cf677b6fa16d9ebdfa67cc23da097
Author: Marek Ol????k <marek.olsak@amd.com>
Date:   Tue Jan 7 22:00:20 2014 +0100

    st/mesa: use sRGB formats for MSAA resolving if destination is sRGB
    
    Copied from the i965 driver, including the big comment.
    
    Cc: 9.2 10.0 <mesa-stable@lists.freedesktop.org>

:040000 040000 4ae7f003a4eff00a25b25a0965e8d23334d56eb4 41235f65612759b8cca64d68c381f4e6af6bb4ad M  src

I've only seen this on r600g, but presumably it affects all drivers. HL2 still works on my r300g test machine, but I have MSAA disabled there for performance reasons.
Comment 1 Benjamin Bellec 2014-01-15 19:22:45 UTC
Created attachment 92174 [details]
l4d2_with_msaa_bad
Comment 2 Benjamin Bellec 2014-01-15 19:24:48 UTC
Created attachment 92175 [details]
l4d2_without_mass_good
Comment 3 Benjamin Bellec 2014-01-15 19:25:48 UTC
I confirm the bug, with the native version of:
- HL²
- HL² Episode Two
- Left 4 Dead 2
- Counter Strike: Source
Comment 4 Benjamin Bellec 2014-01-15 19:38:01 UTC
Note that the corrupted screenshot is not really like what we see in reality. On the screen all is red but we can see the HUD and the teamplayers nickname tag.
Comment 5 Stefan Dösinger 2014-01-15 21:11:00 UTC
Yeah, it looks pretty much the same way in Wine.
Comment 6 Alexandre Demers 2014-01-18 17:47:33 UTC
Seeing the same here with native versions too. Just for info, what GPU are you using? HD6950 (Cayman) over here.
Comment 7 Marek Olšák 2014-01-18 22:19:31 UTC
Are you using the R600 LLVM backend?
Comment 8 Alexandre Demers 2014-01-18 23:02:13 UTC
(In reply to comment #7)
> Are you using the R600 LLVM backend?

In my case, tested with and without R600 LLVM backend: the result is the same.
Comment 9 Sebastian Thaler 2014-01-19 11:44:29 UTC
This may be unrelated, but I also get a similar red screen in the games Dragon Age: Origins and Torchlight 2 (both via wine) when antialiasing is enabled.

This is using Radeon HD 7770 with recent git versions of mesa and llvm.
Comment 10 Benjamin Bellec 2014-01-19 12:42:23 UTC
I just tested with nouveau on a GeForce 210 (NVA8) card (nv50 driver) and there is the same problem. But instead of a red weird screen (in Left 4 Dead 2) there is a completely black screen instead (the HUD is still visible like on r600g).


I also performed other test (on r600g) within Left 4 Dead 2:
with MSAA disabled => no problem
with MSAAx2 enabled => textures are visible but game lags, screen is blinking and shaking, teamplayer models are disappearing sometimes and there is some other weird graphical bug
with MSAAx4 enabled => red weird screen with HUD visible
with MSAAx6 enabled => ditto
with MSAAx8 enabled => ditto


@Alexandre
I'm using a RV770 (Radeon HD4850)

@Marek
Without LLVM.
My compil conf is:
./autogen.sh --with-gallium-drivers=r600,nouveau --with-dri-drivers= --enable-texture-float --disable-dri3 --disable-r600-llvm-compiler --disable-gallium-llvm --enable-32-bit CFLAGS="-O2 -m32" CXXFLAGS="-O2 -m32" --libdir=/usr/lib
Comment 11 Ilia Mirkin 2014-01-19 13:16:17 UTC
(In reply to comment #10)
> I just tested with nouveau on a GeForce 210 (NVA8) card (nv50 driver) and
> there is the same problem. But instead of a red weird screen (in Left 4 Dead
> 2) there is a completely black screen instead (the HUD is still visible like
> on r600g).

Was the mesa that you tested nouveau with between commits 95bf222603b and dd687fb8d09? If so, that could explain the black screen. If not, the bug may be helped with an apitrace demonstrating the issue.
Comment 12 Benjamin Bellec 2014-01-19 13:18:37 UTC
I compiled mesa 2 or 3 hours ago, this is mesa master.
Comment 13 Marek Olšák 2014-01-19 14:32:09 UTC
Is there any free wine test or game that I can use to reproduce this bug?
Comment 14 Benjamin Bellec 2014-01-19 18:06:49 UTC
(In reply to comment #13)
> Is there any free wine test or game that I can use to reproduce this bug?

I tested several free or open-source games but none of them are impacted (Xonotic, 0AD, Ryzom, Yo Frankie!, TA Spring).

So it looks like this mostly hits the games using the Valve's Source engine. I'm currently downloading Team Fortress 2 (which is free to play) given that it is based on the Source engine.
Comment 15 Alexandre Demers 2014-01-19 21:12:20 UTC
(In reply to comment #13)
> Is there any free wine test or game that I can use to reproduce this bug?

Confirmed with Team Forteress 2.
Comment 16 Marek Olšák 2014-01-19 23:52:19 UTC
(In reply to comment #15)
> (In reply to comment #13)
> > Is there any free wine test or game that I can use to reproduce this bug?
> 
> Confirmed with Team Forteress 2.

TF2 for Windows or TF2 for Linux?
Comment 17 Alexandre Demers 2014-01-20 00:22:37 UTC
(In reply to comment #16)
> (In reply to comment #15)
> > (In reply to comment #13)
> > > Is there any free wine test or game that I can use to reproduce this bug?
> > 
> > Confirmed with Team Forteress 2.
> 
> TF2 for Windows or TF2 for Linux?

Linux.
Comment 18 Benjamin Bellec 2014-01-20 11:50:11 UTC
Confirmed with TF2 (Linux edition).
Same behavior with MSAAx2 and MSAAx4-6-8.
Comment 19 Marek Olšák 2014-01-21 22:23:10 UTC
I sent the fix to mesa-dev. It's called "gallium/util: util_format_srgb should not return FORMAT_NONE for sRGB formats".
Comment 20 Alexandre Demers 2014-01-22 01:30:02 UTC
(In reply to comment #19)
> I sent the fix to mesa-dev. It's called "gallium/util: util_format_srgb
> should not return FORMAT_NONE for sRGB formats".

It was tested correctly on TF2 MSAA 2X, 4X, 6X, 8X

Tested-by: Alexandre Demers
Comment 21 Benjamin Bellec 2014-01-22 12:56:46 UTC
I confirm that the patch works.
Comment 22 Marek Olšák 2014-01-23 10:38:04 UTC
Fixed by d40532f260c15d56e5fa836147e02c031a999682. Closing.

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.