Bug 103537

Summary: i965: Shadow of Mordor broken since commit 379b24a40d3d34ffdaaeb1b328f50e28ecb01468 on Haswell
Product: Mesa Reporter: Darius Spitznagel <d.spitznagel>
Component: Drivers/DRI/i965Assignee: Timothy Arceri <t_arceri>
Status: RESOLVED FIXED QA Contact: Intel 3D Bugs Mailing List <intel-3d-bugs>
Severity: normal    
Priority: medium    
Version: git   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 103491    
Attachments: SoM rendering artifacts in the menu
SoM rendering artifacts in benchmark
SoM heavy rendering artifacts in the menu

Description Darius Spitznagel 2017-11-01 18:59:44 UTC
Hello Mesa team,

today I wanted to try out the Intel disk shader cache which landed some hours ago in mesa master with Shadow of Mordor.
I started the game after some months not playing it and was surprised by a broken start menu (Talion was also not visible). The menu was not responding and I hit ALT+F4 several times.
Some seconds later SoM exited.
dmesg showed...

15802.984693] drm/i915: Resetting chip after gpu hang
[15813.032755] drm/i915: Resetting chip after gpu hang
[15822.024888] drm/i915: Resetting chip after gpu hang
[15832.008993] drm/i915: Resetting chip after gpu hang
[15842.025063] drm/i915: Resetting chip after gpu hang
[15854.025184] drm/i915: Resetting chip after gpu hang
[15865.033352] drm/i915: Resetting chip after gpu hang

Bisecting leads me to...

379b24a40d3d34ffdaaeb1b328f50e28ecb01468 is the first bad commit
commit 379b24a40d3d34ffdaaeb1b328f50e28ecb01468
Author: Timothy Arceri <tarceri@itsqueeze.com>
Date:   Thu Sep 7 23:29:25 2017 +1000

    i965: make use of nir linking
    
    For now linking is just removing unused varyings between stages.
    
    shader-db results BDW:
    
    total instructions in shared programs: 13198288 -> 13191693 (-0.05%)
    instructions in affected programs: 48325 -> 41730 (-13.65%)
    helped: 473
    HURT: 0
    
    total cycles in shared programs: 541184926 -> 541159260 (-0.00%)
    cycles in affected programs: 213238 -> 187572 (-12.04%)
    helped: 435
    HURT: 8
    
    V2:
    - lower indirects on demoted inputs as well as outputs.
    
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>

:040000 040000 90e4aaacaa7a00a32657e23fb0ca89dec26d2976 169fe3798b397c71851aa4ca9b7cb381254698a1 M	src

Could someone please look into this?

Mesa 17.2.4 works.

My Specs:
root@pc1:/home/darius# glxinfo | grep OpenGL
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) Haswell Desktop 
OpenGL core profile version string: 4.5 (Core Profile) Mesa 17.4.0-devel (git-8d8b9d11c9)
OpenGL core profile shading language version string: 4.50
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 3.0 Mesa 17.4.0-devel (git-8d8b9d11c9)
OpenGL shading language version string: 1.30
OpenGL context flags: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.1 Mesa 17.4.0-devel (git-8d8b9d11c9)
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.10
OpenGL ES profile extensions:
Comment 1 Timothy Arceri 2017-11-03 02:42:00 UTC
Strange master is working fine on my BDW.
Comment 2 Matt Turner 2017-11-03 03:55:02 UTC
(In reply to Timothy Arceri from comment #1)
> Strange master is working fine on my BDW.

Could it be something about HSW using vec4/vs and BDW using scalar/vs?
Comment 3 Darius Spitznagel 2017-11-03 10:22:19 UTC
In the meantime I've tested more games...

HITMAN Free Trial > SIGSEV 11 > GPU Hang in dmesg
ASTROKILL (UE4 Engine) > Huge regression > unplayable
EVERSPACE (UE4 Engine) > Huge regression > unplayable
Tomb Raider > OK
Mad Max (OpenGL) > OK

When I start SoM with MESA_EXTENSION_OVERRIDE=-GL_ARB_compute_shader start menu works again, but Talion is misrendered.
Seems like 17.4.0-devel has problems with some compute shaders on Haswell.

More Specs:
OS: Debian 9.2
Kernel: 4.9.59
Libdrm: 2.4.84
Xorg: 1.19.5
Comment 4 Timothy Arceri 2017-11-03 11:07:24 UTC
I'm still waiting for SoM to install on my HSW but I suspect patches 17-19 from this series [1] will fix the bug.

[1] https://patchwork.freedesktop.org/series/32809/
Comment 5 Darius Spitznagel 2017-11-05 10:56:02 UTC
Created attachment 135243 [details]
SoM rendering artifacts in the menu
Comment 6 Darius Spitznagel 2017-11-05 10:57:40 UTC
Created attachment 135244 [details]
SoM rendering artifacts in benchmark
Comment 7 Darius Spitznagel 2017-11-05 10:58:55 UTC
(In reply to Timothy Arceri from comment #4)
> I'm still waiting for SoM to install on my HSW but I suspect patches 17-19
> from this series [1] will fix the bug.
> 
> [1] https://patchwork.freedesktop.org/series/32809/

I've applied the patches to todays mesa master (git-608af05ffb) and they fix the broken menu (Talion is visible again too) but not completely.
Little rendering problems still remain.

I took one screenshot from the menu and one from the buildin benchmark.

In the first one you can see rendering artifacts in the face of Talion.
In the second one you can see rendering artifacts on the cloak of Talion.

Sometimes there are more rendering artifacts sometimes less.
Comment 8 Darius Spitznagel 2017-11-05 11:19:49 UTC
Created attachment 135245 [details]
SoM heavy rendering artifacts in the menu
Comment 9 Timothy Arceri 2017-11-06 23:04:09 UTC
I've disabled nir linking on HSW and below until someone has time to look into why this regression is happening.

commit a9000cb860242d2d0308aec3e8fc20148a2c5eec
Author: Timothy Arceri <tarceri@itsqueeze.com>
Date:   Mon Nov 6 10:31:30 2017 +1100

    i965: disable NIR linking on HSW and below
    
    Fixes: 379b24a40d3d "i965: make use of nir linking"
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103537
    Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>

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.