Repository navigation
Conversation
When the frame-step cap drops to 30 and comes back (Tears of the Kingdom's prerendered movies, the iOS thermal cap from seedds#220), nvn_fstep_next put the hold back to 1 with no grace while the clocks were still set for 30 fps, so three late frames stepped it up again. After a movie, the cap change had dropped the cost that held hold 1 (cref), so the same-cost probe could not fire. After the thermal cap, the GPU reference had been learned during the cap, at the clock it left, so the same work at hold 2 did not look slowed. A GPU-bound game whose cost sits near the fit line at either hold then stays at 30. Keep cref and the GPU reference for each kmin, and treat the frames after the cap rises as a probe with the usual 30 frames of grace. This undoes b53bb89's reset of cref on a cap change; a kept cref still only starts a probe when the cost at hold 2 is within FSTEP_SAME of it, and failed probes back off as before. Add a frame-rate reference entry and regenerate the symptom index. I first ran into this with a 30 fps mode in a downstream fork. The new t_fstep cases model main's own paths instead, using the movie flag and the BotW iPhone GPU times already quoted in nvn_fstep.h. Validated: t_fstep 56/56; built against main's nvn_fstep.h, the four movie and thermal cap checks fail. Host tests, the TSan targets, the thermal checks, the CPU-only gfx tests, every gfx test compiled, dmhost for Wonder, Hades, Digimon, BotW and TOTK, the iOS compile check (133 files), and the docs tests pass. Not validated: no game was run on a Mac or an iPhone, so the clock behaviour after a cap is modelled, not measured; 18 tool tests that import capstone could not run here. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
seedds
added a commit
that referenced
this pull request
Oct 26, 2026
Keep the proven frame cost and GPU reference for each cap, and probe the shorter hold when a movie or thermal cap ends. Otherwise a GPU-bound game can fall straight back to 30 fps without a usable recovery reference. Save an uninterrupted sustained run when a cap begins, even if no earlier hitch populated cref. Keep the earlier reference through short runs and update it after another sustained run. Count cap-release probes and give them all 30 grace frames: the completed frame at the old cap consumes none. Add movie and thermal recovery regressions, including first movies, repeated caps, full grace and failed-probe backoff. Document the mechanism and link it from both Zelda game notes. Validated: 64/64 frame-step checks, including ASan/UBSan; six checks fail against the original PR. Production thermal tests and ThreadSanitizer, docs tests and diff checks pass; the BotW Mac host builds. Device clock recovery remains modelled, without a new gameplay observation. Co-authored-by: RAHUL REX <75500427+RahulRex0@users.noreply.github.com>
Owner
|
Thanks @RahulRex0. Confirmed the recovery failures and incorporated your changes into main in 4acde72, with you credited as co-author. The per-cap cost/GPU references and cap-release probe are retained. Review also found and fixed two remaining cases:
The expanded frame-step suite passes 64/64 checks; six checks fail against the original PR head. ASan/UBSan, the production thermal tests and ThreadSanitizer, docs tests and diff checks pass, and the BotW Mac host builds. The device clock behavior is still modelled; no new iPhone recovery observation is claimed. Closing this PR because the changes, corrections and regression coverage are now on main. |
Know-It-All-Brother
pushed a commit
to Know-It-All-Brother/nxnative
that referenced
this pull request
Nov 9, 2026
Keep the proven frame cost and GPU reference for each cap, and probe the shorter hold when a movie or thermal cap ends. Otherwise a GPU-bound game can fall straight back to 30 fps without a usable recovery reference. Save an uninterrupted sustained run when a cap begins, even if no earlier hitch populated cref. Keep the earlier reference through short runs and update it after another sustained run. Count cap-release probes and give them all 30 grace frames: the completed frame at the old cap consumes none. Add movie and thermal recovery regressions, including first movies, repeated caps, full grace and failed-probe backoff. Document the mechanism and link it from both Zelda game notes. Validated: 64/64 frame-step checks, including ASan/UBSan; six checks fail against the original PR. Production thermal tests and ThreadSanitizer, docs tests and diff checks pass; the BotW Mac host builds. Device clock recovery remains modelled, without a new gameplay observation. Co-authored-by: RAHUL REX <75500427+RahulRex0@users.noreply.github.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.
The frame step can get stuck at 30 fps after a 30 fps cap ends. Main has two caps that fall and then rise: Tears of the Kingdom's prerendered movies (the +4 movie flag) and the iOS thermal cap from #220. #220 notes that the way back to 60 hasn't been observed yet.
In both cases, when the cap rose,
nvn_fstep_nextset the hold back to 1 with no grace while the clocks were still set for 30 fps, so three late frames stepped it straight back up. What kept it at 30 after that differs per cap:cref(the cost that held hold 1), so the same-cost probe couldn't fire.nvn_fgpu's reference had been learned during the cap, at the clock the cap left, so the same work at hold 2 didn't look slowed.A GPU-bound game whose cost sits near
FSTEP_FITat either hold never triggers the fit trial either, so it stays at 30.This change keeps
crefand the GPU reference per kmin, and it treats the frames after the cap rises as a probe with the usual 30 frames of grace. There's no change tohle_nvn.c.Keeping
crefundoes a choice from b53bb89, which reset it on every cap change (its check "movie flag (kmin 2): the cost that held kmin 1 is dropped" becomes "is set aside"). I think keeping it is safe for the scene after a movie: a keptcrefonly starts a probe when the cost at hold 2 is withinFSTEP_SAME(1.1x) of it, and failed probes back off from 1 s to 8 s like any other probe. The tradeoff is on a device that really can't hold 60 after the cap. The end of the cap now allows up to 30 late frames of grace instead of 3, and if it steps up again soon after, that counts as a failed probe and the hold-off doubles.I first ran into this with a 30 fps mode in a downstream fork, which main doesn't have. The new t_fstep cases model main's own paths instead, using the movie flag and the BotW iPhone GPU times already quoted in
nvn_fstep.h(14.4 ms at hold 1, about 25 ms at hold 2). Built against main'snvn_fstep.h:With the fix all 56 pass, and main's original 51 checks still pass. I also took the parts out one at a time. Without the per-kmin
cref, both movie checks fail. Without the per-kmin GPU reference, "the clock takes 1 s" fails and the game stays at 30. Without the cap-rise probe, the thermal case still ends at hold 1, but it dips to 30 once right after the cap. So the first two parts are what get it back to 60, and the probe saves that short dip.Docs: a new entry in
docs/reference/frame-rate.md("The frame step after a 30 fps cap ends"), and I regenerated the symptom index.Checked
check_t_thermal thermal-tsan, and the CPU-only gfx tests from tests.yml all pass, and every gfx test compiles.🤖 Generated with Claude Code