Repository navigation
Conversation
… at DM_PRESENT_HZ=120 The acquire waited for the present interval's vsyncs on the display link, counted in 60 Hz vsyncs, so a 120 Hz link (DM_PRESENT_LINK=2) waited two ticks per frame and display mode never went past 60 fps. In display mode above 60 Hz it now waits as many link ticks as one tick of the present rate takes (link_wait, mtl_link_wait_ticks, mtl_link_rate). Batman: Arkham Knight: 119.8 fps in the opening cutscene on an M2 Max. docs/reference/frame-rate.md: One frame per tick of a 120 Hz display link. Checked: make -C dm/gfx/tests run GAME=010015100B514000 passes; t_link_ticks (new) counts the waits in a 120 and a 60 Hz link's ticks
Display mode at 120 Hz previously waited two display-link ticks per frame and stayed at 60 fps. Count its acquire waits in the link's own ticks so 120 fps takes one tick. Carry fractional ticks across frames so requests such as 90 fps on a 120 Hz link wait four ticks per three frames. Keep game-interval and frame-step pacing in 60 Hz vsync units. Extend t_link_ticks through the production acquire path, add it to CPU-only CI, and document the behavior in the frame-rate reference and symptom index. Validation: 20 link-tick checks, 154 NVN integration checks, pacing and frame-step tests, Metal snapshot and display-link rescue tests, Mac host build, iOS source compilation, and documentation checks passed. Physical display gameplay and iPhone gameplay were not retested. Co-authored-by: v0lumehi <[email protected]>
|
Thanks @v0lumehi. Integrated your change and the review fix into The review confirmed an additional fractional-rate bug: requesting 90 Hz on a 120 Hz link waited one tick per acquire and therefore allowed 120 fps. The conversion now carries the fractional remainder across frames (four ticks per three frames at 90 Hz). This is shared NVN pacing code, with no game-specific conditions; game intervals and frame-step caps keep their existing 60 Hz vsync semantics. Extended Closing as integrated into |
…g_link_rate The test from seedds#324 includes nvn_mtl.m and hle_nvn.c together, so it renames nvn_mtl.m's weak nvn_var_fps as the other tests do, and sets g_link_rate beside g_link_mode, as link_range does: the wait now counts ticks from the link's rate, which also covers a variable step's cap.
…g_link_rate The test from seedds#324 includes nvn_mtl.m and hle_nvn.c together, so it renames nvn_mtl.m's weak nvn_var_fps as the other tests do, and sets g_link_rate beside g_link_mode, as link_range does: the wait now counts ticks from the link's rate, which also covers a variable step's cap.
…g_link_rate The test from seedds#324 includes nvn_mtl.m and hle_nvn.c together, so it renames nvn_mtl.m's weak nvn_var_fps as the other tests do, and sets g_link_rate beside g_link_mode, as link_range does: the wait now counts ticks from the link's rate, which also covers a variable step's cap.
…g_link_rate The test from seedds#324 includes nvn_mtl.m and hle_nvn.c together, so it renames nvn_mtl.m's weak nvn_var_fps as the other tests do, and sets g_link_rate beside g_link_mode, as link_range does: the wait now counts ticks from the link's rate, which also covers a variable step's cap.
Display mode at 120 Hz previously waited two display-link ticks per frame and stayed at 60 fps. Count its acquire waits in the link's own ticks so 120 fps takes one tick. Carry fractional ticks across frames so requests such as 90 fps on a 120 Hz link wait four ticks per three frames. Keep game-interval and frame-step pacing in 60 Hz vsync units. Extend t_link_ticks through the production acquire path, add it to CPU-only CI, and document the behavior in the frame-rate reference and symptom index. Validation: 20 link-tick checks, 154 NVN integration checks, pacing and frame-step tests, Metal snapshot and display-link rescue tests, Mac host build, iOS source compilation, and documentation checks passed. Physical display gameplay and iPhone gameplay were not retested. Co-authored-by: v0lumehi <[email protected]>
… frame), DM_WINDOW_SIZE=WxH overrides The Mac front end hardcodes a 1280x720-point window. On a Retina display the backing store is 2x points, so 1080p points is a 3840x2160 backing that still leaves the game's own dynamic resolution untouched; the frame-step controller calibrated at 720p keeps its meanings at 1080p. Measured on M3 Pro with Tears of the Kingdom and five other titles, 1080p costs ~1 ms/frame over 720p and all six hold a locked 60 fps (p50 16.6-16.7 ms). The size is clamped to the largest 16:9 rect that fits the visible frame, so smaller MacBooks get a fitting window instead of an off-screen one, and DM_WINDOW_SIZE=WxH (points) overrides both. Keep the window below 1440p points: at >=1440p the game's own vsync acquisition starts failing on Metal (seedds#324), which is what the focus-notify switch works around. The chosen size is logged once at startup so support reports can see it. (cherry picked from commit bc7edc4) nxnative-ultimate: the window stays 1280x720 points by default (main's size); the PR made 1920x1080 (shrunk to fit) the default. DM_WINDOW_SIZE=WxH sets another.
present_interval display above 60 Hz: one display-link tick per frame
Symptom. With
present_interval display,DM_PRESENT_HZ=120and a 120 Hz display link (DM_PRESENT_LINK=2), a game stays at 60 fps although its frame takes 8 ms, and the display link logs about two ticks per present.Cause. The acquire waits on the display link for the present interval's vsyncs (
mtl_link_wait_tick), counted in 60 Hz vsyncs. On a 120 Hz link that is two ticks per frame, even though display mode's interval is 1.Fix. In display mode above 60 Hz, the acquire waits for as many link ticks as one tick of the present rate takes, which is one at 120 Hz.
link_waitinhle_nvn.cmakes that choice.mtl_link_wait_tickscounts in the link's own ticks;mtl_link_wait_ticknow goes through it.mtl_link_ratereports 120, 60 or 30 Hz.Every other case waits as before. The reference entry is in
docs/reference/frame-rate.md("One frame per tick of a 120 Hz display link"), and the symptom index is regenerated.Measured
Batman: Arkham Knight 1.0.5 (Unreal Engine 3,
present_interval display,DM_PRESENT_HZ=120 DM_PRESENT_LINK=2, its frame-rate cap at 120): 119.8 fps in the opening cutscene on an M2 Max, at 60 fps before. The game's speed matched real time. Arkham Knight's profile and note come in a PR of their own.Checked
t_link_ticks(new, in the gfx run list, 8 checks). A host thread stands in for the display link's callback:mtl_link_ratereports 120, 60 and 30.It does not reach
link_wait's choice inhle_nvn.citself.make -C dm/gfx/tests GAME=010015100B514000 run.ci.sh(host tests, CPU gfx tests, every gfx test built,dmhostfor three profiles, the iOS compile check, all tool tests): no failures.dmhostfor Breath of the Wild and Arkham Knight, the iOS compile check,test_docs.