Bug 96573

Summary: Micro freezes resulting in crash in Tomb Raider 2013 / Wine+Skyrim
Product: Mesa Reporter: bartos.petr
Component: Drivers/DRI/i965Assignee: Ian Romanick <idr>
Status: RESOLVED FIXED QA Contact: Intel 3D Bugs Mailing List <intel-3d-bugs>
Severity: major    
Priority: medium CC: eero.t.tamminen
Version: git   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: Output from dmesg
Content of /sys/class/drm/card1/error
Game log with INTEL_DEBUG=perf
Game crash dump

Description bartos.petr 2016-06-18 08:26:42 UTC
Hi,
on Intel HD Graphics 5500 (Broadwell GT2) with with git version of mesa (installed from https://copr.fedorainfracloud.org/coprs/griever/mesa-git/) I'm seeing micro freezes from half second up to few seconds, resulting in final freeze followed by program crash. I'm seeing this in games like Tomb Raider 2013 (native port) or Skyrim (via latest wine). It seems to be triggered when turning around or when some particle effect is displayed.
It was OK up to version 11.3.0-0.36.gite79aa19, problem first appeared in 11.3.0-0.37.git357495b and is still there in 12.1.0-0.6.git7d7e015
Comment 1 Kenneth Graunke 2016-06-23 04:40:11 UTC
When this happens, can you check the output of "dmesg"?  Do you see messages about GPU hangs?  If so, please attach /sys/class/drm/card0/error.
Comment 2 Eero Tamminen 2016-06-23 14:40:01 UTC
Besides GPU hang, freezes could be shader recompiles, and crash could also be due to game (eventually) running out of memory, *if* these games are 32-bit.   INTEL_DEBUG=perf would tell about re-compiles.
Comment 3 bartos.petr 2016-06-23 16:57:01 UTC
Created attachment 124685 [details]
Output from dmesg
Comment 4 bartos.petr 2016-06-23 16:57:30 UTC
Created attachment 124686 [details]
Content of /sys/class/drm/card1/error
Comment 5 bartos.petr 2016-06-23 16:58:01 UTC
Created attachment 124687 [details]
Game log with INTEL_DEBUG=perf
Comment 6 bartos.petr 2016-06-23 16:58:58 UTC
Created attachment 124688 [details]
Game crash dump
Comment 7 bartos.petr 2016-06-23 17:03:56 UTC
Dmesg was cleaned before launch, so it contains everything from start to crash. Drm error log is from card1 (card0 did not contain any error). Crash dump is binary, but there are some readable parts so it may also help.
Btw the problem seems worse (less freezes, faster crash) with 12.1.0-0.9.gitab99196.
Comment 8 Kenneth Graunke 2016-06-23 18:34:45 UTC
Thanks, that looks like a GPU hang when running a shader.

Out of curiosity, does Tomb Raider's benchmark mode work for you?  I've run that many times on my Broadwell GT2 with no problems.  But maybe the particular particle effects that trigger the bad shader don't appear in that mode...
Comment 9 bartos.petr 2016-06-23 18:40:52 UTC
(In reply to Kenneth Graunke from comment #8)
> Thanks, that looks like a GPU hang when running a shader.
> 
> Out of curiosity, does Tomb Raider's benchmark mode work for you?  I've run
> that many times on my Broadwell GT2 with no problems.  But maybe the
> particular particle effects that trigger the bad shader don't appear in that
> mode...

Benchmark is OK. The worst place where freezes occurs is shipwreck beach. That place is completely unplayable with version newer than 11.3.0-0.36.gite79aa19. With 11.3.0-0.36.gite79aa19 I do not have single crash there.
Comment 10 bartos.petr 2016-06-23 18:51:58 UTC
I've now run the benchmark again (because I was not sure if I did not run it with older mesa). The benchmark do finish, however there are those microfreezes right after start when camera pans along the mountain to the sea. But they settle down (crash do not happen) and rest of benchmark is silky smooth.
Comment 11 Eero Tamminen 2016-06-27 07:04:32 UTC
(In reply to bartos.petr from comment #10)
> I've now run the benchmark again (because I was not sure if I did not run it
> with older mesa). The benchmark do finish, however there are those
> microfreezes right after start when camera pans along the mountain to the
> sea. But they settle down (crash do not happen) and rest of benchmark is
> silky smooth.

Do you see (new) GPU hangs in dmesg when those freezes happen?
Comment 12 bartos.petr 2016-06-28 17:54:13 UTC
No, first record in dmesg is final crash. Or maybe I should say "was", because I have tried also latest available build 12.1.0-0.11.git46dba70 and crashes are gone. Micro freezes are still there, but they are much shorter and less frequent (similar to what was in 11.3.0-0.36.gite79aa19).
Comment 13 Eero Tamminen 2016-09-12 15:38:31 UTC
(In reply to bartos.petr from comment #12)
> No, first record in dmesg is final crash. Or maybe I should say "was",
> because I have tried also latest available build 12.1.0-0.11.git46dba70 and
> crashes are gone.

I wonder could they've been related to GL 4.3 being enabled and games using additional features, which got fixes after that...


> Micro freezes are still there, but they are much shorter
> and less frequent (similar to what was in 11.3.0-0.36.gite79aa19).

The attached perf log shows slow (spilling) shader compilations just before crash, so micro freezes could be due to shader compilation.

You could verify that by monitoring perf log while doing things in the game.  If it gives messages about shader compilation right when you have momentary freezes, that's the issue.  That will mainly be helped by shader cache.

As this was mainly about crashes, I wonder whether this could be closed as fixed?
Comment 14 bartos.petr 2016-09-22 20:11:02 UTC
Well, Tomb Raider is still working with recent git version of Mesa (12.1.0-0.38.git557a29b). However I found another problem with Far Cry 2. Game starts, I can navigate menus, however game crashes on loading screen. In console there is either:

err:d3d:wined3d_debug_callback 0xa6d7670: "GL_OUT_OF_MEMORY in glCompressedTexSubImage2D"

many times or:

err:d3d:wined3d_debug_callback 0xa9189a8: "GL_OUT_OF_MEMORY in glMapBufferRange(map failed)

many times. with INTEL_DEBUG=perf I see many:

SIMD16 shader failed to compile: FS compile failed: Failure to register allocate.  Reduce number of live scalar values to avoid this.
Multi-LOD fast clear - giving up (1024x2048x11).

I did not play this game for some time, but I know for sure it was working on my machine before with same graphics setting. When I set everything to low details, game starts, but I did not yet found which setting is causing troubles. When I set back all settings to previous values in game, I can play for some time before game crashes. And I noted that there are many micro freezes (more than I remember there was), so I guess it is again some problem with shaders. I also found this issue https://bugs.freedesktop.org/show_bug.cgi?id=74868
Comment 15 bartos.petr 2016-09-22 20:26:26 UTC
And now I found I have also same crash on loading with BioShock 1. This time no GL_OUT_OF_MEMORY but many:

CPU mapping a busy MapBufferRange BO stalled and took 1.792 ms.
Stalling on the GPU for mapping a busy buffer object

and

SIMD16 shader failed to compile: FS compile failed: Failure to register allocate.  Reduce number of live scalar values to avoid this.

Btw both games starts and "run" with dgpu Radeon on same mesa version (with unplayable framerate due to crappy radeon driver state).
Comment 16 Kenneth Graunke 2016-09-22 23:51:01 UTC
So far in this bug, it looks like you've reported:

- GPU hangs
- Failure to map a buffer
- Performance stuttering
- A low framerate
- Lack of SIMD16 (not an actual bug)
- Stalls when mapping (not an actual bug, might explain some stuttering)

in:

- Tomb Raider 2013 (native)
- Skyrim (Wine)
- Far Cry 2 (Wine?)
- Bioshock 1 (Wine?)

Most of these are likely separate issues that may not be at all related.  With everything muddled together in one bug report, it's very difficult to tell exactly what you're asking us to do, much less track progress on fixing each of the issues you've encountered...
Comment 17 bartos.petr 2016-09-23 05:17:33 UTC
I knew it was comming :o) But for me as a noob i seemed that all was somehow related to shader problems (I saw some out of memory errors which Eero Tamminen mentioned as possible issue in comment 2). I have created https://bugs.freedesktop.org/show_bug.cgi?id=97901 and https://bugs.freedesktop.org/show_bug.cgi?id=97902 to track those problems with other games separately. So sorry for the inconvenience and lets close this bug.
Comment 18 Eero Tamminen 2016-09-26 10:54:46 UTC
Ok, marking as fixed.

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.