Bug 98693

Summary: Mad Max: Long lags when VRAM full
Product: Mesa Reporter: Jani Kärkkäinen <jani.karkkainen>
Component: Drivers/Gallium/r600Assignee: Default DRI bug account <dri-devel>
Status: RESOLVED NOTABUG QA Contact: Default DRI bug account <dri-devel>
Severity: normal    
Priority: medium CC: jani.karkkainen
Version: git   
Hardware: x86-64 (AMD64)   
OS: All   
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 77449    
Attachments: GALLIUM_HUD enabled with requested settings

Description Jani Kärkkäinen 2016-11-12 00:46:58 UTC
I get random lagging when playing the recently released Mad Max. Every once in a while, the game freezes completely, and gets back to the game after an arbitrary amount of seconds, anywhere from 2 to 35. 

With GALLIUM_HUD, and noticed that the lags appear to precede the VRAM slowly ramping up to full, and then I get this huge lag, and then VRAM usage is a lot lower (eg. from 1GB to ~600MB).

I found this possibly related news item from a couple of months back: https://www.gamingonlinux.com/articles/a-reason-for-poor-performance-on-amd-plus-mesa-has-been-found-and-a-patch-is-in-progress.7873
Comment 1 Michel Dänzer 2016-11-16 08:46:49 UTC
Please attach a screenshot taken withing a minute after a freeze with GALLIUM_HUD=.dfps,requested-VRAM+VRAM-usage,requested-GTT+GTT-usage,.dnum-bytes-moved,.dbuffer-wait-time,.dnum-compilations+num-shaders-created .
Comment 2 Jani Kärkkäinen 2016-11-17 03:52:06 UTC
Created attachment 128034 [details]
GALLIUM_HUD enabled with requested settings

GALLIUM_HUD enabled with requested statistics with VRAM and GTT etc. Shows two laggy parts, a small lag and then a big lag.
Comment 3 Michel Dänzer 2016-11-17 05:50:36 UTC
Assuming your card has 1GB of VRAM, the fundamental problem is that the game wants to use more VRAM than is available. Maybe you can try reducing the game's graphics settings such that the 'requested VRAM' number drops below 1GB.
Comment 4 Jani Kärkkäinen 2016-11-17 10:24:25 UTC
(In reply to Michel Dänzer from comment #3)
> Assuming your card has 1GB of VRAM, the fundamental problem is that the game
> wants to use more VRAM than is available. Maybe you can try reducing the
> game's graphics settings such that the 'requested VRAM' number drops below
> 1GB.

Indeed. The game's settings are at the minimum, and the resolution is @ 720p. I hoped the lowest setting would alleviate the lags, but unfortunately it didn't. However, just by reading the links from the article I linked in my original message, I thought that it should be possible to play with less VRAM than what is needed, as per:

"The game I'm testing needs 3.4 GB of VRAM.

Setups:
Tonga - 2 GB: It's nearly unplayable, because freezes occur too often.
Fiji - 4 GB: There is one freeze at the beginning (which is annoying
too), after that it's smooth.

So even 4 GB is not enough."

Also the descriptions of the problem seem to match mine. A problem in memory handling?

Thanks for the suggestion though, anything that could remove or at least reduce the lags would make the game from mostly playable to very playable (for me at least).
Comment 5 Alex Deucher 2016-11-17 13:37:44 UTC
(In reply to Jani Kärkkäinen from comment #4)
> "The game I'm testing needs 3.4 GB of VRAM.
> 
> Setups:
> Tonga - 2 GB: It's nearly unplayable, because freezes occur too often.
> Fiji - 4 GB: There is one freeze at the beginning (which is annoying
> too), after that it's smooth.
> 
> So even 4 GB is not enough."
> 
> Also the descriptions of the problem seem to match mine. A problem in memory
> handling?

The freeze at the beginning is most likely shader compilation.  Mesa does not have a shader cache yet.
Comment 6 Timothy Arceri 2019-07-04 02:36:41 UTC
The games requirements list a card with a minimum 2GB but recommend 4GB.

As for lagging at the start with a 4GB card, r600 now has shader cache support (at the TGSIU level at least) so this should not longer be a big issue. Closing.

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.