Skip to content

drm/apple: dpavservep: no EDID discovery wait without a sink - #1812

Closed
RyanTheTide wants to merge 1 commit into
mainfrom
bootperf3/dpavserv-no-startup-wait
Closed

RyanTheTide wants to merge 1 commit into
mainfrom
bootperf3/dpavserv-no-startup-wait

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Problem. dpavservep_init() waits up to 1 s for a legacy EDID service announcement on every display processor without a panel, so that an early announcement can come before get_modes. Without a sink attached the announcement does not come in that window, so each such processor's start ends on the timeout. appledrm registers only after every processor is up, and the boot waits for that device in the initramfs. This affects every Mac whose external processors run legacy (non-AFKV2) firmware: the two J616s dcpexts (desktop 26.x firmware), and the dcpexts of the M1 Pro and M2.

Change. Wait only when a sink is present at startup: a Type-C route or cable, or HDMI HPD high. Without one there is no EDID to read yet. The start is marked so that the first announcement, if one arrives later, re-probes a connected sink through dcpavserv_notify_edid(), as the AFKV2 path already does. With a sink present at startup nothing changes, and later legacy announcements (after resume) still do not trigger a probe. The sink check reads hardware state (route, cable, HPD line), not the board or chip.

Testing. J616s, no sink on either dcpext at startup, 3 boots each (kernel monotonic):

milestone fleet69 + #1771 + this change
[drm] Initialized apple 3.25 s 2.61 s
switch-root 3.42-3.44 s 2.48-2.79 s
gdm started (median) 10.04 s 9.78 s (9.51-9.99)

Every boot: SELinux enforcing, 0 failed units, 0 AVC. Rebased check on the current integration tip (0abc2f3): merges without conflicts, and the wait is unchanged there (epic/dpavservep.c:806). The T8122 native26 path added since uses AFKV2 and is not affected.

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. The sink rows:

  • J616s: plug an HDMI sink in after boot, check that it lights up.
  • M1 Pro (HDMI) and M2 (USB-C display): sink attached at boot, check that the EDID is read and nothing else changes.

None of the lab Macs has an HDMI sink attached right now, so the sink rows need someone at the machine. A ready-to-run row script is prepared.

M1 Pro and M2: the same 1 s wait in their logs (without this change)

The non-desktop start calls dpavservep_init() for every processor without a panel (dcp.c:4654) before the IBOOT and DPTX endpoints start, so the gap shows between the system endpoint coming up and the next endpoint:

  • M1 Pro (fleet44, both dcpexts, no sink): "new service powerlog-service" 0.916 s, "new service disp0-service" 1.961 s (+1.045 s), "DCP booted" 1.977 s, [drm] Initialized apple 2.100 s. The internal panel's DCP booted at 0.914 s.
  • M2 (fleet44, dcpext, no sink): "new service powerlog-service" 0.823 s, "new service disp0-service" 1.826 s (+1.003 s), "DCP booted" 1.835 s, [drm] Initialized apple 1.954 s. The panel's DCP booted at 0.829 s; appledrm's module init took 1.14 s (initcall_debug).

Expected with this change: the dcpexts are up about 1 s earlier on both, so appledrm registers right after the panel's DCP instead.

J616s timeline detail
milestone fleet69 + #1771 + this change
firmware endpoints listed 2.06 s 2.45 s
DCPAVSERV "no legacy EDID service within 1 s" @ 3.10 s "no sink at startup, no discovery wait" @ 2.50 s
endpoints started 3.11 s 2.50 s

The gap from "firmware endpoints listed" to "endpoints started" drops from about 1.03 s to about 0.05 s on each dcpext. The "no sink at startup" message fired on both dcpexts every boot (appledrm.dyndbg=+p).

Why a sink plugged in after boot still gets its EDID

