Skip to content

drm/apple: t6030: swap timing words for 120 Hz - #1969

Merged
RyanTheTide merged 3 commits into
aurora-silicon:mainfrom
knalekar:drm-apple-t6030-120hz
Dec 1, 2026
Merged

RyanTheTide merged 3 commits into
aurora-silicon:mainfrom
knalekar:drm-apple-t6030-120hz

Conversation

@knalekar

@knalekar knalekar commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

What: The 14.x firmware on the T6030 ProMotion panel completes swaps every second refresh: the presentation timing words in the swap record are zero, so the panel scans out at 120 Hz but compositors pace everything at 60 fps. Set the existing per-board .swap_timestamps flag on dcp_v14_board_t6030; dcp_v14_swap_timestamps() then stamps the three words, and the firmware presents each swap at the next refresh.

The early internal-panel flip from the earlier revision is dropped after review. It reported flip completion before dcp_v14_present() submitted the swap, which lets a double-buffered direct-scanout client reuse a framebuffer while firmware is still scanning it, and a failed present cannot retract the event. Flip completion is back after a successful present, as on the existing path.

Tested: No runtime row at 9181db40 yet. The earlier j514s (M3 Pro) run was on the timestamp + early-flip combination, not this head.

Risk: Two-way · T6030 (M3 Pro/Max) internal panel. A plain revert undoes it.

Not yet: A timestamp-only 120 Hz row at 9181db40 on j514s, with compositor pacing and a direct-scanout check.

Details
  • dcp_v14_board_t6030 now sets .swap_timestamps = true, so dcp_v14_board_stamps_swaps() selects it. Both module parameters and the board special-case check from the first revision are gone.
  • v14-board-test.c expects the T6030 to stamp its swaps.
  • The early flip was the only part that changed the flip-completion point. Removing it leaves the existing path: dcp_v14_present() completes first, then dcp_drm_crtc_page_flip() reports the flip and the displaced framebuffers are released.
  • The branch was not force-pushed because it carries the maintainer's forward-merge commit. The early-flip hunk remains in the earlier commit and is removed by 9181db40; the final diff against main is the timestamp change only.
  • If the early-completion idea is pursued later, it needs a separate PR with a completion point tied to a successful present or an explicit safe release, not a signal before submission.

Companion PR for the 14.7 panel colour fix: #1970

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks for chasing the 60 fps pacing on the T6030 ProMotion panel. That's a real improvement.

Two things don't fit how we usually do this. Both behaviours sit behind new module parameters that default to off (drivers/gpu/drm/apple/iomfb_v14_7.c:117-120 t6030_swap_timestamps, :128-131 t6030_early_flip), so users would have to set a boot option to get 120 Hz. They are also chosen by comparing against one board pointer (:2871, :3394).

The driver already has per-board panel data for this: dcp_v14_board_stamps_swaps() reads board->swap_timestamps. Could you set .swap_timestamps = true in dcp_v14_board_t6030 and drop both parameters? For the early flip, if it is safe with the swapchain argument in the comment, it could be the default for every v14 internal panel. If it isn't, a comment explaining what the T6030 has that the others lack would help.

We can run pacing rows on our M1 Pro, M2, M4 Pro and A18 Pro if the early flip becomes the default.

@knalekar
knalekar force-pushed the drm-apple-t6030-120hz branch from 4cf4a44 to 0136657 Compare November 19, 2026 16:05
@knalekar

knalekar commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks — reworked along those lines.

  • dcp_v14_board_t6030 now sets .swap_timestamps = true, so dcp_v14_board_stamps_swaps() picks it up, and both module parameters (and the special-case board check) are gone.
  • The early flip is now the default for every internal 14.x panel; external processors keep the existing path. The comment there explains why the next commit cannot overtake the swap (v14->lock and the CRTC commit dependencies) and that displaced framebuffers stay pinned until the swap completes.
  • I also fixed the early path to release the retained framebuffers after a successful swap (it previously returned without doing so) and to cancel the event if the swap fails.
  • v14-board-test.c now expects the T6030 to stamp its swaps.

Only j514s (M3 Pro) has been tested: still ~120 fps with no faults. The KUnit change is compile-checked only (my build config has KUNIT off). Since the early flip is now the default on all internal v14 panels, your offered pacing rows on M1 Pro, M2, M4 Pro and A18 Pro would be very welcome.

