Bug 99019 - "Star Ruler 2" game will freeze the system
Summary: "Star Ruler 2" game will freeze the system
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Gallium/radeonsi (show other bugs)
Version: 13.0
Hardware: x86-64 (AMD64) Linux (All)
: medium major
Assignee: Default DRI bug account
QA Contact: Default DRI bug account
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-07 22:26 UTC by LunarG
Modified: 2017-01-24 22:33 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Shaders (1.34 KB, application/octet-stream)
2016-12-09 07:20 UTC, smoki
Details

Description LunarG 2016-12-07 22:26:11 UTC
Overview:
"Star Ruler 2" freezes the system immediately after choosing "New Game". This forces the user to hit the reset on the computer.

Steps to reproduce:
The game will load to the menu screen and as soon as you double click for "New Game" the system will freeze. 

Linux and Hardware:
This problem has been experienced on Ubuntu 16.10 -- using AMD's R9 Fury, RX470, and RX470 graphic cards. 

Mesa Builds:
The problem has been reproduced on Mesa 13.0.2 (git-2722144) and Mesa 13.0.1 (git-f2f487e)
Comment 1 smoki 2016-12-08 02:09:04 UTC
 I remember this game has some shader fallback option in settings file, if true that stopped freezing with radeonsi drivers.

 So seems some issue with shaders by default.
Comment 2 smoki 2016-12-09 07:20:23 UTC
Created attachment 128387 [details]
Shaders

 Attached those two shaders if someone wanna investigate this.

 "gui_skin_ps.txt" is that default and makes driver freeze, but falback one is "gui_skin_simple_ps.txt" work fine.

 Both works fine with AMD propertiary drivers.
Comment 3 Nicolai Hähnle 2016-12-12 14:32:20 UTC
Could you provide an apitrace that reproduces the hang? That'll help track this down eventually.
Comment 4 smoki 2016-12-13 10:45:42 UTC
(In reply to Nicolai Hähnle from comment #3)
> Could you provide an apitrace that reproduces the hang? That'll help track
> this down eventually.

 Here we go, just starting app and clicking on New Game:

 https://www.dropbox.com/s/rje3xylvyablt4p/StarRuler2-trace.xz?dl=0
Comment 5 Samuel Pitoiset 2017-01-03 15:20:31 UTC
Confirmed, it hangs the GPU at draw call 15626. Tested on RX 480 with latest mesa/llvm.

Replacing gui_skin_ps.txt by gui_skin_simple_ps.txt with qapitrace fixes the hang.

Not sure yet if the shader is miscompiled or if something is not currently bound.
Comment 6 Marek Olšák 2017-01-04 13:18:15 UTC
The shader ends up in an infinite loop because of this:

...
	v_cmpx_le_f32_e32 vcc, 0, v0
	s_branch BB0_30
	s_cbranch_execnz BB0_30
; BB#29:
	exp null off, off, off, off done vm
	s_endpgm
BB0_30:                                 ; %endif110
...

s_branch shouldn't be there. It prevents killing the wave early and the loop that follows is infinite, because it starts with EXEC=0.
Comment 7 Samuel Pitoiset 2017-01-04 18:22:56 UTC
Thanks for the info Marek, this helped me to figure out the issue.

I have a fix locally for that hang, will think more before sending it though.
Comment 8 Samuel Pitoiset 2017-01-05 12:31:59 UTC
Possible fix is here https://reviews.llvm.org/D28351
Comment 9 Samuel Pitoiset 2017-01-24 22:33:28 UTC
Should be fixed by https://github.com/llvm-mirror/llvm/commit/e8e3365d5266760f3d7ad247f21496bb69cfef39.


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.