Without a sink at startup the state after this change is the state the 1 s timeout already left: no EDID service published yet. The J616s firmware never sent the announcement within the window in any boot, with or without a sink, so for it the hotplug path after boot is the one that runs today. If an announcement does arrive later, dcpavserv_init() publishes the service as before and, because the start was marked, calls dcpavserv_notify_edid(), which re-probes only a registered, connected connector with modes. A connector that is not connected yet reads the EDID through the published service on its first get_modes, as it would after a late announcement today.

dpavservep_init() waits up to 1 s for a legacy EDID service
announcement so that an early one can precede get_modes. On the J616s
dcpexts (desktop 26.x firmware) the announcement never comes, with or
without a sink, so each external processor's start ends on that
timeout: "DCPAVSERV: no legacy EDID service within 1 s" 1.03 s after
the firmware endpoints are known, and appledrm registers only then.

Wait only when a sink is present at startup (a Type-C route or cable,
or HDMI HPD high). Without one there is no EDID to read yet; mark the
start so that the first announcement, if one arrives, re-probes a
connected sink through dcpavserv_notify_edid(), as the AFKV2 path
already does. With a sink present at startup nothing changes, and
later legacy announcements (resume) still do not trigger a probe.

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 #1771 merge cleanly on top of it, so no rebase is needed. Since this PR was opened, integration returns before the discovery wait for every AFKV2 endpoint (ep->wire_v2: J613 ext26, v27, H17P external). The new sink check therefore only applies to the legacy wire, which is what it targets.

The legacy discovery wait is also reached through the unstable_edid && !dcp_has_panel() path (the parameter defaults to on), which covers the M1 Pro and M2 HDMI processors, and through the T6030 v14.7 external. On those Macs, a boot with no sink can now skip up to 1 s as well. The M1 Pro and M2 rows should therefore include a boot with no external display (check the timing and the new "no sink at startup" line) as well as a boot with an HDMI monitor attached (modes and EDID unchanged).

Build: integration 0abc2f3 + #1771 + #1812, fleet75 config, LLVM=1 (clang 22.1.6), drivers/gpu/drm/apple/ built with 0 warnings. With W=1 there are no new warnings in epic/dpavservep.o or dcp.o.

The distro pre-pivot waits are dropped in fedora-aurora#418, alarm-aurora#346 and nixos-aurora#327, which depend on this PR.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Changes needed at 2c21581.

  1. host-tests apple-afkv2 fails because of this change. extract-notify.py:45 asserts that a legacy (non-AFKV2) endpoint does not queue a re-probe, and dpavservep.c:29 drops that guard. Extracting the helper from this branch merged on integration and running the test gives Assertion 'queued==1' failed; the integration source passes. Update the test to the new contract, or keep the guard in dcpavserv_notify_edid() and let the late legacy path in dcpavserv_init() (:153-154) bypass it explicitly.
  2. dpavservep.c:820 and :134-135: late_notify is only cleared when an announcement arrives. On a firmware that never announces it stays set, so an announcement after resume does trigger a probe, which the commit message says it does not. Clear it when the start takes the wait path, or when the endpoint is torn down.
  3. dpavservep.c:771-776: on a Mac with no HDMI HPD GPIO, the sink check depends on the Type-C state already being known when the endpoint starts. A USB-C display attached at power-on whose Type-C report lands after this point skips the wait. Then the late notify is used up while the connector may not be registered yet (:29-35). The M2 row with a USB-C display attached at boot should show the EDID read (not the fallback timing list).
  4. Please drop the Assisted-by: LLM trailer from the commit message.

Rows still owed at this head: J616s HDMI plug after a sinkless boot; M1 Pro with HDMI attached at boot; M2 with a USB-C display attached at boot (EDID modes and properties unchanged).

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 2c21581f02b8. A legacy service that arrives after an empty-link boot is published normally and consumes late_notify under the same lock. Please add an attach-between-sink-check-and-announcement row and verify EDID with the monitor already present at startup. The held connector checks can suppress the rescan before modes or registration exist, so the first later hotplug must still pick up the service. The J413 timing row has the other display-start patches applied.

