Bug 89699

Summary: Regression in 10.5.1 causes flickering/artifacting in a particular video game
Product: Mesa Reporter: andre35822
Component: Drivers/Gallium/radeonsiAssignee: Default DRI bug account <dri-devel>
Status: RESOLVED FIXED QA Contact: Default DRI bug account <dri-devel>
Severity: normal    
Priority: medium CC: arek.rusi, daniel, maxqia
Version: 10.5   
Hardware: Other   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: Xorg Log
dmesg output
bad frame
good frame
Revert TC Patch
make log

Description andre35822 2015-03-20 23:10:03 UTC
Alright so, before upgrading to 10.5.1 I was on 10.4.6 and a game I play a lot, Counter Strike GO (Available on Steam) was running just fine at good performance with nothing weird coming up on screen. After updating on 10.5.1 I am getting lots of white flickering on certain parts of the game (walls or objects) as well as lines that go accross objects. It appears almost as if it is GPU artifacting, although it is not because Minecraft and other games do not produce any of these weird effects.

What can do be done to solve the issue? CSGO is a proprietary game although Valve is pretty good at giving support for Linux I would assume so maybe some things can be done. I have no clue what kind of log output would be helpful, I would assume dmesg and Xorg.0.log yes? I will be adding them in shortly. 

Specs
AMD 7950 3GB 
Arch Linux 3.19.2 kernel
Comment 1 andre35822 2015-03-20 23:50:33 UTC
Created attachment 114498 [details]
Xorg Log

Xorg Log after running the game
Comment 2 andre35822 2015-03-20 23:51:06 UTC
Created attachment 114499 [details]
dmesg output