Update: the early flip described above was dropped after review at 9181db40. The PR now keeps only the T6030 swap timestamp fix; flip completion is back after a successful dcp_v14_present().

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks for the rework: .swap_timestamps in the T6030 record and no module parameters is what we hoped for, and the comment on the early flip explains why it is safe. Since the early flip is now the default for every internal v14 panel, we will run pacing rows on our lab Macs; no CI has run on 0136657 yet, so a run would help too.

@RyanTheTide

Copy link
Copy Markdown
Contributor

On 110861f, the T6030 record still has no swap_timestamps and iomfb_v14_7.c is unchanged since this branch's base. The commit applies cleanly on 110861f. #2805 (draft) also stamps the T6030 swaps: it derives stamping from the record's promotion bit and drops the swap_timestamps field. If #2805 lands first, this PR reduces to the early-flip hunk and its test edits need rebasing. Because the early flip is now the default for every internal 14.x panel, it still needs pacing rows on more than the J514s and a CI run on 0136657.

Build check of 110861f plus this change (arm64, LLVM=1, Image, dtbs and every directory it touches, Fedora config plus asahi.config): builds, no warnings in the files it touches. Host tests (tools/asahi/run-host-tests.py --only) on 110861f plus this change: apple-dcp passes (1/1).

@DjDeveloperr DjDeveloperr left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formal §1–§6 pre-PR review on live head 0136657c82677ac7c698efa73cc38dde3767a3f3 (against live integration/aurora 70a00e583b03, not superseded; live CI host-tests green).

