-
-
Notifications
You must be signed in to change notification settings - Fork 21.8k
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
Allow disabling low-processor mode on headless platforms #47138
base: master
Are you sure you want to change the base?
Conversation
You have some changes that I already checked in in |
This can be used when you want processing to happen as fast as possible (at the cost of high CPU usage). This is generally not what you want for a dedicated game server, so low processor-mode is still enabled by default on headless platforms. - Enable low-processor mode by default on headless platforms (mimics the previous behavior). - Use a 60 FPS limit on headless mode by default (down from 144 FPS). This can be overridden by changing the Server override for `application/run/low_processor_mode_sleep_usec`. This allows effectively changing the server's `_process()` tick rate, balancing CPU usage and network bandwidth usage with latency.
b130088
to
ab3df16
Compare
Fixed. Also, in the |
@@ -2555,7 +2561,7 @@ bool Main::iteration() { | |||
return exit; | |||
} | |||
|
|||
OS::get_singleton()->add_frame_delay(DisplayServer::get_singleton()->window_can_draw()); | |||
OS::get_singleton()->add_frame_delay(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
window_can_draw
depends on the OS/DisplayServer, e.g. window is minimized.
So, frame delay won't be applied when window is minimized, resulting, I think, in much higher CPU usage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I thought it returned a constant based on the platform.
Do you know if there's a way to make this configurable for the server platform without impacting the behavior on minimized windows?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, more then one, I'm just not sure what's the best approach.
- OS implementations could change
is_in_low_processor_usage_mode
when minimized instead, but that might have side effects on some platforms - Otherwise
get_low_processor_usage_mode_sleep_usec
could be adjusted when the display is headless.
In general, I don't like the fact that low_process_mode_sleep_usec
is abused this way, but it's hard to reconcile the need of different platforms (different window/app lifecycle), display servers (vsync/headless), and the extra constrain of "adding more delay"
Lines 364 to 370 in 07f076f
It seems to be case-sensitive, the pen driver override should be changed to |
I've been wondering, would it make sense to have the Normally, the engine is expected to run at a fixed iteration per second. This is usually handled by But what we really want to do in that case, is trying to keep the FPS constant, so if we are not in When vsync is unknown (headless) or disabled, either I'm also unsure if we should keep Thoughts? ( @reduz ) |
@Faless See also godotengine/godot-proposals#2001, where I suggested capping the FPS to 20 in unfocused and minimized windows by default (adjustable with project settings). |
Actually, on e.g. Windows FPS are indeed capped to 144 FPS like the server platform in the original issue. Exactly as a side effect of |
So, maybe with hindsight from your proposal, we could change |
@Faless Sounds good to me 🙂 However, I want to stress that even with low-processor mode enabled, the default FPS limit is quite high. Being able to use a lower FPS limit selectively can help a lot with decreasing power consumption. This is why I suggested having separate project settings for each state (focused, unfocused, minimized). Right now (without relying on scripts), you can decrease the low processor mode FPS limit globally, but then it becomes too low when you're actually using the application. |
Why this is not something you generally want? |
Simulating
No, you should still keep low-processor mode enabled in this case, as movement updates should happen in |
This can be used when you want processing to happen as fast as possible (at the cost of high CPU usage). This is generally not what you want for a dedicated game server, so low processor-mode is still enabled by default on headless platforms.
application/run/low_processor_mode_sleep_usec
. This allows effectively changing the server's_process()
tick rate, balancing CPU usage and network bandwidth usage with latency.This closes #32404.
Question: Can someone check if feature tags are actually case-sensitive? The documentation claims they are, but I noticed the Windows pen driver code uses
.windows
instead of.Windows
to override the default setting. cc @bruvzg