Render a synchronized-output frame on close, not on the next debounce - #6073
Open
s-celles wants to merge 2 commits into
Open
Render a synchronized-output frame on close, not on the next debounce#6073s-celles wants to merge 2 commits into
s-celles wants to merge 2 commits into
Conversation
…e next debounce When DEC private mode 2026 (synchronized output) closes, the input handler requests a refresh. RenderService flushes the buffered rows but schedules the paint through the render debouncer (requestAnimationFrame). Under a continuous full-screen animation the next frame opens a new 2026 block before that rAF fires, and `_renderRows` skips while synchronized output is on — so the debounced paint is dropped and the frame only appears when the 1000ms synchronized-output timeout expires. The display is then capped at ~1fps however fast frames arrive and however idle the renderer is. Render synchronously when a synchronized-output buffer was just flushed (`buffered` is truthy). At that point the mode is already off — the flush runs from the mode reset that turned it off — so the completed frame paints before the next frame can reopen the mode. Measured against a 30fps animated-background TUI: renders went from ~1/s to the frame arrival rate, with no partial-frame tearing. Assisted by AI.
16 tasks
Member
|
Hmm to be honest - I don't like the idea to introduce synchronous rendering. I think a better solution would be to introduce double buffering, where DECRST 2026 triggers a viewport buffer copy to be shown on next @Tyriar Your thoughts on this? |
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.
Fixes #6071.
Problem
Under a continuous full-screen animation that wraps every frame in a DEC
private mode 2026 (synchronized output) block, the display is capped at ~1 fps
however fast frames arrive and however idle the renderer is — completed frames
only paint when the 1000 ms synchronized-output timeout expires.
When a 2026 block closes, the input handler requests a refresh.
RenderService.refreshRowsflushes the buffered rows but schedules the paintthrough the render debouncer (
requestAnimationFrame). Under a continuousanimation the next frame opens a new 2026 block before that rAF fires, and
_renderRowsskips while synchronized output is on — so the debounced paint isdropped and the frame only appears on the sync timeout.
Fix
Render synchronously when a synchronized-output buffer was just flushed
(
bufferedis truthy). At that pointsyncis alreadyfalse— the flushruns from the mode-reset that turned sync off — so the completed frame paints
before the next frame can reopen the mode. No partial-frame tearing, since the
frame is complete by construction.
Testing
Measured against a 30 fps animated-background TUI (TryIt.jl): renders went from
~1/s to the frame-arrival rate, with no tearing.
Assisted-by: AI