@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 2c21581f024d9c9e5c0e388e15a3019152b307df:

  • §1 No model gating, §3 Safety, §6 Naming: Pass — sink detection checks hardware/route state (active_typec_route, typec_cable_connected, hdmi_hpd) rather than chip/board IDs.

Blockers

  1. CI failure (host-tests / apple-afkv2):

    • host-tests fails with notify.c:42: Assertion 'queued==1' failed (exit 134). Removing !service->ep->wire_v2 from dcpavserv_notify_edid() (drivers/gpu/drm/apple/epic/dpavservep.c:28) breaks tools/testing/selftests/drivers/gpu/apple-afkv2/extract-notify.py:45, which enforces that legacy non-AFKV2 endpoints do not queue a re-probe through dcpavserv_notify_edid().
    • Either keep the wire_v2 guard for normal callers and explicitly bypass it only for the one-shot late_notify path, or update the selftest and contract together so host-tests passes.
  2. §4 Clean-room & attribution (hard rule) — forbidden AI trailer in commit message:

    • Commit 2c21581f024d contains Assisted-by: LLM in its commit trailers. Commits must carry human identity and human Signed-off-by: only (zero AI trailers in commits; keep Assisted-by: in the PR body only).
  3. §2 / Correctness — stale late_notify across resume/teardown and GPIO error polarity:

    • dcp->dcpavserv.late_notify is only cleared inside dcpavserv_init() when an announcement arrives. It is never cleared when dpavservep_init() takes the wait path, in dcpavserv_teardown(), or in dpavservep_detach(). On firmware that never announces at boot (such as J616s desktop 26.x), late_notify stays true, so a later announcement after resume/re-init will spuriously call dcpavserv_notify_edid() — contradicting the commit message's claim that later legacy announcements on resume do not trigger a probe.
    • In dpavserv_sink_at_startup() (dpavservep.c:774), gpiod_get_value_cansleep(dcp->hdmi_hpd) > 0 treats a negative GPIO read error as "no sink" and skips the discovery wait. Use != 0 so a read error conservatively preserves the discovery wait (consistent with #1771).
    • Also verify the startup race on Type-C-only dcpexts where Type-C cable/route state lands after dpavserv_sink_at_startup() and a legacy announcement arrives before connector registration / nr_modes > 0, consuming late_notify while dcpavserv_notify_edid() returns early.
  4. §5 Evidence — all sink hardware rows still pending:

    • None of the sink rows listed under "Still to run" have been executed: J616s HDMI hotplug after a sinkless boot, M1 Pro with HDMI attached at boot, and M2 with a USB-C display attached at boot (verifying real EDID modes rather than fallback timings, with 0 kernel errors, 0 AVC denials, and 0 failed units).

@github-actions github-actions Bot added area:display Area from CODEOWNERS (bot) changes-requested A reviewer requested changes (bot) ci-failing A check failed at the PR head (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 2c21581f: not ready yet

Check Detail
CI at head no failing: host-tests
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 2c21581f, 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 2c21581f024d

Blockers:

  1. CI is red: host-tests fails at notify.c:42: Assertion 'queued==1'. Removing !service->ep->wire_v2 from dcpavserv_notify_edid() (epic/dpavservep.c:28) breaks apple-afkv2/extract-notify.py:45, which checks that legacy endpoints don't queue a notification. Fix: keep the legacy case, or update the selftest if the new behaviour is intended.
  2. The commit 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

Rows before merging: one boot at the new head on a J616s and one on an M1 Pro or M2 (both have legacy external processors): no sink at boot, then a display hotplugged.

Checked: no Apple material, no gates.

Evidence

Read 2c21581f and the failing host-tests run.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Replaced by #3127: 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) ci-failing A check failed at the PR head (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