-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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
Framerate/FPS jumps to 110, wasting CPU, when game is minimized #19741
Comments
It seems that when minimized VSync is ignored. I've seen this on OS X too. A possible solution for this would be to limit the FPS to the display frequency when the app is minimized. |
Yes!when game minimized, cpu usage is very high (70%) on my imac 2017. |
Doesn't even have to be minimized. Just hidden. On my 2017 MBP, my project is set vsync=on and I turned on "print FPS", and then ran a scene.
If I set a FPS limit in the debug settings, then the problem does not occur; however, this is a workaround and not a solution. |
This could be solved by adding a FPS limit that applies only when the project is minimized. #29297 does something similar for the editor, which also applies when the window is unfocused. Limiting the FPS when the window is unfocused may be undesirable for some projects, but it would also solve the "fully occluded" case for the most part. Otherwise, to solve the "fully occluded" issue without capping the FPS when the window is unfocused, we'd need a way to detect when the window is fully occluded by another window. This is technically possible (it's been done in Chromium), but it's not particularly easy. |
Still valid in d8825fb |
See also godotengine/godot-proposals#2001. |
…s not visible (#7611) Fixes #5856. Fixes #8080. Fixes #9040. # Objective We need to limit the update rate of games whose windows are not visible (minimized or completely occluded). Compositors typically ignore the VSync settings of windows that aren't visible. That, combined with the lack of rendering work, results in a scenario where an app becomes completely CPU-bound and starts updating without limit. There are currently three update modes. - `Continuous` updates an app as often as possible. - `Reactive` updates when new window or device events have appeared, a timer expires, or a redraw is requested. - `ReactiveLowPower` is the same as `Reactive` except it ignores device events (e.g. general mouse movement). The problem is that the default "game" settings are set to `Contiuous` even when no windows are visible. ### More Context - libsdl-org/SDL#1871 - glfw/glfw#680 - godotengine/godot#19741 - godotengine/godot#64708 ## Solution Change the default "unfocused" `UpdateMode` for games to `ReactiveLowPower` just like desktop apps. This way, even when the window is occluded, the app still updates at a sensible rate or if something about the window changes. I chose 20Hz arbitrarily.
…s not visible (#7611) Fixes #5856. Fixes #8080. Fixes #9040. # Objective We need to limit the update rate of games whose windows are not visible (minimized or completely occluded). Compositors typically ignore the VSync settings of windows that aren't visible. That, combined with the lack of rendering work, results in a scenario where an app becomes completely CPU-bound and starts updating without limit. There are currently three update modes. - `Continuous` updates an app as often as possible. - `Reactive` updates when new window or device events have appeared, a timer expires, or a redraw is requested. - `ReactiveLowPower` is the same as `Reactive` except it ignores device events (e.g. general mouse movement). The problem is that the default "game" settings are set to `Contiuous` even when no windows are visible. ### More Context - libsdl-org/SDL#1871 - glfw/glfw#680 - godotengine/godot#19741 - godotengine/godot#64708 ## Solution Change the default "unfocused" `UpdateMode` for games to `ReactiveLowPower` just like desktop apps. This way, even when the window is occluded, the app still updates at a sensible rate or if something about the window changes. I chose 20Hz arbitrarily.
v3.0.2.stable.official
Windows 10
Monitor shows the fps going straight for double the normal when minimized.
Happens even when
OS.set_low_processor_usage_mode(true)
The text was updated successfully, but these errors were encountered: