Skip to content

drm/apple: create the HDMI pipeline's CRTC last - #3610

Merged
RyanTheTide merged 1 commit into
aurora-silicon:mainfrom
Ante042:dcp-hdmi-crtc-last
Dec 1, 2026
Merged

RyanTheTide merged 1 commit into
aurora-silicon:mainfrom
Ante042:dcp-hdmi-crtc-last

Conversation

@Ante042

@Ante042 Ante042 commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

What: With the session locked the HDMI pipeline's CRTC is free although its display is still connected, so a USB-C display that drops and returns (a KVM switch) gets paired with it, every mode is refused (DP-2 cannot follow its CRTC here) and Hyprland 0.57.2 aborts. This creates the CRTC of the pipeline that has hdmi-hpd-gpios after the others, so the first free CRTC an arriving Type-C display gets is one it can be driven from.
Tested: J314s M1 Pro at 00dbc20 (candidate c397c4d6f188 on main ea7aa36): boots, the same failed units as plain main, three rounds of locked session plus an 8 s USB-C port disconnect with the HDMI display attached and no compositor abort.
Risk: two-way door · Macs with an HDMI port behind DCP (hdmi-hpd-gpios in the DT); the CRTC order changes there, nothing else.
Not yet: compositors other than Hyprland.

Details

As far as I can tell Hyprland takes the first free CRTC the connector allows, and the HDMI pipeline's comes first. The abort is Hyprland's to fix as well and I have not reported it there yet; this only stops the kernel from offering a CRTC that cannot work in that state. Most of the diff is the existing loop indented one level for the second pass (git diff -w is 13 lines). If you'd rather have it without the re-indent, or the order decided somewhere else, say so.

Since the first push the host tests failed on this change: the readiness fixture in lifecycle.py only allowed a lookup of phys, and the driver now also asks for hdmi-hpd-gpios. The fixture answers that now; the driver change is the same.

Evidence
  • Plain main (bc87129 base, overnight run): abort on the first try, crash report in CMonitorResources::initFB, after 289c00000.dcp: DP-2 cannot follow its CRTC here.
  • c397c4d6f188: verify/kvm-repro.sh 0x3f 8 1 three times: 0 x "cannot follow", the same Hyprland pid before and after, crash reports unchanged.
  • Earlier, on a kernel with this commit and my other drafts: five rounds (three with a dock in another port, two without) and six rounds where the HDMI and the USB-C display arrive within seconds of each other, same Hyprland process throughout.

Thanks for looking!

A Type-C display cannot be moved onto the pipeline that drives the HDMI
port while an HDMI display is connected. A compositor that has switched
that display off sees its CRTC as free and gives it to the next Type-C
display that arrives when it comes first in the CRTC list. Every mode is
then refused, and Hyprland aborts.

Create that pipeline's CRTC after the others, so the first free CRTC of
an arriving Type-C display is one it can use.