dmesg output after running the game, experiencing the artifacts/flickering/issues listed in OP and closing the game.
Comment 3 Michel Dänzer 2015-03-21 10:43:18 UTC
Does it still happen with current Mesa Git master? If so, can you bisect?
Comment 4 andre35822 2015-03-21 16:32:04 UTC
(In reply to Michel Dänzer from comment #3)
> Does it still happen with current Mesa Git master? If so, can you bisect?
The mesa-git package available in the arch linux user repository is not working at the moment so this may take a while. I found this https://wiki.archlinux.org/index.php/Bisecting_bugs essentially do I just follow these steps? This is a bit out of my scope of knowledge.
Comment 5 Michel Dänzer 2015-03-23 01:43:09 UTC
(In reply to andre35822 from comment #4)
> I found this https://wiki.archlinux.org/index.php/Bisecting_bugs essentially
> do I just follow these steps?

Yes.
Comment 6 andre35822 2015-03-23 22:56:47 UTC
(In reply to Michel Dänzer from comment #5)
> (In reply to andre35822 from comment #4)
> > I found this https://wiki.archlinux.org/index.php/Bisecting_bugs essentially
> > do I just follow these steps?
> 
> Yes.

Alright I just, I do not have enough knowledge to follow that tutorial I tried and I am just failing miserably and I can't understand what I am doing. I upgraded my system to mesa-git (10.6-devel) and I still have the issue so the issue IS present on 10.6. Hopefully there is someone at the mesa team that plays games and can test CSGO on AMD hardware?
Comment 7 Arek Ruśniak 2015-03-24 14:49:57 UTC
Andre ff you use yaourt grab pkgs by: yaourt -G mesa-git and yaourt -G lib32-mesa-git, and make it and install (cd mesa-git; makepkg -si; and the same for lib32-mesa-git)
CS GO is 32bit (i belive) app so you need bisect only lib32-mesa-git:
Try commit:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ef7e0b39a24966526b102643523feac765771842
It's first one I can build against llvm-3.6, it's probably old enough to run CS:GO without issues but you have to be sure:

$cd lib32-mesa-git 
$cd src/mesa
$git checkout ef7e0b39a24966526b102643523feac765771842
$cd ../..
$makepkg -efsi
//Try CS:GO and if it's ok, let's bisect:
$cd src/mesa
$git bisect start 
//git bisect good _commit_when_CSGO_ok
$git bisect good ef7e0b39a24966526b102643523feac765771842
//git bisect bad _commit_when_you_see_issue
//you may use mesa 10.5.1 release note:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=11c0ff60ef19cca84452aa989fb8bb25127473e0
$git bisect bad 11c0ff60ef19cca84452aa989fb8bb25127473e0
//now you can see info about need check some commit
$cd ../..
$makepkg -efsi  
//and now try CS:GO
//if CS GO has issues still
$cd src/mesa
$git bisect bad
//or if CS GO runs without issues
$cd src/mesa
$git bisect good 
-->GOTO //now you can see info about need check some commit 

//you need check another commit again and again... and again until it gives to you "first bad commit" and this "first bad commit" is wanted by Michel 

I hope it help a bit.
If ef7e0b39a24966526b102643523feac765771842 is bad, you need llvm-3.5 and start from older mesa commit.
Comment 8 andre35822 2015-04-07 20:22:36 UTC
(In reply to Arek Ruśniak from comment #7)
> Andre ff you use yaourt grab pkgs by: yaourt -G mesa-git and yaourt -G
> lib32-mesa-git, and make it and install (cd mesa-git; makepkg -si; and the
> same for lib32-mesa-git)
> CS GO is 32bit (i belive) app so you need bisect only lib32-mesa-git:
> Try commit:
> http://cgit.freedesktop.org/mesa/mesa/commit/
> ?id=ef7e0b39a24966526b102643523feac765771842
> It's first one I can build against llvm-3.6, it's probably old enough to run
> CS:GO without issues but you have to be sure:
> 
> $cd lib32-mesa-git 
> $cd src/mesa
> $git checkout ef7e0b39a24966526b102643523feac765771842
> $cd ../..
> $makepkg -efsi
> //Try CS:GO and if it's ok, let's bisect:
> $cd src/mesa
> $git bisect start 
> //git bisect good _commit_when_CSGO_ok
> $git bisect good ef7e0b39a24966526b102643523feac765771842
> //git bisect bad _commit_when_you_see_issue
> //you may use mesa 10.5.1 release note:
> http://cgit.freedesktop.org/mesa/mesa/commit/
> ?id=11c0ff60ef19cca84452aa989fb8bb25127473e0
> $git bisect bad 11c0ff60ef19cca84452aa989fb8bb25127473e0
> //now you can see info about need check some commit
> $cd ../..
> $makepkg -efsi  
> //and now try CS:GO
> //if CS GO has issues still
> $cd src/mesa
> $git bisect bad
> //or if CS GO runs without issues
> $cd src/mesa
> $git bisect good 
> -->GOTO //now you can see info about need check some commit 
> 
> //you need check another commit again and again... and again until it gives
> to you "first bad commit" and this "first bad commit" is wanted by Michel 
> 
> I hope it help a bit.
> If ef7e0b39a24966526b102643523feac765771842 is bad, you need llvm-3.5 and
> start from older mesa commit.

Alright so I decided to give this a try since I have some time. I downloaded the mesa-git and lib32-mesa-git tarballs manually and ran makepkg -s then I went into src/mesa and used that command to put in the commit and went back to the main directory and did makepkg -s instead of makepkg -efsi because I don't know what that does...I believe -i installs it but I would prefer it to make .tar.xz packages so I can remove this version using pacman....I am just afraid to screw up my system. So I did this for mesa and lib32-mesa to ensure nothing would go wrong, and it seemed to have built mesa-git 10.6.0_devel....

Alright, I did sudo pacman -U to install the .tar.xz packages that were built logged out/in and loaded up CSGO. The graphical issues I have been talking about are still there. I went into /src/mesa did bit bisect start and then git bisect bad and put the ef7e0b39a24966526b102643523feac765771842 commit.


I honestly have no clue what I am doing but I then did the same steps initially of building the package but did commit 	cb154bb22116910c462f7a83f4401bd01e15c34d which is a commit for 10.4.7 since the entire 10.4.x series were fine with CSGO and only noticed issues since 10.5 came out. I guess ill move up from 10.4.7 and there? Again I did makepkg -s and the .tar.xz that were made were the same ones as before. I am confused if I am actually doing anything here.
Comment 9 andre35822 2015-04-07 20:40:47 UTC
I don't have the skill to this. Is it possible I could purchase the game for one of the developers through Steam and they can try and solve this? 

Offtopic but I think this is an important field, games need to be tested and make sure they work. Granted majority of distros arent using 10.5 however eventually they will catch up and if the bugfixes haven't been solved this could prevent linux users from playing games, forced to go back into windows to (what I am experiencing now) and could even prevent new users from transitioning to Linux.
Comment 10 andre35822 2015-04-10 22:26:30 UTC
Certain Mesa devs are able to get this game for free, as well as other Valve games. Hopefully this may help solve the bug as someone working in Mesa can use the game on their machines?

http://lists.freedesktop.org/archives/dri-devel/2015-April/081045.html
Comment 11 Sergio Pais 2015-06-08 22:53:54 UTC
Hello,

The following is the result of bisecting:

0543630d0b0d9d9f6eefbc14fbd3385d4de37ba0 is the first bad commit
commit 0543630d0b0d9d9f6eefbc14fbd3385d4de37ba0
Author: Marek Olšák <marek.olsak@amd.com>
Date:   Sun Jan 4 22:01:43 2015 +0100

    radeonsi: only set BC_OPTIMIZE_DISABLE when necessary
    
    SPI_PS_IN_CONTROL is moved into the SPI mapping state.
    
    Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>

:040000 040000 1cf87184549eeb5432cc02fbb352c10f873ffd9f 8d8f7873bdcaf67167ec744265d008306e53d901 M	src


http://cgit.freedesktop.org/mesa/mesa/commit/?id=0543630d0b0d9d9f6eefbc14fbd3385d4de37ba0
Comment 12 Marek Olšák 2015-06-09 00:10:51 UTC
(In reply to Sergio Pais from comment #11)
> Hello,
> 
> The following is the result of bisecting:
> 
> 0543630d0b0d9d9f6eefbc14fbd3385d4de37ba0 is the first bad commit
> commit 0543630d0b0d9d9f6eefbc14fbd3385d4de37ba0
> Author: Marek Olšák <marek.olsak@amd.com>
> Date:   Sun Jan 4 22:01:43 2015 +0100
> 
>     radeonsi: only set BC_OPTIMIZE_DISABLE when necessary
>     
>     SPI_PS_IN_CONTROL is moved into the SPI mapping state.
>     
>     Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
> 
> :040000 040000 1cf87184549eeb5432cc02fbb352c10f873ffd9f
> 8d8f7873bdcaf67167ec744265d008306e53d901 M	src
> 
> 
> http://cgit.freedesktop.org/mesa/mesa/commit/
> ?id=0543630d0b0d9d9f6eefbc14fbd3385d4de37ba0

Sorry to bring you bad news, but that commit was reverted soon after it was committed.

Marek
Comment 13 Sergio Pais 2015-06-09 00:57:29 UTC
After I posted the comment I noticed it was reverted.  I compiled 82b7ee62fc4bbe014f61a60bccf694b706c7247d and the artifacts are still present.  There might be two different changes that cause a similar bug?  I'll try to narrow it down.
Comment 14 Sergio Pais 2015-06-09 02:06:16 UTC
Hello,

By reverting 0543630d0b0d9d9f6eefbc14fbd3385d4de37ba0:

18a30c97780bef9c498db915ba5e7debe832f576 NOT OK
11b76369f53e064bef1bad629f957373c0e93b6c NOT OK
edf18da85dd3b1865c4faaba650a8fa371b7103c NOT OK Mostly shadows flickering 
73c2b0d18c51459697d8ec194ecfc4438c98c139 NOT OK Mostly shadows flickering
0aecf9e2d18804d83473a5cc142297c1bbae04f8 OK
2bfe9d4538693ebad3c0330a92e432c6c4c5afd3 Does not compile for me
d217819e7872e1017260f525caff38e6e49e714d OK

73c2b0d18c51459697d8ec194ecfc4438c98c139 seems to the the first bad commit.

Hope this helps.
Comment 15 andre35822 2015-06-29 04:49:03 UTC
So I came to check out if there was anything new and I see that there are some of you working on fixing the bug? Thank You! I really appreciate it as I have no clue how to do this on my own. I don't know what else I can do to help, only that (you guys probably know this already) the bug is still present on Mesa 10.6...just thought I would let you know in case you guys didnt (you probably do).

Thanks a lot again for looking into the issue.
Comment 16 Maxqia 2015-07-12 12:47:22 UTC
Bug is still present in Mesa 10.7 Git, posted frames
Comment 17 Maxqia 2015-07-12 12:48:38 UTC
Created attachment 117072 [details]
bad frame
Comment 18 Maxqia 2015-07-12 12:49:10 UTC
Created attachment 117073 [details]
good frame
Comment 19 Michel Dänzer 2015-07-14 01:14:52 UTC
(In reply to Sergio Pais from comment #14)
> 
> 73c2b0d18c51459697d8ec194ecfc4438c98c139 seems to the the first bad commit.

That one has been reverted as well. Can you try bisecting again with that one reverted?
Comment 20 Maxqia 2015-07-15 08:04:04 UTC
How would you revert a commit then bisect?
Comment 21 Maxqia 2015-07-17 21:22:58 UTC
Did some Bisecting and I Got ...

67a77ecdec3ba701eb63783535c43abf6eb1ab29 is the first bad commit
commit 67a77ecdec3ba701eb63783535c43abf6eb1ab29
Author: Marek Olšák <marek.olsak@amd.com>
Date:   Sun Jan 4 22:16:53 2015 +0100

    radeonsi: don't use TC L2 for updating descriptors on SI
    
    It's causing problems, because we mix uncached CP DMA with cached WRITE_DATA
    when updating the same memory.
    
    The solution for SI is to use uncached access here, because CP DMA doesn't
    support cached access.
    
    CIK will be handled in the next patch.
    
    Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>

:040000 040000 76fed826a37a921280bbb3c30b27921b58a143db 6a5d816cf39df3265bd9a672cecb5ab94ab97195 M	src
Comment 22 Maxqia 2015-07-18 08:58:12 UTC
Created attachment 117219 [details] [review]
Revert TC Patch

Seems like reverting all TC commits fixes the issue ...
Tested the patch on Master
Comment 23 Marek Olšák 2015-07-18 11:49:23 UTC
What happens if you change SI_NUM_CONTEXTS to 32 in src/gallium/drivers/radeonsi/si_descriptors.c ?

Do you have Tahiti, Pitcairn, or something else?
Comment 24 Marek Olšák 2015-07-18 11:52:43 UTC
We can't revert it, because it would cause other issues. Your patch is wrong, because it reverts a lot of unrelated things too.

I think the proper fix is to use the constant engine. Or upload descriptors without CP_DMA and WRITE_DATA, only using the CPU to upload them.
Comment 25 Maxqia 2015-07-18 12:46:32 UTC
Created attachment 117229 [details]
make log

I have a Tahiti (7950) GPU for your information. When I set SI_NUM_CONTEXTS to 32 in si_descriptors.c, I get multiple compile errors. I have tried to set it with define SI_NUM_CONTEXTS 32, define SI_NUM_CONTEXTS=32, and SI_NUM_CONTEXTS=32.
Comment 26 Maxqia 2015-07-18 12:54:24 UTC
Nevermind, I got it to compile with 'SI_NUM_CONTEXTS=32;', but it seems to have done nothing to help the artifacting/glitching.
Comment 27 andre35822 2015-08-05 03:31:37 UTC
I would like to notify everyone that I have tried the latest mesa available from git (both mesa and lib32-mesa from git, via the AUR on Arch Linux) and there seems to be no artificating! I do not know what you guys did but it seemed to have worked.


Thank you so much, I appreciate it!

I downloaded mesa-demo from official ach repo, I am not aware if that is okay but when I run glxinfo | grep "OpenGL version" it shows

OpenGL version string: 3.0 Mesa 11.0.0-devel (git-d6d7515)

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.