MangoHud icon indicating copy to clipboard operation
MangoHud copied to clipboard

MangoHUD Causing Frame Pacing Stutters When Enabled

Open bluestang2006 opened this issue 1 year ago • 11 comments

Describe the bug When enabling MangoHud in Steam games, I am getting frame pacing stutters. These stutters are visible in the frame pacing graph and in the displayed min/max values as well.

However, if I just use the MESA Overlay with the options below I get a normal looking frame pacing graph. But if I enable both MangoHud and the MESA Overylay the stutters are present on both graphs. VK_INSTANCE_LAYERS=VK_LAYER_MESA_overlay VK_LAYER_MESA_OVERLAY_CONFIG=fps=1,frame_timing=1

I also get normal frame pacing graphs with games that use DXVK and I use the DXVK Hud on its own. If I also enable MangoHud alongside with the DXVK Hud the stutters are present on both graphs too.

List relevant hardware/software information

  • Fedora 38 KDE
  • MangoHud git
  • Asrock 6800XT
  • MESA git (23.2-devel)

To Reproduce Steps to reproduce the behavior:

  1. Enable MangoHud on any Steam game.

Expected behavior No stutters with MangoHud, or at least a decent delta of the min/max values.

Screenshots Example of frame pacing issue: min 8.8 ms / max 33.3 ms and visible spikes in graph MH-stutter

Example of framing pacing issue: MESA Overlay & MangoHud where both frame pacing graphs are the same MANGOHUD-MESA

Example of just the MESA Overlay where frame pacing looks about normal: min 10.341 ms / max 14.209 ms MESA

Additional context I am using CoreCtrl and the power profile is set to 3D Full Screen.

bluestang2006 avatar Jun 17 '23 18:06 bluestang2006

So if I limit the refresh rate to 60 FPS for this particular game it gets rid of the spikes in the frame pacing graph. (i.e - limiting it to below the max FPS my GPU can achieve)

bluestang2006 avatar Aug 10 '23 22:08 bluestang2006

Did you pin your GPU to a specific frequency? Try setting both min and max CPU freq in CoreCtrl to 2500Mhz and try again. I have a 6800XT and had horrible pacing because the CPU frequency kept going up and down like crazy for no reason. I have pinned my frequency and stopped having issues. If that works, try setting a high range like 2200Mhz for min and 2500Mhz for max, just so that the GPU doesn't constantly run at max speeds and high temps.

ademlabs avatar Aug 12 '23 00:08 ademlabs

Did you pin your GPU to a specific frequency? Try setting both min and max CPU freq in CoreCtrl to 2500Mhz and try again. I have a 6800XT and had horrible pacing because the CPU frequency kept going up and down like crazy for no reason. I have pinned my frequency and stopped having issues. If that works, try setting a high range like 2200Mhz for min and 2500Mhz for max, just so that the GPU doesn't constantly run at max speeds and high temps.

It doesn't work, but the spikes are happening exactly on the fps_sampling_period (default 500ms).

I set it to 250ms and got twice as many on the frame pacing graph. Hate to ping @flightlessmango, but I figured out the interval of where it's happening.

bluestang2006 avatar Aug 12 '23 00:08 bluestang2006

I set it to 250ms and got twice as many on the frame pacing graph

That makes sense since everything updates on the sampling rate, but it doesn't get us any closer to what the issue is.

What I would do is to remove lines one by one in update_hw_info function until the issue stops and then we have something to go on https://github.com/flightlessmango/MangoHud/blob/3922da8a3990e6d6dd6d4b6ef13a433217367ae2/src/overlay.cpp#L105

flightlessmango avatar Aug 12 '23 08:08 flightlessmango

That makes sense since everything updates on the sampling rate, but it doesn't get us any closer to what the issue is.

What I would do is to remove lines one by one in update_hw_info function until the issue stops and then we have something to go on

https://github.com/flightlessmango/MangoHud/blob/3922da8a3990e6d6dd6d4b6ef13a433217367ae2/src/overlay.cpp#L105

Ah thanks for the tip, found the problem function: https://github.com/flightlessmango/MangoHud/blob/3922da8a3990e6d6dd6d4b6ef13a433217367ae2/src/overlay.cpp?plain=1#L168

Commenting this out gets rids of the spikes.

Screenshot_20230812_132546

bluestang2006 avatar Aug 12 '23 19:08 bluestang2006

What is your full config?

flightlessmango avatar Aug 12 '23 21:08 flightlessmango

What is your full config?

I assume your talking about the MangoHud.conf file?:

Its generated by GOverlay btw...

################### File Generated by GOverlay ###################

toggle_fps_limit=F1


legacy_layout=false
gpu_stats
gpu_temp
gpu_core_clock
gpu_power
gpu_load_change
gpu_load_value=50,90
gpu_load_color=FFFFFF,FFAA7F,CC0000
gpu_text=GPU
cpu_stats
cpu_temp
cpu_mhz
cpu_load_change
core_load_change
cpu_load_value=50,90
cpu_load_color=FFFFFF,FFAA7F,CC0000
cpu_color=2e97cb
cpu_text=CPU
io_color=a491d3
vram
vram_color=ad64c1
ram
ram_color=c26693
fps
fps_sampling_period=500
engine_version
engine_color=eb5b5b
gpu_color=2e9762
vulkan_driver
wine
wine_color=eb5b5b
frame_timing=1
frametime_color=00ff00
resolution
custom_text=Session:
exec=printf $XDG_SESSION_TYPE
media_player
media_player_color=ffffff
background_alpha=0.4
font_size=22

background_color=020202
position=top-left
text_color=ffffff
round_corners=10
#GOVERLAY_THEME=mangohuddefault
toggle_hud=Shift_R+F12
toggle_logging=Shift_L+F2
upload_log=F5
output_folder=/home/bluestang
media_player_name=spotify

bluestang2006 avatar Aug 13 '23 03:08 bluestang2006

Remove any exec option and see if that also fixes it

flightlessmango avatar Aug 13 '23 12:08 flightlessmango

Remove any exec option and see if that also fixes it

Bingo, the exec=printf $XDG_SESSION_TYPE line is at fault. FWIW, GOverlay actually inserts exec=printf x11/wayland depending on what is detected but it doesn't detect the session dynamically.

So sounds like this needs to be an issue on GOverlay then...thanks for the help!

bluestang2006 avatar Aug 13 '23 15:08 bluestang2006

Seems like I can repro it with any exec so it's probably still a mangohud issue. But also yeah goverlay should probably change that exec

flightlessmango avatar Aug 13 '23 15:08 flightlessmango

Same issue here, fedora 39, mangohud 0.7.0. Removing all exec from the config file, there is no more issue (regular spikes).

Chevek avatar Jan 14 '24 14:01 Chevek

exec has been reworked and it shouldn't cause any stuttering anymore

flightlessmango avatar May 22 '24 11:05 flightlessmango