Skip to content

drm/apple: report a firmware 27 ProMotion panel as VRR capable - #3616

Merged
RyanTheTide merged 2 commits into
mainfrom
fix/dcp-fw27-panel-vrr
Nov 29, 2026
Merged

RyanTheTide merged 2 commits into
mainfrom
fix/dcp-fw27-panel-vrr

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

What

Report a firmware 27 internal ProMotion panel (K114s, T6050) as VRR capable (vrr_capable 1, range 24-120 Hz) without making its mode variable. The DCP never gets a minimum rate.

Why

On firmware 27 the panel already refreshes when a swap arrives. I measured this on the K114s (7.3.0-k114sstack7, gdm stopped, plain atomic page flips, no mode set after the first; tool fliptime, kit kits/test/20261129-k114s-vrr-row). Each swap is shown at the first 240 Hz tick (4.167 ms) after it is submitted, and at least one 120 Hz period after the previous one:

submit pace flip intervals a fixed 120 Hz grid would give
48 Hz 20.8 ms steady 16.7 / 25 ms alternating
100 Hz 8.3 / 12.5 ms 8.3 / 16.7 ms
30 Hz 33.3 ms 33.3 ms
10 Hz / 2 Hz 100 ms / 500 ms same

Flip phase modulo 4.167 ms gives a concentration R of 0.98-0.99 at every pace. Modulo 8.333 ms, R is 0.02 at 48 Hz. macOS traces of the same panel under our HV (DCP-HVTRACE dh8d, CADisplayLink 24/48/60/120 and a 24-120 phase) show no refresh-rate field in the swap either, so ProMotion there is presentation-time pacing too.

The panel's timing lists its VRR range as zero placeholders, so the connector reported no VRR and Mutter/KWin never let the panel follow a game or a 24/48 fps video. #3369 (closed) instead took the zeros as a 24-120 Hz range, which made the mode variable. A mode set that sends that minimum rate (the shutdown fbdev mode set) crashes the firmware 27 DCP.

How

  • dcp_refresh_swap_paced() (dcp-refresh.h): a firmware 27 panel's fixed ProMotion timing gets a 24-120 Hz range for reporting only.
  • dcp_connector_get_modes-path (iomfb.c): such a timing sets vrr_capable and the connector's monitor_range. modes[i].vrr stays false.
  • VRR_ENABLED already causes no mode set on firmware 27 panels (dcp_crtc_atomic_check). Every path that sends a minimum rate (iomfb_modeset, dcp_set_adaptive_sync, peer frames) requires mode->vrr, so nothing reaches the DCP. The swap stream is byte-for-byte what it was.
  • Desktop 26.x, 13.x/14.x panels and externals are unchanged: the helper needs DCP_FIRMWARE_V_27_0 plus a panel plus a 120 Hz timing that has no range of its own.

Tested: at 349a2fa: KUnit (appledrm config, arm64 LLVM) 381/382 pass, 1 skip, incl. new dcp_refresh_swap_paced_test; tools/asahi/run-host-tests.py 822/822 (incl. new panel-refresh-range cases; the run caught a use-after-free of the published mode in 8a885a7, fixed in 349a2fa); checkpatch clean; K114s flip-timing measurement above on the unchanged driver; K114s exact-head row PASS (Mutter offers and selects 3024x1986@120.000+vrr; VRR_ENABLED 0/1 flips accepted, same submit pacing; 0 DCP crash incl. a VRR-on mode set; relight row (CRTC off->on x10 with VRR_ENABLED=1) + 3 reboots with Mutter VRR on: 0 crash; traces/display/20261129-k114s-fw27-vrr). J616s (desktop 26.x) is outside the condition (KUnit/host negatives).
Risk: two-way · every ProMotion MacBook Pro whose DCP runs firmware 27.x: the M5 Pro K114s (tested) and the M4 Pro J614s/J616s on the T6041 27.2 pin (J616s regression row pending). Low: the connector property and range change only on firmware 27 internal ProMotion panels. No DCP call changes. Worst case, a compositor that enables VRR sees the same flips it gets today.

A firmware 27 internal ProMotion panel (K114s, T6050) already refreshes
at the pace of the swaps.  Flip timing on the K114s with plain atomic
page flips and no mode set: each swap is shown at the first 240 Hz tick
after it is submitted, no sooner than one 120 Hz period after the
previous one.  Steady 48 Hz submits give 20.8 ms flips (a fixed 120 Hz
grid would alternate 16.7 and 25 ms), 100 Hz gives 8.3 and 12.5 ms, and
2 Hz gives 500 ms.  macOS sends no refresh rate with its swaps on this
firmware either.