Signed-off-by: Andreas Fernandez <andreas.fernandez@hotmail.com>
@Ante042
Ante042 marked this pull request as ready for review November 30, 2026 08:54
@Ante042
Ante042 requested review from a team as code owners November 30, 2026 08:54
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-30T09:06:04.556032Z 00dbc20 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions github-actions Bot added area:display Area from CODEOWNERS (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 30, 2026
@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Merge readiness at 00dbc209: not ready yet

Check Detail
CI at head running running: KUnit jpeg, KUnit prores, KUnit scaler, KUnit macsmc, KUnit clpc, KUnit apple-spmi-nvmem
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 00dbc209
Conflicts ok not computed yet
PR text ok Risk: two-way · Macs with an HDMI port behind DCP (hdmi-hpd-gpios in the DT); the CRTC order changes there, nothing else.

Areas: area:display

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

@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 00dbc209

Blockers:

  • Hosted pull_request CI workflows (Apple build and KUnit, Apple DRM KUnit, Host tests, pr-text) are completed/action_required awaiting maintainer workflow approval for this fork PR; only pr-readiness has executed at 00dbc209.

Checked:

  • drivers/gpu/drm/apple/apple_drv.c (apple_drm_init_dcp()) and tools/testing/selftests/drivers/gpu/apple-dcp/lifecycle.py.
  • Verified the two-pass loop (pass = 0 without hdmi-hpd-gpios, pass = 1 with hdmi-hpd-gpios) visits every usable DCP node once, preserves the num_dcp / dcp[] / crtc_mask[] alignment passed to apple_probe_typec_ports(), and leaves non-HDMI hardware order unchanged.
  • Verified J314s M1 Pro hardware evidence (00dbc20914e4 / c397c4d6f188, 3 rounds of verify/kvm-repro.sh 0x3f 8 1, 0 "cannot follow" errors, 0 Hyprland aborts).
Evidence
  • Workflow runs at 00dbc20914e437b0d2d6158071cf4986422fec64: pr-readiness (pull_request_target) succeeded; Apple build and KUnit, Apple DRM KUnit, Host tests, and pr-text (pull_request) are completed/action_required; pull_request_target build/test workflows skipped as expected for fork PRs.
  • Once fork CI workflows are approved and pass green at 00dbc209, this is ready to approve.

@Ante042

Ante042 commented Nov 30, 2026

Copy link
Copy Markdown
Contributor Author

Also ran this on other MacBook Pros, against main ea7aa36 built the same way, no external displays attached. M2 Max (3 boots with this, 3 with main) and 16-inch M4 Pro (2 and 1) have the HDMI pipeline: with this commit its CRTC and connector are created last there too, and they boot to the desktop with the same omarchy-m-test results as main and no new kernel errors. The 14-inch M4 Pro and the M3 Max have no HDMI pipeline on main, and nothing changes there.

One difference on the M2 Max, 2 of 2 boots: the panel's first mode set during boot is the notch-free 3456x2160 that the console gets, where main's first one is 3456x2234. The desktop then sets 3456x2234 as on main, and the screenshots match. I haven't looked into why the order of those first two mode sets moves.

The switch-away case itself still needs an external display, so that's only tested on the J314s.

@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 00dbc20914e4

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: - drivers/gpu/drm/apple/apple_drv.c (apple_drm_init_dcp()) and tools/testing/selftests/drivers/gpu/apple-dcp/lifecycle.py.

  • Verified the two-pass loop (pass = 0 without hdmi-hpd-gpios, pass = 1 with hdmi-hpd-gpios) visits every usable DCP node once, preserves the num_dcp / dcp[] / crtc_mask[] alignment passed to apple_probe_typec_ports(), and leaves non-HDMI hardware order unchanged.
  • Verified J314s M1 Pro hardware evidence (00dbc20914e4 / c397c4d6f188, 3 rounds of verify/kvm-repro.sh 0x3f 8 1, 0 "cannot follow" errors, 0 Hyprland aborts).

Follow-ups (not blocking): fork CI workflow approval

@RyanTheTide

Copy link
Copy Markdown
Contributor

Merging at 00dbc20914e4 (B2 merge train, 12-01 merge bar). Approval at this head: aurora-silicon-review[bot]. Row: the hardware row at 00dbc20 that the readiness check found (PR body or comment). CI: linux train L4 = main (after L3) + 34 approved PRs (#3419 dropped: conflicts): Apple driver compile pass, Apple DTBs W=1 pass, planned KUnit ane-boot/clpc/ane-pm/dcp-fabric/dcp-topology/dcp-display/macaudio/asahi/sep all pass, host tests apple-dcp + apple-scaler-recovery pass (the red host-tests on some heads were base failures since fixed on main). The rest of the hosted run is queued behind the backlog. Revert: git revert -m 1 <merge commit>.

@RyanTheTide
RyanTheTide merged commit ef1be0b into aurora-silicon:main Dec 1, 2026
27 checks passed
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) 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.

2 participants