Bug 45216

Summary: [SNB] GPU hang in OilRush
Product: Mesa Reporter: Mateusz Kaduk <mateusz.kaduk>
Component: Drivers/DRI/i965Assignee: Kenneth Graunke <kenneth>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: medium CC: idr
Version: git   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: dmesg file with error
Captured i915_error_state file during hung-up
patch to fix the hang, not otherwise tested
Same hung but now in other game

Description Mateusz Kaduk 2012-01-25 02:17:10 UTC
Created attachment 56128 [details]
dmesg file with error

With OilRush game and recent git Mesa

Latest
commit 422b18794eacc8f0be5b4e9611e2726f4e0d86b6
Author: Eric Anholt <eric@anholt.net>
Date:   Fri Jan 20 13:43:11 2012 -0800

I experience GPU Hung, switching back to console is possible, than I could at least check errors. Switching back to X, powers off LCD screen and reboot is needed.
Comment 1 Mateusz Kaduk 2012-01-25 02:19:25 UTC
Created attachment 56129 [details]
Captured i915_error_state file during hung-up
Comment 2 Mateusz Kaduk 2012-01-25 02:23:13 UTC
lspci -nn | grep VGA

00:02.0 VGA compatible controller [0300]: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller [8086:0116] (rev 09)
Comment 3 Kenneth Graunke 2012-02-18 19:12:03 UTC
I've trimmed this down to 104Kb/280 GL call trace that reproduces the problem.

It looks like the culprit is glClear(GL_DEPTH_BUFFER_BIT | ...) in the presence of MRTs.  Need to figure out what's going wrong exactly, but this is a much smaller haystack!
Comment 4 Kenneth Graunke 2012-02-18 21:44:33 UTC
Created attachment 57264 [details] [review]
patch to fix the hang, not otherwise tested

The attached patch fixes the GPU hangs in OilRush; I can now play the game.

I haven't done a Piglit run on this, nor have I posted it for feedback yet.  I'm not entirely sure it's sufficient; there are probably other bugs lurking here.  I'll need to write some MRT test cases.

That said, I figured I'd post it early so you can play with it.
Comment 5 Mateusz Kaduk 2012-02-18 23:49:51 UTC
(In reply to comment #4)
> That said, I figured I'd post it early so you can play with it.

Hi Kenneth, Thanks for the patch. I did test it, game starts, I don't get GPU hung error, but I see the following errors on the console:

GLFrameBuffer::enable(): incomplete attachment
GLFrameBuffer::enable(): incomplete attachment
GLFrameBuffer::enable(): incomplete attachment
GLFrameBuffer::enable(): incomplete attachment
GLFrameBuffer::enable(): incomplete attachment
GLFrameBuffer::enable(): incomplete attachment
GLFrameBuffer::enable(): incomplete attachment
GLFrameBuffer::enable(): incomplete attachment
OpenGL error: invalid value
GLFrameBuffer::enable(): incomplete attachment
GLFrameBuffer::enable(): incomplete attachment
GLFrameBuffer::enable(): incomplete attachment
GLFrameBuffer::enable(): incomplete attachment
GLFrameBuffer::enable(): incomplete attachment
GLFrameBuffer::enable(): incomplete attachment
GLFrameBuffer::enable(): incomplete attachment
GLFrameBuffer::enable(): incomplete attachment
OpenGL error: invalid framebuffer operation
GLFrameBuffer::enable(): incomplete attachment
etc...

Moreover, as I mentioned earlier during our IRC talk, game is very slow, both with and without the patch. But I don't know if it's hardware or driver the bottleneck. I did few missions, but it seems responsiveness is the key requirement to finish more difficult missions, so it's not really playable yet, but at least does not hung gpu now. Thanks.
Comment 6 Mateusz Kaduk 2012-02-20 11:12:02 UTC
Created attachment 57344 [details]
Same hung but now in other game

Oh.. now strange things are happening in RegnumOnline, and I got this error while playing Regnum.
drm:i915_hangcheck_elapsed] *ERROR* Hangcheck timer elapsed... GPU hung
[drm] capturing error event; look for more information in /debug/dri/0/i915_error_state
[drm:i915_wait_request] *ERROR* i915_wait_request returns -11 (awaiting 2397072 at 2397053, next 2397074)


This happened while switching between fullscreen and window mode, and is not easily reproducible, just never happened before to me.
Comment 7 Kenneth Graunke 2012-02-21 12:39:06 UTC
Let's keep one application per bug.

The GPU hang in OilRush is fixed in master with:

commit 172bb92db1a3c317867d9cfec6f15c09c37a0f6c
Author: Kenneth Graunke <kenneth@whitecape.org>
Date:   Sat Feb 18 21:29:29 2012 -0800

    i965: Only set Last Render Target Select on the last FB write.
    
    Fixes GPU hangs in OilRush, Trine, and Amnesia: The Dark Descent,
    which all use MRT (multiple render targets).
    
    NOTE: This is a candidate for release branches.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=38720
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=40059
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=45216
    Reviewed-by: Eric Anholt <eric@anholt.net>
    Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>

I haven't seen the FBO incompleteness errors you're getting, but I haven't tried playing around with the detail settings yet.  I'll take a look at that.
Comment 8 Kenneth Graunke 2012-02-21 12:40:01 UTC
Oh, one thing worth checking: are you building Mesa with --enable-texture-float?  And do you have libtxc_dxtn installed?
Comment 9 Mateusz Kaduk 2012-02-21 14:39:39 UTC
No if --enable-texture-float wasnt by default enabled, then I dont build with it.
Yes I have libtxc_dxtn installed, otherwise RegnumOnline wont start, and will complain that my driver is not supported.
Comment 10 Kenneth Graunke 2012-02-28 13:13:30 UTC
Hang fix cherry-picked to the 8.0 branch:

commit 16cc79f975816c0741711560be48fc498d4b4794
Author: Kenneth Graunke <kenneth@whitecape.org>
Date:   Sat Feb 18 21:29:29 2012 -0800

    i965: Only set Last Render Target Select on the last FB write.
    
    Fixes GPU hangs in OilRush, Trine, and Amnesia: The Dark Descent,
    which all use MRT (multiple render targets).
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=38720
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=40059
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=45216
    Reviewed-by: Eric Anholt <eric@anholt.net>
    Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
    (cherry picked from commit 172bb92db1a3c317867d9cfec6f15c09c37a0f6c)
Comment 11 Kenneth Graunke 2012-03-07 16:41:51 UTC
Closing as OilRush is working.  For FBO completeness errors, I believe you need to compile with --enable-texture-float.  I believe Unigine is trying to use that regardless of whether the driver actually supports it, which sounds like a Unigine bug.  But it does work if you have that enabled.

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.