Skip to content

GPU: hold a present with no flip wait since the last one to its flip tick (intro movie judder) - #457

Open
GamingRipperDoc wants to merge 1 commit into
fxceless:mainfrom
GamingRipperDoc:flip-pacing
Open

GamingRipperDoc wants to merge 1 commit into
fxceless:mainfrom
GamingRipperDoc:flip-pacing

Conversation

@GamingRipperDoc

Copy link
Copy Markdown

The intro movie judders through its first seconds. Root cause: the title's catch-up presents are shown at once instead of on their flip tick.

What happens

The title polls the frame origin with "token on time-out" and normally waits for the flip before each present (frame.rs's own notes). While the movie player is behind, right after playback starts, it begins a frame early and presents it without the flip wait. The console flips such a frame on the next flip tick, so the cadence stays even. VIctory hands every present to the host at once (Present(0, …)), so that frame stayed on screen ~5 ms and the frames around it twice as long.

Measured on the intro movie with per-present logging and a local check of the movie's texture buffers (the 8 MB luma + 2 × 2 MB chroma, three sets in rotation), over the same ~15 s:

before with this PR
presents 478 453
presents with a new movie frame 450 450
presents repeating the previous movie frame 28 (27 in the first 6 s) 3
presents < 20 ms after the previous one 25 0
median / max interval 33.26 / 37.9 ms 33.33 / 66.9 ms (once)

Every extra present came right after an origin poll that timed out (frame wait kind=0 timeout_ms=0 flags=2 hr=1) with no kind=2 wait before it; the next present then had no new movie frame. Background shader translation was ruled out (none during those seconds), and the texture checks are exact (hash at submission).

Change

frame::before_present(), called right before the host Present: if no flip wait has ended since the last present, it sleeps to the next flip tick and takes it (last(FLIP)), so each present still gets one tick and the next frame's flip wait lands after it. Presents after a flip wait, which is every frame in normal play, including slow world frames with this tree's early-ending waits, are not delayed. Two files, +47/−1.

A test extends waits_end_on_ticks_and_count_frames (the clock is global, so it stays in that test): a present after a flip wait takes no tick; a second present with no flip wait takes the next tick; the following flip wait lands after it. It failed before the change.

Tested

Windows 10 22H2, AMD RX 9070 XT, Ryzen 9 9900X:

No game data used.

AI-assisted (Claude Code); I watched both runs and the logs were read with the model.

…tick

The title polls the frame origin with "token on time-out" and normally
waits for the flip before each present. When its movie player falls
behind, it presents a frame begun early without that flip wait. The console
flips such a frame on the next flip tick; we presented it at once, so it
stayed on screen ~5 ms and its neighbours twice as long: the intro movie
juddered through its first seconds (27 such presents in 5 s, each followed
by a present with no new movie frame).

before_present() now holds such a present until the next flip tick and
takes that tick, so each present still gets one tick. Presents after a
flip wait (every frame in normal play, and slow world frames) are not
delayed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant