Skip to content

drm/apple: dcp: no startup link wait on an HDMI output without a sink - #1771

Closed
RyanTheTide wants to merge 1 commit into
mainfrom
bootperf2/dcp-hdmi-nosink-nowait
Closed

RyanTheTide wants to merge 1 commit into
mainfrom
bootperf2/dcp-hdmi-nosink-nowait

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Problem. On the T6041 HDMI dcpext (desktop 26.x firmware), the start connects DPTX port 0 and then waits up to 2 s (DPTX_CONNECT_TIMEOUT) for a link configuration. With nothing on the HDMI port the firmware never sends one, so the processor's start, and with it appledrm's registration, waits out the whole timeout. The boot waits for the appledrm device in the initramfs.

Change. Read the HDMI HPD line first. With HPD low and no Type-C route on the pipeline, skip the startup connect. Two existing paths connect later: dcp_enable_dp2hdmi_hpd() once the processor is up (it reads HPD again before enabling the interrupt), and the HPD interrupt when a sink is plugged in. With HPD high the startup connect is unchanged. The decision reads the HPD line, so it applies to whatever processor has a fixed HDMI output on this firmware.

Testing. J616s, HDMI empty, eDP plus one USB-C display attached. A is fleet69 (e661192), B the same tree plus this commit, same config, fresh initramfs on both:

A (5 boots) B (3 boots)
[drm] Initialized apple 5.64 s 3.25 s
Switching root 4.79 s 3.42-3.44 s
gdm started (median) 10.98 s 10.04 s

Every B boot: HDMI-A-1 disconnected, eDP and DP-2 connected and enabled, SELinux enforcing, no failed units, no AVCs. On the current integration tip (0abc2f3) the change merges without conflicts and dcp_start_desktop_external() still ends in the same startup connect (dcp.c:4446).

