Skip to content

present: stop repeated writes for unsupported display-link latency - #697

Closed
thehobbit85 wants to merge 1 commit into
seedds:mainfrom
thehobbit85:codex/fix-display-link-latency
Closed

thehobbit85 wants to merge 1 commit into
seedds:mainfrom
thehobbit85:codex/fix-display-link-latency

Conversation

@thehobbit85

@thehobbit85 thehobbit85 commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

An oversized positive DM_PRESENT_LATENCY request makes link_sync compare CAMetalDisplayLink's bounded readback with an unsupported value, repeatedly writing and logging every frame. Normalize the request to the supported maximum of 2 before creation and comparison. Valid overrides 1/2 and main's automatic policy—2 in variable-refresh fullscreen, 1 otherwise—remain intact.

Addresses #603, finding 2. The separate ProMotion late-present and fixed-rate display-link delay findings remain open.

Current integration and validation

Rebased onto pinned main c1df4ddaaedc3c18228065ea5b909688b79884e2; head e698f325f004290576a6d96a9ab8770cda480654. The same existing PR remote branch and its canonical local tracking branch are retained. All paginated issue comments, reviews and inline feedback were read; no new feedback was found.

The independently reviewed override normalization, automatic variable-refresh policy and repeated-write regression cases are unchanged. Main's compact NVN command records do not replace the explicit-override bound.

  • Fresh: 11 documentation tests and the environment-switch index test passed.
  • Historical: t_present_rescue --metal passed 80 checks with MTL_DEBUG_LAYER=1 at 1d882a01, including oversized 3/INT_MAX requests across both screen types and window/fullscreen states. Its presentation-policy/fixture sources are unchanged; the run predates the newer NVN command-record changes and is not a final-head native run. That build reported 52 existing graphics protocol warnings.

Range-diff marks the feature patch unchanged, and the old-to-new tree delta exactly matches the upstream increment. Ancestry and git diff --check pass. The previous d138-based head 3e18f0c3548da726ec24fa8fed85f7a25ff15c32 completed all 7 CI checks successfully; that is historical evidence. CI for this new head is pending. Central shared validation passed on 4820ba509adb90ee7cca8c5a65a51e0a4dc12e74 with GAME=010015100B514000: t_fs (102 checks), t_fs_case (51), t_fs_commit_list (98), t_nfc (54), t_pad_hid (19), and t_system_event. Their production/fixture sources, host headers, profile inputs, build flags and target recipes were verified identical to this head. This is shared fixture coverage, not a full host build or full graphics run of this PR.

Local native tools are Xcode 27.0/Metal 32023.921; supported Xcode 27.2/Metal 32023.922 verification belongs to the new CI run. No gameplay, physical-display timing or interactive HUD check, extraction rebuild, device installation, game shader rebuild, or fresh game shader/interface comparison was performed. Earlier full-suite/game evidence remains historical at its recorded revisions.

@thehobbit85
thehobbit85 force-pushed the codex/fix-display-link-latency branch 14 times, most recently from 1d882a0 to 3e18f0c Compare November 1, 2026 04:14
@thehobbit85
thehobbit85 force-pushed the codex/fix-display-link-latency branch from 3e18f0c to e698f32 Compare November 1, 2026 06:22
seedds added a commit that referenced this pull request Nov 1, 2026
CAMetalDisplayLink takes a preferred frame latency of 1 or 2 and reads
back 2 after a larger request. link_sync compared that readback with
the unbounded override, so DM_PRESENT_LATENCY=3 set the property again
and logged "display link: frame latency" on every frame. link_latency
now bounds a positive override to 2, so the requested, compared and
logged values agree. The automatic window/fullscreen policy is
unchanged. t_present_rescue's stand-in link reads back at most 2 and
counts writes across frames (80 checks pass with the Metal debug layer).

Issue #603, finding 2.

Co-authored-by: Eliran Zach <4012041+thehobbit85@users.noreply.github.com>
@seedds

seedds commented Nov 1, 2026

Copy link
Copy Markdown
Owner

Landed as f4bfc01, with you as co-author. The link_latency bound, the t_present_rescue additions, the env_switches.tsv line and the sentence in the existing frame-rate.md entry are in as you wrote them; t_present_rescue --metal passes 80 checks with the debug layer here. I left out the new frame-rate.md section and its symptoms.md line: the symptom only appears when a debug switch is set outside its documented range, which now says 1 or 2. #603 stays open for its other findings. Thanks!

@seedds seedds closed this Nov 1, 2026
@thehobbit85
thehobbit85 deleted the codex/fix-display-link-latency branch November 1, 2026 09:41
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.

2 participants