Repository navigation
macOS: ask for a fresh capture while a resize waits for its paint - #61
Merged
Merged
Conversation
On macOS CEF paints by capturing the root frame at the size of the renderer's last activated frame. After a big resize (mid-way through an animated device switch, typically), the renderer's new-size frame activates and the capture size changes, but a page with nothing else changing gives the capturer no damage, and the capturer drops refresh requests while it still sees the content as animating. The single Invalidate at the start of the resize comes before all of that, so no paint at the new size arrived until the 1 s stall kick, sometimes two (about 4 s). cef_host now calls Invalidate every 100 ms while a resize is in flight. device_frame: 0 kicks in 5 runs (before: 1 to 12 per run, and the published c0576c5 build failed one switch after 2 kicks). Slowest switch 1.3 s, down from 1.6 to 3.7 s. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
wenkaifan0720
added a commit
that referenced
this pull request
Sep 29, 2026
The #61 comment said the capturer drops refresh requests while it sees the content as animating. A trace with gpu.capture on shows the actual sequence: the renderer's first new-size frame is captured at the old size, CEF then sets the new capture size, the capture that asks for is rate-limited, and the capturer's own retries (every ~33 ms) are all turned away by the stricter check for non-compositor refreshes (nothing pending, no recent animation) until the stall kick. Invalidate's refresh demand is treated like a compositor update and captures at once. Comment and changelog only. Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Follow-up to #59. Checking the published
c0576c5prebuilt,device_framefailed one switch of 30. The view didn't freeze (frames kept coming), but one switch took over 4 s to repaint at the new size. The ad-hoc build did it too, just less often: #59's stall fallback ("kick") fired in 1 to 12 switches per run.Cause
On macOS, CEF paints by capturing the root frame (
CefVideoConsumerOSR). The capture size is the renderer's last activated frame size, set inOnRenderFrameMetadataChangedAfterActivation. A Chromium trace of a stall shows the sequence:The capturer also drops refresh requests while it still sees the content as animating.
ApplyGeometry's singleInvalidatecomes before all of this. No paint at the new size arrives until the 1 s kick swaps in a new surface id, which creates damage. Sometimes one kick wasn't enough, and it took 1 s + 2 s.Fix
While a resize is in flight,
CheckResizeStall(run every begin frame) callsInvalidate(PET_VIEW)every 100 ms. The kick stays as the fallback. Nothing changes when no resize is in flight.Verification
device_frame:c0576c5build failed 1 of 30.hidden_at_create,surface_handoff,warm_host_paint,wedge_recovery,alert,multiview,profile_reopen: pass.a91e6834…. The prebuilt needs republishing.Windows is unchanged.
windows-buildfails the same software-compositing check on main (control run #60).🤖 Generated with Claude Code