Bug 38863

Summary: [IVB]GPU hang when running 3D games like openarena
Product: Mesa Reporter: meng <mengmeng.meng>
Component: Drivers/DRI/i965Assignee: Kenneth Graunke <kenneth>
Status: VERIFIED FIXED QA Contact: zhao jian <jian.j.zhao>
Severity: critical    
Priority: high CC: bo.b.wang, jbarnes, kenneth
Version: 7.11   
Hardware: All   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: Xorg.log
i915_error_state.tar.gz
dmesg
Patch to fix the GPU hangs by emitting depth stalls.

Description meng 2011-06-30 22:05:50 UTC
System Environment:
--------------------------
Platform: IVB
Libdrm:  (master)2.4.26
Mesa:    (7.11)b90c710c6cd8017f59b09d935fbbbe94ada81a12
Xserver:
(server-1.10-branch)xorg-server-1.10.2.901-5-g79ef102c3adf7cae8982b05320109d0439e6587c
Xf86_video_intel:(master)2.15.0-152-g18d08e49d270b7a05f14a309759c9315e5ab9679
Cairo:    (master)ea645913ba8739377ee2e2b51480310befc19b76
Libva:    (master)5343740dfec289858cfafda64dd5260179d09d4f
Kernel:   (drm-intel-fixes) f01c22fd59aa10a3738ede20fd4b9b6fd1e2eac3

Bug detailed description:
-------------------------
GPU hang when running 3D games or its demo like openarena.Pls see Xorg.log and i915_error_state.log. The problem doesn't exist on SNB.

Reproduce steps:
----------------
1.xinit& 
2.run openarena or demo
vblank_mode=0 openarena +exec pts +set r_mode -1 +set r_fullscreen 1 +set r_customWidth 1024 +set r_customHeight 768
Comment 1 meng 2011-06-30 22:06:27 UTC
Created attachment 48634 [details]
Xorg.log
Comment 2 meng 2011-06-30 22:07:02 UTC
Created attachment 48635 [details]
i915_error_state.tar.gz
Comment 3 meng 2011-06-30 22:07:44 UTC
Created attachment 48636 [details]
dmesg
Comment 4 Chris Wilson 2011-07-01 00:31:06 UTC
First there is the missed IRQ issue, which will need the same workarounds as SNB, or a real fix. ;-) But there is also a genuine GPU hang...
Comment 5 meng 2011-07-01 00:40:57 UTC
When enable semaphores, no "missed IRQ" issue, but GPU still hang on IVB.
Comment 6 Kenneth Graunke 2011-07-01 10:40:15 UTC
Does the hang occur every time, or is it intermittent?  In my own testing, I found that OA hung once in a while, but usually worked fine...
Comment 7 Kenneth Graunke 2011-07-01 12:17:12 UTC
Nevermind, I can reproduce it consistently now.  Must be a recent occurance.  Looking into it.
Comment 8 meng 2011-07-03 18:18:57 UTC
Test commit 2b1ecb7337592a7bf0989efac46a5b52daab769e,the problem still exists.
Comment 9 Kenneth Graunke 2011-08-15 11:08:44 UTC
This still occurs with Ivybridge C0 hardware.
Comment 10 Kenneth Graunke 2011-09-01 11:20:04 UTC
To clarify: this is a software bug in our driver.  I haven't had time to analyze it further.
Comment 11 Kenneth Graunke 2011-09-06 06:01:12 UTC
Created attachment 50936 [details] [review]
Patch to fix the GPU hangs by emitting depth stalls.

With the attached patch, OpenArena no longer hangs my Ivybridge system.
Comment 12 zhao jian 2011-09-14 07:30:31 UTC
(In reply to comment #11)
> Created an attachment (id=50936) [details]
> Patch to fix the GPU hangs by emitting depth stalls.
> With the attached patch, OpenArena no longer hangs my Ivybridge system.

Hi Ken,
With your patch on IvyBridge C0, all the 3D games(openarena, urbanterror and nexuiz) will no longer make GPU hang though there is still some error message in dmesg like: [drm:i915_hangcheck_elapsed] *ERROR* Hangcheck timer elapsed... GPU hung   [drm:i915_wait_request] *ERROR* i915_wait_request returns -11 (awaiting 437 at 431, next 444)  

But with this patch on some other IvyBridge machines, openarena will also work well without GPU hang but other games like urbanterror will make system hang.
Comment 13 Kenneth Graunke 2011-09-26 15:52:43 UTC
commit 8bd27a5b080157cb1d5fc0383ce45574c7b16aa5
Author: Kenneth Graunke <kenneth@whitecape.org>
Date:   Thu Sep 1 04:18:20 2011 -0700

    i965: Emit depth stalls and flushes before changing depth state on Gen6+.
    
    Fixes OpenArena on Gen7.  Technically, adding only the first depth stall
    fixes it, but the documentation says to do all three, and the Windows
    driver seems to do it.
    
    Not observed to fix anything on Gen6 yet.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=38863
    Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
    Reviewed-by: Eric Anholt <eric@anholt.net>

It sounds like OpenArena is working now.  Jian, feel free to open bug reports for other games, but I'd prefer to track those as separate issues.
Comment 14 zhao jian 2011-09-28 04:03:01 UTC
(In reply to comment #13)
> commit 8bd27a5b080157cb1d5fc0383ce45574c7b16aa5
> Author: Kenneth Graunke <kenneth@whitecape.org>
> Date:   Thu Sep 1 04:18:20 2011 -0700
>     i965: Emit depth stalls and flushes before changing depth state on Gen6+.
>     Fixes OpenArena on Gen7.  Technically, adding only the first depth stall
>     fixes it, but the documentation says to do all three, and the Windows
>     driver seems to do it.
>     Not observed to fix anything on Gen6 yet.
>     Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=38863
>     Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
>     Reviewed-by: Eric Anholt <eric@anholt.net>
> It sounds like OpenArena is working now.  Jian, feel free to open bug reports
> for other games, but I'd prefer to track those as separate issues.

With the newest code on master branch and kernel 3.1.0-rc6 on -next branch, there is no GPU hang now. Ken, can you also apply it to 7.11 branch?
Comment 15 Gordon Jin 2011-10-07 23:26:05 UTC
let's leave it open until it's fixed on 7.11 branch.
Comment 16 Kenneth Graunke 2011-10-20 17:28:52 UTC
commit 38dfedccb2a2b695a600350a75113e8c35683498
Author: Kenneth Graunke <kenneth@whitecape.org>
Date:   Thu Sep 1 04:18:20 2011 -0700

    i965: Emit depth stalls and flushes before changing depth state on Gen6+.
    
    Fixes OpenArena on Gen7.  Technically, adding only the first depth stall
    fixes it, but the documentation says to do all three, and the Windows
    driver seems to do it.
    
    Not observed to fix anything on Gen6 yet.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=38863
    Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
    Reviewed-by: Eric Anholt <eric@anholt.net>
    (cherry picked from commit 02c4dc807e91640c69c8addc3c797300a3c536ad)
Comment 17 Gordon Jin 2011-11-01 01:30:56 UTC
Jian, can you help verifying this bug?
Comment 18 meng 2014-07-18 01:39:06 UTC
Verified with the above commit git-38dfedc.

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.