Repository navigation
drm/apple: offer a firmware 27 ProMotion panel's fixed rates as paced modes - #3693
RyanTheTide wants to merge 1 commit into
Conversation
… modes Firmware 27 lists the T6050 internal panel's fixed rates next to its 120 Hz timing: 60, 59.94, 50, 48 and 47.95 Hz, each marked IsPromoted, the set macOS offers. Linux offered only 120 Hz, because a mode set away from the 120 Hz timing crashes the DCP (dcp_mode_settable()). The panel does not need that mode set: it shows each swap on the first 240 Hz tick after the swap arrives (dcp_refresh_swap_paced()). So offer each fixed rate as a mode of its own that keeps the DCP on the 120 Hz timing of its size, and pace the swaps to the rate: - dcp_find_mode() gives a paced rate's 120 Hz entry, so a mode set, dcp_mode_settable() and every firmware call see that timing only. - Switching between paced rates of one timing is no mode set (apple_connector_rate_fastset()), as with the notch geometries. - iomfb_pace_hold() holds a paced swap until its due time, kept whole periods apart, so 60 and 48 Hz are whole ticks and 59.94, 50 and 47.95 Hz keep their average. A swap a period late starts again from the last swap shown. VRR_ENABLED turns the pacing off. Only while the panel runs the 120 Hz timing; a panel iBoot left at 60 Hz keeps just that. The panel EDID's range also started at its lowest timing (47 Hz), which is what compositors show as the VRR range; take the paced floor (24 Hz) instead. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
|
Hardware rows at head
|
There was a problem hiding this comment.
Verdict: HOLD at 76de6e29
Blockers:
- Hosted CI is still queued at
76de6e29(kunit,apple-build,host-tests, and 17 KUnit suites queued;pr-textandreadinesspassed).
Checked:
- All 11 changed files (
apple_drv.c,dcp-display-metadata.{c,h},dcp-internal.h,dcp.c,iomfb.c,iomfb_template.c,parser-test.c,dcpext26-queue-tests.py,desktop.py,rate.py). - Verified
dcp_paced_rates()strictly scopes pacing to firmware 27 T6050 internal ProMotion panels running the 120 Hz boot timing (only_120hz_modes && fw_compat == DCP_FIRMWARE_V_27_0 && (!boot || boot == 120) && dcp_has_panel(dcp)), leaving M1–M4, T8142 Air 60 Hz, external displays, and 60 Hz iBoot panels untouched. - Verified
dcp_find_mode()->dcp_paced_base()keeps every firmware call anddcp_mode_settable()on the 120 Hz timing,apple_connector_rate_fastset()avoids firmware mode sets across same-size paced rates,dcp_pace_ns()disables pacing on120 HzandVRR_ENABLEDwithoutu64/u32overflow, andiomfb_queue_stop()teardown ordering (stopped = trueunderiomfb.lock->hrtimer_cancel(&pace_timer)->cancel_work_sync(&work)) is race-free. - Verified exact-head
76de6e29hardware rows on K114s (all 6 rates measured within ~0.02 Hz, VRR variable, 0 firmware mode sets, 0 DCP crashes) and J616s (inert regression pass).
Evidence
- Non-blocking ordering nit: in
drivers/gpu/drm/apple/iomfb_template.c,dcp_report_swap_complete()writesdcp->iomfb.last_completeafteriomfb_present_complete_h17p(dcp)clearspresent_state_h17p.pendingand wakesiomfb.work. On the first swap after an idle gap, a racingiomfb_pace_hold()on another CPU could read the previouslast_completeand send that single swap immediately before resynchronizing on the next swap (harmless, never stalls or crashes). - Ready to approve once hosted build, KUnit, and host-tests checks complete green at
76de6e29.
There was a problem hiding this comment.
Adversarial review at 76de6e2 (non-author, KREVIEW, K-board split).
Verdict: MERGE at 76de6e2. Hosted CI is still queued on the shared runners. I ran the two suites it would run locally; readiness gates on the hosted jobs separately.
Checked:
- Read the whole diff, plus the queue, atomic-check, mode-lookup and teardown code around it.
- Reproduced locally at this head on the buildbox:
kunit.py run --arch=arm64 --make_options LLVM=1 --kunitconfig=drivers/gpu/drm/apple/tests/display.kunitconfig(theapple-drm-kunit.ymlcommand): 181 run, 180 pass, 1 skip.parser_internal_v27_only_120hzandparser_panel_identitypass. The one skip isapple_g17_rx_util_min_test(needsCONFIG_UCLAMP_TASK), not this PR.tools/asahi/run-host-tests.py: 846/846.
- Crash path stays closed:
dcp_find_mode()maps a paced rate to the same-size 120 Hz catalog entry only whiledcp_paced_rates()holds (fw 27,only_120hz_modes, panel, boot rate 0/120).dcp_mode_settable()now judges the entry the DCP would run, so every firmware mode set still carries the 120 Hz timing. A size with no 120 Hz entry falls back to its own entry and is still refused. When iBoot left the panel at 60 Hz, pacing is off and the old single-timing rule applies (KUnit covers both). - Fastset:
apple_connector_rate_fastset()runs after the notch fastset and before the colorspace/EOTF/bpc checks, so a commit that also needs a real mode set for those still gets one. The crtc-check VRR re-modeset (dcp.c~2499) runs later and excludes fw 27 panels anyway.a == bcompares pointers into onedcp_modes_snapshot(). If the catalog is replaced between the two lookups, the comparison fails safe to a full mode set. - Pacing:
iomfb_pace_hold()runs underiomfb.lockat the queue head only and touches only presentation transactions. 120 Hz and VRR swaps reset the schedule. A held swap blocks non-presentation work behind it for at most one period (<= 20.9 ms), against the 10 s queue timeout, which only arms onactive.pace_nstops out at ~41.7 ms and fits u32.- Stale
pace_next/last_completeafter a stop/restart oriomfb_reset_transport()self-heal: the late branch re-anchors, and an anchor in the past sends at once. - Teardown:
iomfb_queue_stop()setsstoppedunder the mutex beforehrtimer_cancel(). A racing work item therefore bails before it can re-arm, andcancel_work_sync()follows. Every remove/unbind/fail-stop path I found callsiomfb_queue_stop().
- Scope: only T6050 internal panels can make
dcp_paced_rates()true. The J616s row (fw 26.6) shows the untaken branch: same modes and rates as stock.
Non-blocking:
- On a fastset,
drm_atomic_helper_update_legacy_modeset_state()skips the CRTC (mode_changed false). So legacycrtc->mode(GETCRTC) keeps reporting the previous rate. The atomic MODE_ID blob is right. Same as the notch fastset; worth one comment line. dcp_panel_paced_min()returns the last match, not the minimum. All matches return 24 today, so the result is the same;min_not_zero()would make the name true.- With VRR_ENABLED on a paced mode, pacing is off and the panel runs at swap pace up to 120 Hz. "60 Hz Variable" therefore behaves like "120 Hz Variable". That's harmless for Mutter, whose frame clock follows the mode, but say so in the commit message.
- 59.957 Hz measured against 59.94 nominal sits inside one 240 Hz tick of sampling error over 349 flips (~5.8 s). A ~3000-flip run at 59.94 would show whether there is any long-run drift for video playback.
- K116c/K116s (same T6050 panel path) aren't rowed. The code path is identical, so I'm not holding for it, but an owner row would be welcome.
|
On hold (draft): macOS puts this panel on its real 60 Hz timing, and the M4 Pro (firmware 26) takes real mode sets to the same timings, so pacing is not what macOS does. A real 120 -> 60 Hz mode set from Linux crashes the firmware 27 DCP today (DPTX FIFO error, hot and cold), so the next step is to find what macOS sends for that switch and fix the real mode set. Pacing stays here only as a fallback. |
|
Two notes from working on the M3 Pro side (#4058, which sets
On the real mode set: every T6050 crash I found is a K114 board. I found no record of a 120 -> 60 Hz mode set on a mini-LED T6050 (J714s, J716c); the J716c took the same-timing full mode set in #3399. We have an instrumented J714s run ready that separates "any full mode set" from "a timing change". |
What
Offer the fixed refresh rates of a firmware 27 ProMotion panel (T6050, M5 Pro/Max MacBook Pro), the set macOS offers: 120, 60, 59.94, 50, 48 and 47.95 Hz, next to Variable. Until now the panel offered only 120 Hz, and compositors showed its VRR range as 47-120 Hz instead of 24-120.
Why
The firmware lists those rates in its timing catalog (each extra rate is marked
IsPromoted), but a mode set away from the 120 Hz timing crashes the T6050 internal DCP, sodcp_mode_settable()hides them. The panel doesn't need that mode set: it shows each swap on the first 240 Hz tick after the swap arrives (the pacing #3616 reports as VRR).How
dcp_find_mode()resolves a paced rate to the 120 Hz catalog entry of its size, so a mode set,dcp_mode_settable()and every firmware call only ever see the 120 Hz timing.apple_connector_rate_fastset(): switching between rates of one timing is no mode set, like the existing notch-geometry fastset.iomfb_pace_hold()holds a paced swap in the IOMFB queue until its due time (hrtimer). Due times are whole periods apart: 60 and 48 Hz are whole panel ticks, and 59.94, 50 and 47.95 Hz keep their average. A swap a period or more late restarts the schedule from the last swap shown.VRR_ENABLEDturns pacing off.dcp_paced_rates()); a panel iBoot left at 60 Hz keeps just that timing.Tested: KUnit (appledrm config, arm64 LLVM) 357/358 pass, 1 skip, incl. the extended
parser_internal_v27_only_120hzandparser_panel_identitycases;tools/asahi/run-host-tests.py846/846 (host harness stubs updated); checkpatch clean. K114s (M5 Pro 14", firmware 27), lab module on its 7.3.0 kernel: six eDP modes, EDID range 24-121, Mutter lists all six with their Variable variants. Measured flip-event rate per mode with a client flipping as fast as events come (349 flips each): 120.024 / 60.001 / 59.957 / 50.004 / 48.001 / 47.946 Hz; VRR still variable. Live Mutter switches through all six rates: 0 firmware mode sets, 0 DCP crashes. J616s (M4 Pro, firmware 26.6) regression on its Edge kernel with this change: identical modes and Mutter list, measured 120.001 / 60.000 / 59.940 / 49.998 / 48.000 / 47.953 Hz, same as stock.Risk: two-way · M5 Pro/Max (T6050) internal panel only. Medium: new swap pacing in the firmware 27 IOMFB queue for the non-120 Hz modes; 120 Hz and VRR swaps are not held. Every firmware mode set still uses the 120 Hz timing, so the known DCP crash path stays closed. Other machines:
dcp_paced_rates()is false, so the only change is an untaken branch.