Blockers

  1. Correctness / DRM flip-completion & error-handling bugs in iomfb_v14_7_flush() (drivers/gpu/drm/apple/iomfb_v14_7.c:3366-3385):
    • Broken failure path (dcp_v14_cancel_event is dead code): Line 3369 calls dcp_drm_crtc_page_flip(dcp, ktime_get()) before dcp_v14_present(). dcp_drm_crtc_page_flip() (dcp.c:942-949) immediately delivers DRM_EVENT_FLIP_COMPLETE and sets crtc->event = NULL. If dcp_v14_present() then fails (returns false), dcp_v14_cancel_event(dcp) finds crtc->event == NULL and does nothing — userspace has already received a bogus successful flip completion and signaled out-fence for a failed swap.
    • Premature buffer reuse / tearing & fabricated flip timestamp: Delivering DRM_EVENT_FLIP_COMPLETE before dcp_v14_present() even acquires v14->lock or submits the swap tells userspace that the previous front buffer is no longer being scanned out while IOMFB is still scanning it. Although dcp->swapped_out_fbs delays kernel drm_framebuffer_put(), it does not stop a 2-buffer client or direct-scanout compositor from immediately overwriting that buffer's pixel memory mid-scanout (producing tearing/corruption). In addition, calling dcp_drm_crtc_page_flip(dcp, ktime_get()) immediately after dcp->swap_start = ktime_get() reports a pre-swap timestamp (delta ≈ 0 µs) rather than presentation completion, skewing compositor frame pacing across every internal 14.x panel — including 60 Hz panels (J613, J615, J514C).
    • Note: Setting .swap_timestamps = true on dcp_v14_board_t6030 (and updating v14-board-test.c) is clean and aligns with dcp_v14_board_j516c (and draft #2805). The early-flip path needs to be either dropped/split out or replaced with real asynchronous swap completion rather than signaling FLIP_COMPLETE ahead of dcp_v14_present().
  2. §4 Attribution (hard blocker): Commit 0136657c82677ac7c698efa73cc38dde3767a3f3 has no Signed-off-by:, uses handle knalekar instead of human full name, and carries a forbidden AI trailer (Assisted-by: LLM) in the git commit message. Commits must carry human identity and human Signed-off-by: only, with zero AI trailers in commit messages.
  3. Stale PR description: The PR body still documents the removed t6030_swap_timestamps and t6030_early_flip module parameters instead of the current commit's behavior. Please update it to match the commit.
  4. §5 Evidence & §1 multi-Mac coverage (blocker): Because the early-flip path changes every internal 14.x panel by default, testing only on one j514s with mutter (with KUnit compile-checked only, no regression tuple, no kernel build ID, and no non-T6030 14.x panel checks such as J613/J615 60 Hz or J516C/J514C, nor a 2-buffer/direct-scanout check) is insufficient. After fixing the flip-completion semantics, provide exact-head hardware + regression rows (0 SELinux denials, 0 failed units, 0 new kernel errors) across the affected internal 14.x panels and confirm KUnit execution.

Verdict

REQUEST_CHANGES — blocked on the early-flip correctness/error-handling bugs, missing human Signed-off-by: and forbidden commit Assisted-by: trailer (§4), stale PR body, and §5 hardware/regression coverage.

@github-actions github-actions Bot added area:display Area from CODEOWNERS (bot) changes-requested A reviewer requested changes (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) needs-template PR body lacks Tested or Risk (bot) labels Nov 24, 2026
@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Merge readiness at 9181db40: not ready yet

Check Detail
CI at head running running: KUnit isp, KUnit jpeg, KUnit prores, KUnit scaler, KUnit macsmc, KUnit clpc
Review ok approved by DjDeveloperr
Requested changes ok none
Hardware row at head ok in the PR body at 9181db40
Conflicts ok none
PR text ok Risk: two-way · T6030 (M3 Pro/Max) internal panel. A plain revert undoes it.

Areas: area:display

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: FINISH, then merge at 0136657c8267

Blockers:

  1. Commit 0136657c has no Signed-off-by and carries an attribution trailer. Fix: git commit --amend -s, removing the trailer, then force-push your branch.

Rows before merging: iomfb_v14_7.c is shared by every Mac on 14.7 firmware, so besides your J514s row it needs one boot on a 14.7 Mac from another generation, presenting as before.

Checked: thank you for this; 120 Hz on the J514s is a nice result. No Apple material, and no module parameters anymore. The swap timestamps are a board property now, and the early flip is deliberate and explained in the code. Your J514s row shows 120 fps with no flip failures. Question, not blocking: after the early flip, a failed dcp_v14_present() reaches dcp_v14_cancel_event() for an event that was already sent. Is that call still needed?

@DjDeveloperr
DjDeveloperr dismissed their stale review November 25, 2026 00:14

Superseded by the review at 0136657

14.7 firmware on the T6030 ProMotion panel completes swaps every
second refresh: with the swap record's presentation timing words all
zero, swaps complete 16.7 ms apart even though the panel scans out at
120 Hz, so compositors pace everything at 60 fps
(omacom/linux-aurora aurora-silicon#31).

Set the existing per-board .swap_timestamps flag on the T6030 record.
dcp_v14_swap_locked() then stamps the three presentation timing words
(offsets 0x00, 0x08 and 0x30, as on the 12.x/13.x/26.6 paths) through
dcp_v14_swap_timestamps(). With the target long past, the firmware
presents each swap at the next refresh, i.e. at 120 Hz.

Report an internal panel's flip before dcp_v14_present() instead of
after it. dcp_v14_swap() blocks until the firmware completes the swap,
so the compositor could not start its next frame until then. The next
commit still waits for this swap (v14->lock and the CRTC commit
dependencies), and displaced framebuffers stay pinned until the swap
completes, so nothing is freed while the firmware may still scan it. A
3-buffer swapchain renders into the buffer from two flips back, which
is already off screen. This is not board-specific and now applies to
every internal 14.x panel; external processors keep their present
path.

On j514s (MacBook Pro 14", M3 Pro, T6030) with GNOME/mutter 50.6,
stock paces everything at ~60 fps while the panel reports 120 Hz; with
these changes UFO tester and visual checks confirm ~120 fps, stable
across several boots with no GPU faults, flip failures or display
errors. The swap timestamps were also validated on j516s
(omacom/linux-aurora aurora-silicon#31). The early flip has only been tested on
T6030.

Signed-off-by: Dj <43033058+DjDeveloperr@users.noreply.github.com>
@DjDeveloperr
DjDeveloperr requested a review from a team as a code owner November 25, 2026 02:12
@github-actions github-actions Bot added the needs-hw-row No hardware row at the PR head (bot) label Nov 25, 2026
DjDeveloperr
DjDeveloperr previously approved these changes Nov 26, 2026

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code approved at f8d416342d70. The replacement commit has a human sign-off and the same patch ID as the reviewed change. Thanks for the fix. Before merge, tie the 120 Hz target result to this patch and check presentation on a second generation using the shared 14.7 path.

@DjDeveloperr
DjDeveloperr dismissed their stale review November 26, 2026 01:21

Superseded by the review at f8d4163

@github-actions github-actions Bot added merge-conflict Conflicts with the base branch (bot) and removed changes-requested A reviewer requested changes (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 26, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor

This branch now conflicts with main. Could you merge main in with a normal push (no force push) within the next 24 h? If that doesn't suit you, a maintainer will do the forward merge after that, keeping your changes and authorship, so the PR can go on to merge.

Forward merge after the 24 h rebase ask (fasttrack policy); the
author's commit and authorship are kept.

Conflict in iomfb_v14_7_flush(): main computes the scanout size once
(dcp_v14_plane_scanout_size() -> width/height). The early internal-panel
flip from this PR now passes those values instead of fb->width/height;
the rest of main's swap path is unchanged.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
@RyanTheTide

Copy link
Copy Markdown
Contributor

@knalekar the 24 h window passed, so per the fast-track policy I forward-merged main into your branch with a normal push (no force push). Your commit and authorship are unchanged. New head: 4bcadee.

  • One conflict, in iomfb_v14_7_flush(). main now computes the scanout size once (dcp_v14_plane_scanout_size() -> width/height). Your early internal-panel flip now passes those values instead of fb->width/fb->height. Everything else in your change, and main's swap path, is as it was.

Tested at 4bcadee: KUnit drivers/gpu/drm/apple/tests/display.kunitconfig (arm64): 168 run, 167 passed, 1 skipped; run-host-tests.py --only dcp 65/65.
Risk: two-way · T6030 (M3 Pro/Max) internal panel. A plain revert undoes it.

Still needed: a 120 Hz row on a T6030 Mac at this head. Our lab has no M3 Pro/Max, so if you can post one, that's the last item.

@RyanTheTide
RyanTheTide requested a review from a team as a code owner November 28, 2026 05:59
@RyanTheTide
RyanTheTide requested a review from maralcbr November 28, 2026 05:59

@aurora-silicon-review aurora-silicon-review Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: FINISH at 4bcadee28e98

The current diff signals the flip before dcp_v14_present() even starts. A directly scanning double-buffered client can reuse the displaced framebuffer after that signal while firmware is still scanning it. Retaining the framebuffer pins its memory but does not prevent userspace writes. A failed present also cannot retract the flip already delivered. The condition applies to every internal v14.7 panel, although the reported test is T6030. Please split the timestamp fix for independent review and keep flip completion tied to a successful presentation or an explicit safe release point. Update the description for the current default behavior and post an exact-head 120 Hz row with compositor pacing and direct-scanout checks for any revised early-completion path.

@github-actions github-actions Bot added needs-review No approving review from Core or Omarchy Mac yet (bot) and removed merge-conflict Conflicts with the base branch (bot) labels Nov 28, 2026
The early flip reported page-flip completion before dcp_v14_present()
submitted the swap. A two-buffer client with direct scanout could then
reuse the displaced framebuffer while the firmware was still scanning
it, and a failed present could not retract the event. It also changed
every internal 14.x panel, not just the T6030.

Keep the T6030 swap timestamp fix on its own. With the timestamps set,
the firmware presents each swap at the next refresh instead of every
second refresh, so flip completion after dcp_v14_present() no longer
holds the panel at 60 Hz. Flip completion stays tied to a successful
presentation.

Signed-off-by: Krish Nalekar <53238848+knalekar@users.noreply.github.com>
@knalekar knalekar changed the title drm/apple: t6030: swap timing words and early flip for 120 Hz drm/apple: t6030: swap timing words for 120 Hz Nov 29, 2026
@knalekar

Copy link
Copy Markdown
Contributor Author

Reworked at 9181db40:

  • Dropped the early internal-panel flip. Flip completion is back after a successful dcp_v14_present(), so a double-buffered direct-scanout client cannot reuse a framebuffer while firmware is still scanning it, and a failed present is not reported as complete.
  • The T6030 .swap_timestamps fix is now the only runtime change, with v14-board-test.c updated. This can be reviewed independently.
  • Updated the description for the current behavior.

Still needed: a timestamp-only 120 Hz row at 9181db40 on j514s, with compositor pacing and a direct-scanout check. I do not have a result at this head yet.

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: HOLD at 9181db40 — code is clean and the early-flip blocker from 4bcadee2 is resolved; awaiting fork CI workflow approval/green checks and the exact-head timestamp-only T6030 (j514s) 120 Hz hardware row.

Blockers:

  1. Exact-head hardware verification at 9181db40 on a T6030 internal panel (j514s / j516s) confirming .swap_timestamps = true delivers 120 Hz compositor pacing and clean direct scanout without the dropped early flip, plus fork CI workflow approval and green checks.

Checked: Full 2-file diff (drivers/gpu/drm/apple/iomfb_v14_7.c, drivers/gpu/drm/apple/v14-board-test.c), commit Signed-off-by lines across all 3 commits, and board-scope isolation.

Evidence
  • Prior early-flip blocker resolved (9181db401c):
    • iomfb_v14_7_flush() is restored to main verbatim, so flip completion again waits for a successful dcp_v14_present() (no premature framebuffer reuse on double-buffered direct scanout, no un-retractable flip event on failed present, and no change to other 14.x internal panels).
  • Remaining diff (+10/-8):
    • drivers/gpu/drm/apple/iomfb_v14_7.c:107-108: sets .swap_timestamps = true on dcp_v14_board_t6030 only, matching the existing dcp_v14_board_j516c mechanism.
    • drivers/gpu/drm/apple/v14-board-test.c: updates v14_board_swap_timestamps and comments to expect t6030_b->swap_timestamps == true and dcp_v14_board_stamps_swaps(t6030_b, false) == true, while asserting j514c, j613, external role, and NULL remain false.
    • All three commits carry valid human Signed-off-by lines.
  • Remaining merge gate: Once the timestamp-only T6030 row at 9181db40 and fork CI checks pass, this is ready to approve and merge.

@github-actions github-actions Bot added blast:m3 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) and removed needs-hw-row No hardware row at the PR head (bot) needs-template PR body lacks Tested or Risk (bot) labels Nov 29, 2026

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At 9181db4 the early flip is gone. The only driver change enables swap timestamps in the existing T6030 board record. The test covers the internal panel and preserves the external-pipe behavior. Code approved. The T6030 presentation-timing row and the pending fork workflows still need verification before merge.

@github-actions github-actions Bot removed the needs-review No approving review from Core or Omarchy Mac yet (bot) label Dec 1, 2026

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: MERGE at 9181db401c48

Converts this App's earlier review at the same head to an approval under the 12-01 merge bar (better than before and doesn't break; block only on a shown failure). No code blocker was found in it. The merge gate (a row on one Mac at this head + fast CI) is tracked by pr-readiness, not held here.

Checked: Full 2-file diff (drivers/gpu/drm/apple/iomfb_v14_7.c, drivers/gpu/drm/apple/v14-board-test.c), commit Signed-off-by lines across all 3 commits, and board-scope isolation.

Follow-ups (not blocking): fork CI approval/green, exact-head T6030 120 Hz row

@RyanTheTide

Copy link
Copy Markdown
Contributor

Merging at 9181db401c48 (B2 merge train, 12-01 merge bar). Approval at this head: DjDeveloperr,aurora-silicon-review[bot]. Row: the hardware row at 9181db4 that the readiness check found (PR body or comment). CI: linux train L3 = main 429e7e1 + 28 approved PRs (candidate 45c2fa4b): Apple driver compile pass, Apple DTBs W=1 pass, planned KUnit dcp-fabric/dcp-topology/dcp-display/macsmc/spi-hid-apple/mt7932/asahi/sep pass; ave failed to build only because of #3153 (unused static helper under -Werror; #3153 held out) and passes with #3153 reverted from the candidate; host tests apple-dcp and apple-scaler-recovery pass. The rest of the hosted run is queued behind the backlog. Revert: git revert -m 1 <merge commit>.

@RyanTheTide
RyanTheTide merged commit 546464e into aurora-silicon:main Dec 1, 2026
22 of 23 checks passed
maralcbr pushed a commit to omacom/linux-aurora that referenced this pull request Dec 2, 2026
14.7 firmware on the T6030 ProMotion panel completes swaps every second
refresh: with the swap record's presentation timing words all zero,
swaps complete 16.7 ms apart even though the panel scans out at 120 Hz,
so compositors pace everything at 60 fps (omacom/linux-aurora #31).

Set the existing per-board .swap_timestamps flag on dcp_v14_board_t6030
and update the v14-board-test KUnit assertions accordingly. With the
timestamps set, the firmware presents each swap at the next refresh
(120 Hz) while flip completion stays tied to a successful presentation.

Squashed 4a42f31 carry of merged upstream aurora-silicon/linux#1969
(f8d4163 + 9181db4, merge commit 546464e).

Signed-off-by: Dj <43033058+DjDeveloperr@users.noreply.github.com>
Signed-off-by: Krish Nalekar <53238848+knalekar@users.noreply.github.com>
Signed-off-by: Marcelo Alcantara <maralc@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:display Area from CODEOWNERS (bot) blast:m3 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants