Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Refresh rate drops when the game is minimized (alt-tabbed) #2828

Open
1 task done
Player701 opened this issue Nov 21, 2024 · 11 comments
Open
1 task done

[BUG] Refresh rate drops when the game is minimized (alt-tabbed) #2828

Player701 opened this issue Nov 21, 2024 · 11 comments
Labels

Comments

@Player701
Copy link
Contributor

GZDoom version

4.13.2 and 4.14pre-89-g99c058d16

Which game are you running with GZDoom?

Doom 2

What Operating System are you using?

Windows 11

Please describe your specific OS version

Windows 11 Pro 23H2 (build 22631.4460)

Relevant hardware info

NVIDIA RTX 4090

Have you checked that no other similar issue already exists?

  • I have searched and not found similar issues.

A clear and concise description of what the bug is.

With the latest NVIDIA driver (v. 566.14 as of now) and a G-Sync Compatible monitor with a variable refresh rate, the latter appears to drop severely when Alt-Tabbing out of the game window. For example, my monitor's OSD shows that the refresh rate is 49 Hz (!) when the game is minimized. This is highly noticeable especially compared to the default refresh rate of 144 Hz, making all animations in the OS GUI, like scrolling and even cursor movement, feel very choppy.

Note that this happens regardless of whether the game is paused or not, and it isn't even necessary to start a level in order to witness this effect. But it only happens in fullscreen mode, not windowed. As long as GZDoom is running in windowed mode and the window is brought out of focus, the refresh rate stays at maximum.

This issue manifests only with the Vulkan backend. OpenGL and OpenGL ES are not affected.

Steps to reproduce the behaviour.

Explain how to reproduce

  1. Launch GZDoom in fullscreen mode
  2. Alt-tab out of the game
  3. Witness the effect

Your configuration

Since this issue may be dependent on user configuration, here it is:
https://gist.github.com/Player701/2783fb5bb4cc595ad2de0316990fbf3c

No overrides have been applied for GZDoom in the NVIDIA control panel.

Provide a Log

https://gist.github.com/Player701/128e9c690adcfc64f5daadf98db149e6

@Player701 Player701 added the bug label Nov 21, 2024
@RicardoLuis0
Copy link
Collaborator

does passing -noidle as a commandline parameter change that? by default gzdoom drops down to a lower process priority when unfocused

@Player701
Copy link
Contributor Author

-noidle appears to have absolutely no effect on this whatsoever, unfortunately.

@RicardoLuis0
Copy link
Collaborator

RicardoLuis0 commented Nov 21, 2024

does setting i_pauseinbackground to false change things? (could be the pause menu is lowering max fps)

@Player701
Copy link
Contributor Author

does setting i_pauseinbackground to false change things?

No, it doesn't look like it - even when I start a level. I mean, the game is progressing in the background as it should be, but my monitor is still stuck at 49 Hz.

@RicardoLuis0
Copy link
Collaborator

RicardoLuis0 commented Nov 21, 2024

i have the slight suspicion this might be windows' doing for minimized programs
does any other game behave like this when minimized?

@madame-rachelle
Copy link
Collaborator

madame-rachelle commented Nov 21, 2024

You can try following this image if you want to change Windows' default process scheduling method (does not require restart AFAIK):
image

Keep in mind that optimizing for background processes is normally used for servers but it ensures all process gain equal time. Also keep in mind that it means all processes, not just the ones you see - so this can be problematic if you have a lot of stuff running on your machine at once.

EDIT: Oh and one other thing - if you have a GSYNC/FreeSync monitor, and unfocus the display, FreeSync will stop working for that application, meaning GZDoom will now be locked to the refresh rate of the foreground application. This may also make things appear slower.

@Player701
Copy link
Contributor Author

i have the slight suspicion this might be windows' doing for minimized programs
does any other game behave like this when minimized?

I think you might be on to something here. I don't have a lot of other games installed, but I do have one that I know supports Vulkan: The Talos Principle (1). And when it's minimized, the observed behavior does indeed appear to be similar, albeit not entirely the same: according to the OSD, the refresh rate fluctuates wildly between 144 Hz and somewhere around 50 Hz. The impact on smoothness is also noticeable, but perhaps a bit less than with GZDoom. And changing the backend to D3D11 makes it go away, just like it does when switching to OpenGL (ES) in GZDoom.

So, not sure about Windows, but could it be a graphics driver issue then, maybe?

You can try following this image if you want to change Windows' default process scheduling method (does not require restart AFAIK):

Thanks, but that didn't change anything, even after a restart.

EDIT: Oh and one other thing - if you have a GSYNC/FreeSync monitor, and unfocus the display, FreeSync will stop working for that application, meaning GZDoom will now be locked to the refresh rate of the foreground application. This may also make things appear slower.

Now, there is one other thing this your other thing prompted me to check:

If I alt-tab out of the game and press Win+D, the refresh rate goes to the usual 144 Hz until I unminimize GZDoom and then alt-tab again. (Interestingly, TTP seems to crash every time I do that, and again only when using Vulkan.)

@Cacodemon345
Copy link
Contributor

https://learn.microsoft.com/en-us/windows/win32/api/timeapi/nf-timeapi-timebeginperiod

I have a feeling it is related to Windows 11's new timer behavior for minimized apps.

@RicardoLuis0
Copy link
Collaborator

https://learn.microsoft.com/en-us/windows/win32/api/timeapi/nf-timeapi-timebeginperiod

I have a feeling it is related to Windows 11's new timer behavior for minimized apps.

seems like the new behavior can be disabled
https://stackoverflow.com/a/78791212

@Player701
Copy link
Contributor Author

https://learn.microsoft.com/en-us/windows/win32/api/timeapi/nf-timeapi-timebeginperiod

I have a feeling it is related to Windows 11's new timer behavior for minimized apps.

I've got a report from another person who's running the same GPU driver but an older OS (Windows 10 Pro 22H2 build 19045.5131) - he could not reproduce the issue. Quite possible that it only appears on Windows 11, then.

@Player701
Copy link
Contributor Author

https://learn.microsoft.com/en-us/windows/win32/api/timeapi/nf-timeapi-timebeginperiod

I have a feeling it is related to Windows 11's new timer behavior for minimized apps.

Perhaps unrelated, but I've also recently noticed that alt-tabbing out of GZDoom and then back in might introduce a significant amount of in-game audio lag when I'm using my Bluetooth headset. I understand that some latency with Bluetooth is unavoidable, but sometimes it gets so high (at least half a second by the feel of it) that it becomes downright annoying. Restarting sound does not help at all, only alt-tabbing again does, but not all the time. Could it also be due to this Windows timer behavior?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants