Rebase pending flips when the frame interval changes #1992
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!1992
Loading…
Reference in a new issue
No description provided.
Delete branch "lgr123/frame-interval-pending-vblank"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Pull request successfully merged and closed
Claimed as RT-FRAME-INTERVAL-PENDING-VBLANK.
In a native fake-clock reproduction, changing from 30 to 60 FPS with one old frame still queued placed the next flip at 83,333 µs. The new vblanks were at 56,667, 73,334 and 90,001 µs. The no-pending control displayed at 73,334 µs. Both cases now display at 73,334 µs.
At the interval change, retire flips whose original time already passed, then assign the remaining flips consecutive slots on the rebased grid in FIFO order. The regression asserts that the first retired timestamp is preserved, two pending frames keep their order, and a new frame gets the next slot. This changes rate transitions. The separate mailbox-overflow behavior in #671 is outside the patch. I ran the same reproduction on that branch and it still produced 83,333 µs.
Tested
frame_pacer_test. The new test fails with the unchanged header and the full suite passes with the patch.fd33a31, whose pacing and test files are identical to the measuredfe15534base.git diff --checkand the source-only policy check passed.GPUs tested: n/a.
AI-assisted: yes.
Checklist
Independent review follow-up
The independent review on an RTX 4060 confirmed the changed-period regression and found that reapplying the same 16,000 µs period moved a frame from 32,000 to 40,000 µs. The follow-up keeps existing flip deadlines on a repeated period while preserving the event epoch update. The new manual-clock check observes the frame at 32,000 µs and the next origin at 40,000 µs. The previous PR head failed the new frame assertion. The native frame-pacer suite passed three runs with the follow-up.
Independent review
Verified on Windows 11 (
10.0.26200.9974) with MSVC19.44.35228(x64,/std:c++20 /EHsc /W4 /permissive- /utf-8 /O2) againstmaind48a957bb+61c3421875(claim#2570#issuecomment-7239583640):runtime/src/frame_pacer.h,runtime/test/frame_pacer_test.cpp); retires already-displayed frames atnowand assigns remaining queued frames consecutive vblank deadlines on the new grid wheneverFramePacer::set_frame_intervalchangesperiod_us, while keeping queued display deadlines intact when reapplying the same period.check_no_game_data.pyclean.d48a957bb+ PR test):frame_pacer_test.exefails (rc=1,line 346: displayed_at(second) == new_epoch + new_period).d48a957bb+61c3421875merge): Auto-merges cleanly (rc=0), compiles with0warnings under/W4 /permissive-, and passes (frame_pacer_test: all cases pass,rc=0).AI-assisted.
Red/green: On main frame_pacer_test fails at line 451 (pending flips are not rebased when the frame interval changes), and with the PR ctest -R "^frame_pacer$" passes.
Independent tester (OreoFR, RTX 4070, Windows 11): PR head merged with the other PRs of its batch on main c1ecf04ed, full ctest run (485 tests, tests that launch the game excluded): no new failure compared with main.
Verified by OreoFR
c1ecf04ed+ PR head61c342187; green run in a merge package of 16 PRs, no new ctest failure vs mainctest -R ^frame_pacer$AI-assisted (Claude Code, Claude Opus 5.5).