Repository navigation
Breath of the Wild: the encode thread on by default on the Mac, for higher lows while the world streams in - #2282
Open
dontpokethebear3893 wants to merge 4 commits into
Conversation
…c_thread on): running laps outdoors at 120 fps (M5 Max), it took 10,000 frames from 106.4 to 112.0 fps average, the 1% low from 52.6 to 58.2 and the 0.1% low from 43.6 to 55.3 fps, and the slowest frame from 30.6 to 19.1 ms (submit+present p50 4.49 -> 3.77 ms); standing still both hold about 120. The launcher's Mac default follows the profile (test_launcher_settings), and check_t_feedback pins DM_NVN_ENC_THREAD=0 for its direct-encoder segment cases Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4 of 5 tasks
…closed PRs Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Brings the branch up to date with main (fixes for the t_save_sync cloud device check and the clang-tidy fixture findings, among others) and resolves the conflicts with it. Co-Authored-By: Claude Opus 5.5 <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.
What and why
On the Mac, the app turns the game's graphics commands into Metal commands on the game's own submitting thread. The encode thread (
DM_NVN_ENC_THREAD, the launcher's Encode thread) moves that work to a thread of its own. It is on by default on the iPhone and off on the Mac, because there it "lowered the typical frame time but made the slowest frames slower" (docs/settings.md).In Breath of the Wild, whose submit and present take about 4.5 ms a frame on that thread, the encode thread does better on both counts once Link moves. While the world streams in, the submitting thread is the limit, and taking the encoding off it raised the average, the 1% low and the 0.1% low, and cut the slowest frame from 30.6 to 19.1 ms.
The change:
game.tsv:enc_thread on, so the Mac defaults to the encode thread for this game (nvn_rec.hrec_onreads the profile).DM_NVN_ENC_THREAD=0and the launcher's setting still turn it off.docs/settings.mdsays which games turn it on on the Mac.test_launcher_settings.pynow expects the Mac default to follow the profile (on for this game, off for Wonder).check_t_feedbacksetsDM_NVN_ENC_THREAD=0: its segment cases test the direct encoder, and with the profile's encode thread on there is no timestamp heap.Conflict with #2286 (segment commits): both edit the
check_t_feedbackline ofdm/gfx/tests/Makefile. Whichever goes in second needs the two edits combined:DM_NVN_CUT_BUSY=1 DM_NVN_ENC_THREAD=0 … ./t_feedback; DM_NVN_CUT_BUSY=0 DM_NVN_ENC_THREAD=0 … ./t_feedback.Checked
Measurements before and after: Breath of the Wild 1.9.0 (01007EF00011E000), fullscreen at 120 fps with variable refresh, from a save outdoors on the Great Plateau. Link runs laps over grass and ruins (
DM_KEYS: B off a wall,LUpfor 500 frames, thenLRightheld). Times are per frame fromDM_NVN_TSV, over frames 10,000 to 20,000 (exactly 10,000 frames) of one run each:The 1% and 0.1% lows are the frame rate over the slowest 1% and 0.1% of frames.
Standing still in the same place (four runs, alternating, 125 s each), both settings hold about 120 fps (118.9–119.5 average). There the encode thread's 1% low was lower, 60–63 against 76–79 fps, with the 0.1% lows within a few fps of each other (52.8–55.8). This is the case
docs/settings.mddescribes. The idle frame rate is the same either way.Tests:
make -C dm/host/tests GAME=01007EF00011E000 runpasses.make -k -C dm/gfx/tests GAME=01007EF00011E000 runpasses exceptcheck_t_dlss_scaler("nothing else keeps them alive"), which fails the same way onmain(01de04f);check_t_feedbackpasses (278 checks). Indm/tools/tests,test_launcher_settingspasses;test_dmsh_pool_arraysfails the same way onmain(KeyError: 'cbufs').Devices and OS: Apple M5 Max, macOS 27.2.1, Studio Display XDR at 120 Hz.
Not checked: the running comparison at 60 fps on
mainalone, and other Macs.After the rebase on
main(6a6a018):make -C dm/host/tests GAME=01007EF00011E000 run,check_t_feedbackandcheck_t_reorder_chain(dm/gfx/tests) pass.dm/tools/testspasses:test_docs,test_patches,test_game_profile,test_env_switches,test_launcher_settings,test_settings,test_nsp_mac_app,test_fps_target,test_player_env,test_lint_candtest_gfx_tests_makefile.dm/ios/teststest_launcher_storagepasses.lint_python.py --against origin/mainreports one new finding,dm/gfx/tools/dmsh_entry.py:7(F401, an unused import).mainitself reports the same one, and this change does not touch that file.Docs
dm/games/01007EF00011E000/README.md, CPU) anddocs/settings.md(Encode thread), andpython3 dm/tools/docs_symptoms.pywas run🤖 Generated with Claude Code