-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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
Fix burning CPU with udev disabled on Flatpak #69563
Conversation
I can confirm that after applying this patch an udev-free build doesn't burn a whole core anymore, great work! |
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.
The fix makes sense to me.
Would be great if someone could test and confirm that controller detection/hotplugging works fine (I don't see why it wouldn't but who knows).
Initial controllers, controller hotplugging and unplugging still work with this PR when building with Regardless of whether I'm using @lawnjelly Do we have any tools to check what causes continuous redrawing in a project, or even a way to check that continuous redrawing is indeed occurring in a project that has low processor mode enabled but no visible animation? (We can't display an animation to check for this, as it'll cause continuous redrawing in itself.) |
Note that this demo disables VSync. No idea why. (As a side note, it also has a pointless On my system, a nearly empty Godot project seems to use 15-20% CPU (debug build of the editor), both with or without this PR, with or without udev. That's high but likely unrelated to this issue, to be investigated separately Edit: This 15% CPU usage seems to come from two threads:
The joypads demo seems to use a lot more CPU indeed but that seems to be specific to that demo's |
@akien-mga weird, on my machine (which doesn't have udev at all btw) I can see a considerable improvement even just on the project manager. Without this PR I can see a (process) thread with 100% CPU, while applying it removes said thread completely from the equation. My laptop's also considerably quieter and the average CPU usage is lower. |
I'm not so familiar with master, but looking at |
In that demo it might be due to constant text redrawing due to calling |
Thanks! And congrats for your first merged Godot contribution 🎉 |
I disabled V-Sync in the demo to reduce input lag, as low-processor mode takes care of limiting framerate to a reasonable value if something is causing continuous redrawing. It's not very important in the demo, but UI-only apps that don't feature scrolling generally don't benefit from V-Sync in any way. #66367 would do a better job at limiting FPS to a power-efficient value when V-Sync is disabled, but the default effective FPS cap of 145 isn't too bad otherwise (as it helps bring down latency noticeably on 60 Hz displays compared to a 60 FPS cap without V-Sync). |
Cherry-picked for 3.6 |
Fixes #67355.
Should be cherry-picked to 3.5.
Note that I haven't tested this fix locally. I'd be happy if someone were to make a no-udev or Flatpak build of 3.5 or master, then test on their machine, and/or publish a Flatpak package (perhaps https://docs.flatpak.org/en/latest/single-file-bundles.html?) so I can test CPU burning (unsure about controllers) my side.