The panel's timing lists its variable refresh range as zeros, so the
connector reported no VRR and compositors never let the panel follow a
game or a 24/48 fps video.  Taking the zeros as the 24-120 Hz range
(as on desktop 26.x) is not an option: a mode set that sends that minimum
rate crashes the firmware 27 panel's DCP.

Report the fixed 120 Hz timing of a firmware 27 panel as variable, with
the 24 Hz floor macOS gives these panels, and keep the mode itself fixed.
VRR_ENABLED already causes no mode set on these panels, and every path
that sends a minimum rate requires a VRR mode, so none is ever sent.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The VRR report read the refresh rate from the published copy of the
mode, which the connector owns once dcp_publish_mode() has taken it (the
apple-dcp host fixture frees it there: heap-use-after-free in
publication-hpd and panel-dimensions).  Read it from the driver's own
mode list instead.  Give the rate fixture drm_mode_vrefresh() and test
dcp_refresh_swap_paced() in panel-refresh-range as well.

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

Copy link
Copy Markdown
Contributor Author

K114s row with this exact head (349a2fa): PASS. Setup: Ryan's default kernel 7.3.0-k114sstack7 (bridge8) on a one-shot BLS entry, with a copy of its initramfs carrying appledrm = bridge8 + this diff (build ID e87fffa9 live). Default entry, ESP and Stage 2 untouched.

  • Mutter (GDM greeter) now lists 3024x1986@120.000+vrr on eDP-1 and picks it as current (refresh-rate-mode: variable). Before this PR it only had 3024x1986@120.000.
  • fliptime with gdm stopped and the CRTC's VRR_ENABLED at 0 and at 1: both commits accepted, same submit-paced flips (48 Hz → 232/235 flips at 20.8 ms; 24 Hz → 41.7 ms; 100 Hz → 8.3/12.5 ms; 240 Hz-tick phase R 0.97-0.99).
  • 0 DCP crashes on the row boot. That includes the mode set after a gdm restart with VRR on, which logged set_digital_out_mode() ... vrr:0, so no minimum rate was sent. A plain reboot back to the default was clean too: 0 crash, 0 failed units, Enforcing.
    Raw logs: traces/display/20261129-k114s-fw27-vrr (README). J616s (desktop 26.x) is outside the helper's condition (DCP_FIRMWARE_V_27_0 + panel); the KUnit and host-test negatives cover that.

@RyanTheTide
RyanTheTide marked this pull request as ready for review November 29, 2026 11:40
@RyanTheTide
RyanTheTide requested review from a team as code owners November 29, 2026 11:40

@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 349a2fa5

Blockers: None (await queued hosted CI checks to complete green before merge).

Checked:

  • dcp_refresh_swap_paced() (drivers/gpu/drm/apple/dcp-refresh.h) and its dcp_get_modes() caller (drivers/gpu/drm/apple/iomfb.c L2896, L3176–3195) scope the synthetic 24–120 Hz VRR report strictly to dcp->fw_compat == DCP_FIRMWARE_V_27_0 && dcp_has_panel(dcp) fixed 120 Hz ProMotion timings (!modes[i].vrr && dcp_refresh_is_promotion(...)). Desktop 26.x, 13.x/14.x panels, non-120 Hz modes, existing VRR timings, and all external displays (including firmware 27 externals) are untouched.
  • Commit 349a2fa5 cleanly resolves the 8a885a70 use-after-free by computing drm_mode_vrefresh(&modes[i].mode) on the driver-owned mode copy rather than the connector-owned copy passed to dcp_publish_mode().
  • Verified modes[i].vrr stays false throughout: dcp_crtc_atomic_check() (dcp.c L2457–2458) already suppresses mode-set triggers on VRR_ENABLED toggles for firmware 27 panels, and every firmware minimum-rate path in iomfb_template.c (dcp_peer_modeset_v27() L4499, dcp_set_adaptive_sync() L4512–4518, dcp->vrr_enabled L4583, dcp_vrr_update() L4612) gates on mode->vrr/dcp->vrr_enabled, so IOMFBPARAM_ADAPTIVE_SYNC is never sent to the firmware 27 DCP.
  • connector->display_info.monitor_range (min_vfreq = 24, max_vfreq = 120) is populated after the EDID update path (iomfb.c L3215–3219).
  • Unit/host coverage (parser_mode_test.c dcp_refresh_swap_paced_test, display.py, and rate.py drm_mode_vrefresh stub) covers both positive and negative cases, and the exact-head 349a2fa5 K114s hardware row passed (3024x1986@120.000+vrr advertised and selected by Mutter, VRR_ENABLED 0/1 submit-paced flips verified, 0 DCP crashes including GDM restart vrr:0 mode set and reboot).
