Bug 97285 - Darkness in Dota 2 after Patch "Make Gallium's BlitFramebuffer follow the GL 4.4 sRGB rules"
Summary: Darkness in Dota 2 after Patch "Make Gallium's BlitFramebuffer follow the GL ...
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: git
Hardware: Other All
: medium normal
Assignee: mesa-dev
QA Contact: mesa-dev
Depends on:
Reported: 2016-08-10 22:25 UTC by Edmondo Tommasina
Modified: 2016-08-25 11:22 UTC (History)
5 users (show)

See Also:
i915 platform:
i915 features:

possible fix (4.63 KB, patch)
2016-08-11 11:08 UTC, Nicolai Hähnle
Details | Splinter Review

Description Edmondo Tommasina 2016-08-10 22:25:37 UTC
After updating to mesa master (6575ebdc), Dota 2 colors are much more darker.

From the IRC log 2016-08-10 it seems haagch already bisected it:

15:53 #radeon: < haagch> anyway, am I the only one seeing some opengl games being far too dark, like dota 2 and portal 2? 
16:03 #radeon: < nha> haagch, since when? maybe since those sRGB changes? 
16:38 #radeon: < haagch> nha: you were right, 3190c7ee9727161d627f107c2e7f8ec3a11941c1 is the first bad commit 

I can confirm that reverting patch 3190c7ee9727161d627f107c2e7f8ec3a11941c1 takes away the darkness in Dota 2.

My configuration:
OpenGL renderer string: Gallium 0.4 on AMD CYPRESS (DRM 2.46.0 / 4.8.0-rc1, LLVM 3.8.1)
OpenGL core profile version string: 4.1 (Core Profile) Mesa 12.1.0-devel (git-796d760)
OpenGL core profile shading language version string: 4.10
Comment 1 Ian Romanick 2016-08-10 23:13:42 UTC
This will probably affect i965 too... do you have an apitrace or something at the locations in question?  I know Ken tried some Source engine games before pushing the series.
Comment 2 Kenneth Graunke 2016-08-11 01:26:27 UTC
On i965, both Dota 2 (Source 2) and Left 4 Dead 2 (Source 1) appear to be working.  I took screenshots from the same point in a Dota 2 tournament replay both with and without the sRGB patches, and they look identical.

So perhaps I just broke Gallium or radeonsi drivers?  Sorry about that :(
Comment 3 Kenneth Graunke 2016-08-11 02:10:12 UTC
It might also be worth testing with and without multisampling...
Comment 4 Matthew Dawson 2016-08-11 05:58:19 UTC
I can confirm seeing the same behaviour in TF2 on a 7970.  I suspect this is a driver bug, and not a game bug, as the lighting sometimes works after I play the game for a bit (but never at the start).  The lighting may break later during the same session.  In the couple games where it fixed itself, it was usually around the time this bug: https://bugs.freedesktop.org/show_bug.cgi?id=93649 occurred, though I don't know if that is significant.

I independently bisected out the same commit as well.

I'll try to get an apitrace, see if that shows anything interesting.

Also, as another point of data, CS:GO seems to have no issues.  Would an apitrace of it be useful?
Comment 5 Matthew Dawson 2016-08-11 06:22:45 UTC
apitrace with screen darkening can be found at https://stuff.mjdsystems.ca/tf2_srgb_issue.trace.  Running it against mesa 11.2.2 shows no lightening issues (other rendering issues do appear).  I couldn't test the trace against the broken commit, but I assume it works.

sha1sum: ac9273151e55e6c25038687134b06d1636cd9e79
Comment 6 Christoph Haag 2016-08-11 08:35:48 UTC
If you are unsure whether you are affected, you are not affected.

It's *very* dark and you will immediately see it on the startup logo and menu of dota 2 already.

Since nobody posted a screenshot or so yet, here is some gameplay of Portal 2
(contains some Portal 2 story spoilers)
with the commit in question: https://www.youtube.com/watch?v=Gn0jp0-AABE
with the commit reverted: https://www.youtube.com/watch?v=FxIaqZRuWow
Comment 7 Nicolai Hähnle 2016-08-11 11:08:27 UTC
Created attachment 125699 [details] [review]
possible fix

I seem to have trashed my Steam installation, so I cannot currently test the attached patch with TF2 or Dota2. However, it does fix some Piglit failures I've been seeing, so please try it out.
Comment 8 network723 2016-08-11 13:25:04 UTC
The patched fixed brightness issues for me, tested in TF2, CS:Source, Left4Dead2, ETS2.

OpenGL renderer string: Gallium 0.4 on AMD TAHITI (DRM 2.45.0 / 4.7.0-4.g89a2ada-default, LLVM 4.0.0)
OpenGL core profile version string: 4.3 (Core Profile) Mesa 12.1.0-devel
Comment 9 Matthew Dawson 2016-08-11 15:20:41 UTC
(In reply to Kenneth Graunke from comment #3)
> It might also be worth testing with and without multisampling...

Oh, I tested this without the patch as well in TF2, and I saw no change enabling or disabling MSAA.

I also tested the patch on TF2 and it also fixed the darkness issue, at least on the main screen.  I didn't try playing the game.

I'm sure I'm affected (the difference between the two are like night and day), but I have also seen it switch when using the affected commmit during game play.
Comment 10 Edmondo Tommasina 2016-08-11 16:59:41 UTC
Hi Nicolai

Your patch fixes the darkness issue for me.

Tested-by: Edmondo Tommasina <edmondo.tommasina at gmail.com>

Comment 11 Marek Olšák 2016-08-11 18:46:55 UTC
The patch looks good to me.
Comment 12 Dmytro Zverev 2016-08-13 15:25:28 UTC
Please add this patch to git master branch. This patch fix bug 91342 too.
Comment 13 Dmytro Zverev 2016-08-13 19:44:41 UTC
Patch to fix: https://bugs.freedesktop.org/attachment.cgi?id=125699
Nicolai Hähnle, thanks for working patch. It's RESOLVED.
Comment 14 Vladimir Usikov 2016-08-13 20:12:34 UTC
Why fixed? Patch not in git master. Current git master stil broken.
Comment 15 Kai 2016-08-13 20:17:35 UTC
Please don't close bugs before the relevant patch(es) land(s) on master of the respective repository. AFAIK attachment 125699 [details] [review] hasn't even been officially reviewed on mesa-dev (though Marek's "looks good to me" in comment #11 should probably suffice).
Comment 16 Dmytro Zverev 2016-08-15 07:02:04 UTC
Sorry. Waiting for fix in master branch.
Comment 17 network723 2016-08-24 14:51:37 UTC
Any news on this bug? I was planning to upgrade mesa from master, but It looks that patch wasn't accepted yet, so I wonder if there is a new version of patch to test?
Comment 18 Edmondo Tommasina 2016-08-24 18:43:23 UTC
Nicolai posted the patch to the mesa-dev mailing list:

The patch is Tested-by myself.

Brian asked for some more details in the commit message.
Comment 19 Vladimir Usikov 2016-08-24 19:27:25 UTC
I update mesa to latest git and dota LGTM. I dont now maybe mesa fixed, maybe dota.
Comment 20 Edmondo Tommasina 2016-08-24 20:42:29 UTC
@Vladimir: I've updated to mesa master (c9c989763aa7ad636407cb33c27d586e6f559d7a) and the issue is not fixed for me.
Comment 21 Marek Olšák 2016-08-25 11:22:43 UTC
Fixed by b662c70aeab6a92751514f30719c13a6de253b4. 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.