Bug 27028 - [G45] Savage 2: GPU hang in menu
Summary: [G45] Savage 2: GPU hang in menu
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/i965 (show other bugs)
Version: git
Hardware: Other All
: medium critical
Assignee: Eric Anholt
QA Contact:
URL: http://www.savage2.com/en/main.php
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-11 14:40 UTC by Sven Arvidsson
Modified: 2010-09-03 15:00 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
dmesg output (54.11 KB, text/plain)
2010-03-11 14:40 UTC, Sven Arvidsson
Details
Screenshot (128.28 KB, image/jpeg)
2010-08-18 13:35 UTC, Sven Arvidsson
Details

Description Sven Arvidsson 2010-03-11 14:40:23 UTC
Created attachment 33968 [details]
dmesg output

The game Savage 2 causes an immediate GPU hang in the menu. 

AFAIK not a regression, and not possible to test with the 7.7 branch because of bug #21707.

System environment:
-- chipset: G45 / ICH10R
-- system architecture: 32-bit
-- Linux distribution: Debian unstable
-- Machine or mobo model: Asus P5Q-EM
-- Display connector: DVI
-- xf86-video-intel: 318aa9ed799197810e2039dbe3ec51559dcc888c
-- xserver: 1.7.5
-- mesa: 644a05c6cb3ebabc600f6d529b54c71fd2c0c84c
-- drm: 04fd3872ee8bd8d5e2c27740508c67c2d51dbc11
-- kernel: 2.6.33
Comment 1 Eric Anholt 2010-03-19 13:23:50 UTC
This game's shaders are using a ton of temporaries, and loops that aren't getting unrolled so we don't end up optimizing much at all.  A workaround at the moment is to increase the loop unrolling limits at the top of src/mesa/shader/slang/slang_codegen.c (MAX_FOR_LOOP_UNROLL_BODY_SIZE = 100, MAX_FOR_LOOP_UNROLL_COMPLEXITY = 2000), which then triggers optimization and gets the program well within the hw limits.

Another thing that might fix from the game's side is to clean up the inside of the loops of the fragment shaders to not rely on the compiler doing CSE and do that optimization on its own.  For example, float l = length(a); vec4 v = normalize(a); ends up using temps to do the computation of 1/l twice.  Also there are multiple dot(n, l) calculations which we use temps for each time.  The program was just over the limits for loop unrolling, and optimizing the shaders would probably fix it.

If the temporary reclaiming code that's being triggered is broken as I suspect (I haven't investigated), then we should disable it and report failure in compiling the shader.  Bad, but better than hanging.

I've also started a bit of work that might reduce the number of temporaries used enough to not trigger the reclaim code.  But I fear I won't get this done without new compiler infrastructure, which would solve the problem anyway by allowing reasonable CSE.
Comment 2 Eric Anholt 2010-08-17 17:53:11 UTC
With master at the moment it doesn't hang, but the character in the menu and the menu buttons are white due to a bug in the preprocessor, distilled down to 087-if-comments.c.
Comment 3 Sven Arvidsson 2010-08-18 13:35:59 UTC
Created attachment 37964 [details]
Screenshot

I can launch the game now, but the player character seems to be drawn as random triangles.
Comment 4 Ian Romanick 2010-08-26 16:30:31 UTC
(In reply to comment #2)
> With master at the moment it doesn't hang, but the character in the menu and
> the menu buttons are white due to a bug in the preprocessor, distilled down to
> 087-if-comments.c.

That test seems to produce correct results now.  Should this bug be closed, or are we tracking multiple issues with each bug?
Comment 5 Sven Arvidsson 2010-08-27 12:48:53 UTC
(In reply to comment #4)
> 
> That test seems to produce correct results now.  Should this bug be closed, or
> are we tracking multiple issues with each bug?

Well, the GPU no longer hangs, so the initial problem is resolved, the game however still isn't playable. Not sure how you prefer to track this?
Comment 6 Sven Arvidsson 2010-09-03 15:00:38 UTC
To keep things simple, let's close this bug since the original problem (the GPU hang) has been fixed. The game isn't rendering correctly yet, so I have opended bug 30004 about this.


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.