Evidence
  • drivers/gpu/drm/apple/dcp-refresh.h: dcp_refresh_swap_paced() requires fw27_panel && !vrr && dcp_refresh_is_promotion(rate), writing *low = 24U << 16, *high = rate without modifying caller state on false.
  • drivers/gpu/drm/apple/iomfb.c: fw27_panel = dcp->fw_compat == DCP_FIRMWARE_V_27_0 && dcp_has_panel(dcp) (L2896); adaptive tracks reported VRR independently of modes[i].vrr (L3176–3194) and populates vrr_capable and monitor_range.{min,max}_vfreq.
  • drivers/gpu/drm/apple/dcp.c (L2456–2468) and drivers/gpu/drm/apple/iomfb_template.c (L4497–4583, L4612): confirmed no VRR_ENABLED mode-set trigger and no IOMFBPARAM_ADAPTIVE_SYNC call when mode->vrr == false.
  • Reported local verification at 349a2fa5: KUnit 381/382 pass (1 skip), host tests 822/822 pass, exact-head K114s row PASS (traces/display/20261129-k114s-fw27-vrr).

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Relight + reboot row at 349a2fa (the #3369 crash path): PASS, 0 DCP crashes.

  • pwrcycle 1 10 1500 1000: CRTC off→on 10 times with VRR_ENABLED=1 (gdm stopped). Every relight logged set_digital_out_mode() ... vrr:0, so no minimum rate was sent. 0 crashes. With drm/apple: take a panel's zero refresh range as no range on firmware 27 too #3369 the first relight crashed (2/2).
  • 3 plain reboots from the lab boot with Mutter in 3024x1986@120.000+vrr (this is the shutdown fbdev relight that crashed bridge4): journalctl -b -1 -k shows 0 crashes after each, and the last modeset was vrr:0 each time.
  • The K114s is back on its default (stock appledrm), 0 failed units, Enforcing.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

code-owner ping <@422957901716652033> / @DjDeveloperr: merge train at 349a2fa5. App approved; K114s exact-head rows (GNOME VRR, VRR 0/1 flips, 10 relights + 3 reboots with VRR on, 0 DCP crashes). Merges under the 6-point rule 1 h from now once hosted CI is green, unless you object.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Merge-train note at 349a2fa5: this changes iomfb.c, which every DCP generation shares, and VRR is in use on other Macs too. Before merging I need one non-K114s VRR row at this head: the J473 with the MSI 280 Hz VRR monitor, or the J713 internal panel. VRR on/off flips, a relight, one reboot, 0 DCP crashes.

@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 349a2fa5 (K-board adversarial review). One PR-text correction below. It doesn't block the merge, but please fix it before merging.

Checked (what I tried to break):

  • Whether any DCP call changes. With VRR reported, a compositor will set VRR_ENABLED=1, so I followed every user of crtc_state->vrr_enabled and dcp->vrr_enabled in iomfb_template.c: the mode-set modeset->vrr (L4185), set_digital_out_mode / adaptive-sync minimum (L4499, L4512-4516), dcp->vrr_enabled (L4264, L4583), dcp_vrr_update (L4612) and the swap timestamps (L4813). Each one is ANDed with mode->vrr, which stays false because the helper only changes the local adaptive. dcp->vrr_enabled stays 0, so the swap stream doesn't change and no minimum rate is sent: the #3369 crash path is closed. A VRR_ENABLED toggle doesn't set mode_changed in the DRM core, and apple_connector_notch_fastset refuses a fastset when vrr_enabled changes. So the row's "VRR-on mode set, 0 crash" covers the one path that is left.
  • The helper. It needs fw27, a panel, no range of its own (vrr false), and a ProMotion rate. drm_mode_vrefresh() rounds 119.88 to 120, which is still inside the +/-0.2 % window. The 24 Hz floor matches the existing dcp_refresh_range() default for ProMotion zeros. The UAF fix (rate read from modes[i].mode, not the published mode) is right. monitor_range is still written after the EDID reset (L3216), as before.
  • Evidence. The flip-timing logs in traces/display/20261129-k114s-fw27-vrr (ft-hz*.log, rvrr-v0/v1-*) back up the 240 Hz-tick claim: steady 20.8 ms at a 48 Hz submit pace. The exact-head K114s row covers Mutter selecting +vrr, VRR 0/1 flips, 10 relights and 3 reboots with 0 DCP crashes. The 1 KUnit skip is the same pre-existing skip seen on main (#3502/#3542 runs). Only readiness fails on hosted CI, which is the Core-approval gate. The KUnit legs are still queued.

PR-text correction (please fix):

  • The Risk: line says M5 Pro (K114s), but the condition is fw_compat == DCP_FIRMWARE_V_27_0 && dcp_has_panel(). Any DCP whose firmware-compat is 27 or later reaches that: the generic dcp_firmware_27() path, the T6041 27.2 pin (M4 Pro/Max MacBook Pro) and the T8122 27.2 pin. So every ProMotion MacBook Pro running a 27.x stub would now report VRR 24-120, and only the K114s has been measured to swap-pace. Elsewhere the change only affects what is reported (see above), so the worst case is VRR advertised on a panel that keeps a 120 Hz grid, which gives the flips it gets today. Please widen the line, e.g. Risk: two-way · ProMotion MacBook Pros on firmware 27.x (measured on the K114s; reporting only elsewhere). MERGETRAIN6's 23:15 second-family hold is the right gate for those Macs. In the lab, the J616s on 26.x is outside the condition, so a J616s "vrr_capable unchanged, 0 DCP crash" row is enough there.

Non-blocking: Mutter derives +vrr variants for every mode once the connector is vrr_capable, including the panel's 60 Hz-class timings, which this PR doesn't mark. They stay fixed (no mode->vrr), so that's harmless, but a 60 Hz + VRR selection hasn't been rowed.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Merge-train note: KREVIEW points out the Risk line understates the scope. It's any ProMotion MacBook Pro on firmware 27.x, including the T6041 27.2 pin, not only the K114s. Please widen the Risk line; the second-family VRR row ask stands (a J616s inert row is fine as the regression row).

@github-actions github-actions Bot added area:display Area from CODEOWNERS (bot) blast:m5 Macs affected, from Merge risk (bot) ci-failing A check failed at the PR head (bot) door:two-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 29, 2026
@github-actions

github-actions Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Merge readiness at 349a2fa5: not ready yet

Check Detail
CI at head no failing: pr-text / pr-text, pr-text / pr-text, pr-text / pr-text
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes ok none
Hardware row at head ok in the PR body at 349a2fa5
Conflicts ok none
PR text ok Risk: two-way · every ProMotion MacBook Pro whose DCP runs firmware 27.x: the M5 Pro K114s (tested) and the M4 Pro J614s/J616s on the T6041 27.2 pin (J616s regression row pending). Low: the connector property and range change only on firmware 27 internal ProMotion panels. No DCP call changes. Worst case, a compositor that enables VRR sees the same flips it gets today.

Areas: area:display

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

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

J616s regression row (second family, asked by the merge train): PASS, inert.

J616s (M4 Pro 14", DCP firmware 26.6.2) on its saved Edge kernel 7.3.0-aurora-edge (933f822), one-shot boot with appledrm rebuilt from 933f822 + this PR's two commits (driver diff identical to the PR), then a plain reboot back to stock. All three boots (stock, lab, stock) match:

  • eDP connected, vrr_capable 1 (the firmware 26 timing has its own range, so it was already 1 before this PR)
  • DRM modes 3456x2234 @ 120/60/50/48; Mutter offers the same 12 modes (each with and without +vrr) and runs 3456x2234@120.000+vrr
  • 0 DCP crashes, 0 failed units; the only new kernel warning on the lab boot is the out-of-tree module taint

So the helper stays off on firmware 26, as intended. Risk line widened as asked.

@github-actions github-actions Bot added the blast:m4 Macs affected, from Merge risk (bot) label Nov 29, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Merging under the 6-point rule (Ryan 09:29, permanent), at 349a2fa5. (1) The review App approved at this head. (2) Full CI is green. Hosted pr-text is still queued; the canonical pr-text.sh passes locally on this body. (3/4) Rows: K114s-VRR-rows+J616s-inert;Risk-widened. (5) There's no blocking review. (6) Dj was pinged here 431 min ago with no objection. Revert: git revert -m 1 <merge>.

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:m4 Macs affected, from Merge risk (bot) blast:m5 Macs affected, from Merge risk (bot) ci-failing A check failed at the PR head (bot) door:two-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant