Repository navigation
PyUI: stop redrawing unchanged screens and spinning in input waits - #1890
Merged
Merged
Conversation
Since frame pacing, views ask for input with a 1 ms timeout and draw a frame on every pass, so a screen nobody touches is redrawn 60 times a second, or as fast as the device manages. KeyWatcherController also ignores its timeout, so every wait with one spins a core: the screensaver's wait for a press, the Menu combination check. - KeyWatcherController.get_input() sleeps on a Condition that the reader thread notifies, until a key, a wake or the timeout, and returns as soon as a key comes. clear_input() drains without waiting. - ControllerInterface.wake() ends a wait from any thread (a notify, or an SDL user event); Controller.request_redraw() uses it, and the volume and hardware-key watchers call it. - Display compares each frame's draw calls with the previous frame's. - Controller.get_input() with the default timeout keeps today's rate while the screen changes or was used in the last 1.5 s, then waits up to a second between frames (the clock, the battery icon). - The standalone in-game listener passes a 0.1 s timeout, and the desktop device's wait:N ticks request a redraw.
This was referenced Oct 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since frame pacing (
cb3659dc8,dd7fbe1d3,287b80b5c), views ask for input with a 1 ms timeout and draw a frame on every pass, so a screen nobody touches is redrawn 60 times a second, or as fast as the device manages. KeyWatcherController also ignores its timeout, so every wait with one spins a core: the screensaver's wait for a press, the Menu combination check.Apps that change the screen from another thread can call
Controller.request_redraw(). Otherwise the change shows at the next idle frame, within a second.CPU of the process over 20 s without touching the device, on a Miyoo Mini+ (Spruce 4.5.5 nightly of 2026-10-19), from
/proc/<pid>/task/*/stat:Also checked on a Mac (DESKTOP) - the launcher's main menu went from 9.0% to 1.5% of a core.