Testing (J616s, hardware, together with #1771, #1812 and #2337). J616s (T6040), HDMI empty, no external display, production kernel 7.3.0-aurora-fleet75. Only the appledrm module changes: A is the production source rebuilt the same way, B is the same plus #1771, #1812 and #2337. Each arm boots a one-shot test initramfs entry; 5 boots each, alternating, kernel monotonic, median (min-max):

[drm] Initialized apple (s) last "DCP booted" to registration (s) switch root (s) gdm started (s)
A 5.420 (5.272-5.720) 0.073 (0.002-0.240) 4.121 (4.056-4.820) 10.837 (10.609-11.341)
B 2.130 (2.079-2.131) 0.025 (0.022-0.032) 2.779 (2.485-2.794) 9.294 (9.013-9.401)

All ten boots: SELinux enforcing, no failed units, no AVC denials, no kernel errors.

Testing (M2, hardware, together with #1771, #1812 and #2337). M2 (T8112, J413), no external display, production kernel 7.3.0-aurora-fleet74, same module-only A/B (A production source rebuilt, B plus the three changes), one-shot test initramfs entries, 3 boots each, alternating, median (min-max): [drm] Initialized apple 2.089 (2.082-2.095) -> 0.960 (0.943-0.980) s; last "DCP booted" to registration 0.126 -> 0.032 s; switch root 2.394 -> 1.734 s; gdm started 6.393 (6.369-6.415) -> 5.662 (5.661-5.736) s. All six boots: SELinux enforcing, no failed units, no AVC denials, no kernel errors.

Testing (M1 Pro, hardware, together with #1771, #1812 and #2337). M1 Pro (T6000, J316s), no external display, production kernel 7.3.0-aurora-fleet74. Only the appledrm module changes: A is the production source rebuilt the same way, B is the same plus #1771, #1812 and #2337. Each arm boots a one-shot test initramfs entry; 3 boots each, alternating, kernel monotonic:

[drm] Initialized apple (s) last "DCP booted" to registration (s) switch root (s) initrd (systemd-analyze)
A 2.168 (2.166-2.175) 0.127 (0.125-0.135) 2.49 (2.35-2.54) 2.07-2.25 s
B 1.050 (1.047-1.072) 0.039 (0.034-0.048) 1.74 (1.69-1.79) 1.42-1.46 s

gdm started at 5.42-5.53 s in all three B boots. All six boots: SELinux enforcing, no failed units, no AVC denials, no kernel errors. The rows measure the three changes together; the split per change is what the logs above predict (the 1 s EDID-service wait on each dcpext, the 100 ms sleep).

Still to run. Plug an HDMI sink in after boot and check that it lights up. The code path it takes is described below; it has not run on hardware after a sinkless start. None of the lab Macs has an HDMI sink attached, so this needs someone at the J616s. A ready-to-run row script is prepared.

What a sink plugged in after boot goes through
  1. Start without a sink: dcp_start_desktop_external() reads HPD low and returns before dcp_dptx_connect(), so dptxport[0].connected stays false. Before this change the port was connected here with no sink.
  2. dcp_wait_ready() calls dcp_enable_dp2hdmi_hpd() (dcp.c:4843): it reads HPD again and connects if a sink appeared since the start, otherwise powers the pipe off as before, then enables the HPD interrupt.
  3. Plug: dcp_dp2hdmi_hpd() goes to dcp_desktop_dp2hdmi_hpd() (dcp.c:3045). After the 500 ms debounce HPD reads high, there is no Type-C route, and the port is not connected, so it calls dcp_dptx_connect(dcp, 0), which on this firmware is dcp_desktop_dptx_connect(): connect, display request, HPD asserted, wait for the link configuration.
    Before this change the same plug found the port connected and took the "HDMI cold plug" branch (HPD pulse on the link that had been up since the start).
  4. The connect branch in step 3 is the one an HDMI replug already takes after an unplug (commit d72a164: the unplug disconnects port 0, the next plug connects it), and the same connect a boot with a sink attached runs at start. So no new code runs; what needs hardware is that the first connect after a sinkless start lights the sink.

Note: the comment at dcp-peer-v26_6.inc:208-212 says the fixed HDMI path brings the DPTX link up at start without a sink. After this change it does not, but dcp_peer_hdmi_sinkless() checks only the connector, so peer eligibility is unchanged.

Timeline detail (J616s)
A (5 boots) B (3 boots)
HDMI dcpext "endpoints started" 5.63 s 3.11 s
dracut-pre-pivot wall time 2.11 s 1.41 s
initrd (systemd-analyze) 3.87-4.50 s 3.10-3.12 s

With appledrm.dyndbg=+p, B logs "no HDMI sink at startup: no DPTX link yet" for the HDMI dcpext. #1812 removes the remaining 1 s on the same processors (EDID service discovery wait).

On the T6041 dcpext that drives the HDMI port (desktop 26.x firmware),
dcp_start_desktop_external() connects DPTX port 0 at startup and
dcp_desktop_dptx_connect() then waits up to DPTX_CONNECT_TIMEOUT (2 s)
for a link configuration. Without a sink the firmware never sends one,
so the processor's start, and with it appledrm's registration, is held
back by the whole timeout. On the J616s the HDMI processor finishes its
start about 1.8 s after its last endpoint comes up, and the DRM device
appears at 5.6 s after kernel start with nothing on the HDMI port.

Read the HDMI HPD line first. With HPD low and no Type-C route on the
pipeline, skip the startup connect: dcp_enable_dp2hdmi_hpd() connects
once the processor is up if a sink appeared meanwhile, and the HPD
interrupt connects a sink plugged in later, as it already does after a
start with no sink. With HPD high the startup connect is unchanged.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Checked against the current integration/aurora (0abc2f3): this PR and #1812 merge cleanly on top of it, in either order (3 files, +41/-4 combined), so no rebase is needed.

Build: integration 0abc2f3 + #1771 + #1812, fleet75 config, LLVM=1 (clang 22.1.6), modules_prepare + drivers/gpu/drm/apple/ (appledrm.o) built with 0 warnings. With W=1, dcp.o and epic/dpavservep.o give the same two existing kernel-doc warnings (dcp.c:774) with and without the patches, so nothing new. Both new dyndbg strings are present in appledrm.o.

The distro pre-pivot waits for appledrm's card are dropped in fedora-aurora#418, alarm-aurora#346 and nixos-aurora#327. Those PRs depend on this one and #1812 being in the shipped kernel.

Still open before this leaves draft: plug an HDMI sink into the J616s after boot and check that it lights up.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Adversarial pass at 12bf2b3: no code blockers.

Checked: the skip depends only on the HPD GPIO read with no Type-C route (dcp.c:4509-4513 on current integration), the HDMI converter is powered from probe so the read is meaningful at start, a GPIO error keeps the old connect, a sink that appears during the start is connected by dcp_enable_dp2hdmi_hpd() (:4946-4956), and a later plug now takes the dcp_dptx_connect() branch of dcp_desktop_dp2hdmi_hpd() (:3112), the same branch an unplug/replug takes today. No firmware-readiness step depended on the removed connect.

  • Please drop the Assisted-by: LLM trailer from the commit message; the trailers should be the Signed-off-by only.
  • Still owed: J616s at this head, boot with HDMI empty, then plug an HDMI display and check it lights in its native mode with no "no DPTX link" line. That is the only path this change makes new at runtime.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide RyanTheTide left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Review at 12bf2b3dbead. The early return requires a fixed HDMI route with an HPD GPIO reporting low. Missing GPIO, read errors and a selected Type-C route keep the existing connect path. Please record a fixed HDMI boot with a sink attached and one plug-in after an empty boot, showing that initial HPD sampling and the later IRQ both bring up the link. The combined J413 startup row does not exercise that fixed-port path.

@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 checklist review at 12bf2b3dbe36f20dc20a213da98d4b3d5d872605:

  • §1 No model gating: Pass — gates the startup skip on hardware state (!dcp->active_typec_route && dcp->hdmi_hpd && !gpiod_get_value_cansleep(dcp->hdmi_hpd)), with no chip/SoC/board gating. Negative GPIO read errors safely evaluate !err == false and keep the existing connect path.
  • §2 Production-ready, §3 Safety, §6 Naming: Pass; host-tests CI is green and the patch merges cleanly on current integration/aurora.

Blockers

  1. §4 Clean-room & attribution (hard rule) — forbidden AI trailer in commit message:

    • Commit 12bf2b3dbe36 contains Assisted-by: LLM in its commit trailers. Per §4 of the pre-PR checklist, commits must carry human identity and human Signed-off-by: only (zero Assisted-by or agent trailers in commits; keep disclosure at the end of the PR body only). Please amend the commit to remove Assisted-by: LLM.
  2. §5 Evidence — new runtime HDMI hotplug and attached-at-boot paths unverified on hardware:

    • All recorded J616s boots had an empty HDMI port (and the M2/M1 Pro rows do not execute dcp_start_desktop_external()).
    • As noted under "Still to run", the new runtime transition introduced by this PR — starting with dptxport[0].connected == false after a sinkless boot and bringing up the link via dcp_desktop_dp2hdmi_hpd() -> dcp_dptx_connect() when an HDMI sink is plugged in later — has not yet been tested on hardware, nor has a boot with an HDMI sink already attached (confirming HPD high preserves startup connect).
    • Please add J616s hardware verification for post-boot HDMI hotplug after a sinkless boot and boot-with-HDMI-sink-attached, with 0 kernel errors, 0 AVC denials, and 0 failed units.

Non-blocking nit: The comment at drivers/gpu/drm/apple/dcp-peer-v26_6.inc:208-212 still states that the fixed HDMI path brings the DPTX link up at startup without a sink.

@github-actions github-actions Bot added area:display Area from CODEOWNERS (bot) changes-requested A reviewer requested changes (bot) needs-hw-row No hardware row at the PR head (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 12bf2b3d: not ready yet

Check Detail
CI at head ok 1 check passed
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes no requested by DjDeveloperr
Hardware row at head no no line with the head SHA 12bf2b3d, a Mac and a result in the PR body or a comment
Conflicts ok not computed yet
PR text adopt when you next edit add a 'Tested:' line; a 'Risk:' line (door and Macs) (guide)

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 12bf2b3dbe36

Blockers:

  1. Commit 12bf2b3d carries an Assisted-by: LLM trailer; the snippet below drops it.
git fetch origin
FILTER_BRANCH_SQUELCH_WARNING=1 git filter-branch -f --msg-filter "grep -viE '^(assisted-by:|(co-authored-by|signed-off-by):.*(claude|copilot|codex|gemini|cursor|openai|anthropic)|[^a-z]*generated with)' | git stripspace" origin/main..HEAD
git push --force-with-lease
  1. Missing row: one boot with an HDMI sink attached at power-on and one hotplug after boot on two HDMI Macs from different generations (for example an M1 Pro and an M2 Pro), with no startup link wait when nothing is attached.

Checked: no Apple material, no gates.

Evidence

Read 12bf2b3d.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Replaced by #3126: the same change on current main with the commit trailers removed (authorship kept), so no force push here.

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) changes-requested A reviewer requested changes (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) needs-template PR body lacks Tested or Risk (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants