Repository navigation
drm/apple: external DP/HDMI audio on firmware-27 classic-layout DCPs (Mac mini M2) - #3050
RyanTheTide wants to merge 4 commits into
Conversation
dcp_is_v27_external() was true for every firmware-27 DCP with DPTX ports. It is meant for the T6050 and firmware-27 T6041 DCPEXTs, whose ports are on DPTX_ENDPOINT_V2 and whose DP/HDMI audio service is the desktop one, compact EPIC on endpoint 0x2b. The T8112 DCPs (Mac mini M2) on 27.2 firmware advertise the classic layout, ports on DPTX_ENDPOINT. On them 0x2b announces only dcpdptx-hdcp-interface, and the audio service is the classic dcpav-audio-interface-epic on AV_ENDPOINT (0x29), as macOS binds it on the same machine. Taking the desktop role there waited on 0x2b for an audio service that never comes: no audio service started, the ELD stayed empty, and the HDMI and DP jacks stayed off. Take the desktop role only where the DPTX ports are on DPTX_ENDPOINT_V2 as set at probe, so that the DP audio driver, which binds before the DCP starts, sees the same role as the DCP. Every other firmware-27 DCP takes the classic audio service on AV_ENDPOINT with the firmware-27 command table. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
PipeWire and PulseAudio probe a PCM once when its card appears and drop the output for good if the open fails, which is why an unplugged sink already opens with a fixed hardware description. A plugged sink's open reads its elements and product attributes from the DCP audio service. On the Mac mini M2 (27.2 firmware) the HDMI DCP's firmware announces that service again while the display link is set up again at boot, and stops and restarts it meanwhile; a read in that window fails. The open failed with it, PipeWire's first probe of that card fell in the window, and the HDMI output never got its HiFi profile, although the ELD and jack came up a few seconds later. A restart of PipeWire after that showed the profile and an available HDMI port on both cards. Open as for an unplugged sink when the sink info cannot be read. The stream then runs as an unplugged one does, until the next open. tools/asahi/dcpaud-open-fallback-tests.py runs the real dcp_pcm_open() over plugged, unplugged, restarting and refused sinks and a DMA failure, and kills two mutations. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Independent review at
R15d on J473 can settle the profile-at-boot symptom. The classic 13.x/14.x and desktop-role regression rows are still needed after the final source change. Assisted-by: LLM (Codex) |
|
J473 boot row with both commits (
Follow-up, cosmetic: in this boot the ELD monitor name was still empty when the snapshot was taken. The name arrives with the reconnect after the mode is set, and an earlier row showed |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Pre-PR §1–§6 review at cf3d0b9b973e7e6c76b0dcd34ac4a61733a13711 against integration/aurora (c67c44a5ca).
Blockers
-
Merge conflict & missing exact-head CI
- The PR is currently
CONFLICTINGwithintegration/auroraintools/asahi/run-host-tests.py(wheredpavserv-admission-tests.pylanded in the same hunk), andcf3d0b9b97has 0 check runs / 0 commit statuses. Rebase onto currentintegration/aurora(which also now carries #2853 and #2868) and get clean exact-head CI.
- The PR is currently
-
Code correctness —
dcp_pcm_open()fallback breaks theopen_unplugged⇒!dcpaud_connection_up()invariant (drivers/gpu/drm/apple/audio.c)- Previously,
dcpaud->open_unpluggedcould only betruewhen!dcpaud->connectedat open time, sodcpaud_connection_up(dcpaud)was guaranteedfalsefor the lifetime of that open. Settingdcpaud->open_unplugged = trueondcpaud_read_remote_info() < 0whiledcpaud->connected == trueleavesdcpaud->open_cookie == dcpaud->connection_cookie, sodcpaud_connection_up()returnstruefor anopen_unpluggedstream:- Classic path (
dcp_pcm_hw_free,audio.c:599): only checksif (!dcpaud_connection_up(dcpaud))and omitsdcpaud->open_unplugged. When WirePlumber closes/frees after hitting the fallback,dcp_pcm_prepare()was skipped, yetdcp_pcm_hw_free()sends a spuriousdcp_audiosrv_unprepare()RPC (group 0 cmd 11). This already fired in the latest J473 boot log (group 0 cmd 11, retcode 0xe00002d7— product attributes isgroup 1 cmd 18, which wasn't reached aftergroup 1 cmd 16failed;group 0 cmd 11iscmds.unprepare). - Native-link path (
dcp_pcm_native_trigger/dcp_pcm_native_start,audio.c:1181,1254):dcp_pcm_native_open()callsdcp_pcm_open(), so native-link Macs (T6030 / T6041 / T6050 / J700) inherit this fallback. Ifdcpaud_read_remote_info()fails while connected,dcp_pcm_native_hw_params()anddcp_pcm_native_prepare()skipdcpaud_select_cookie(), DMA slave config, anddcpaud_link_prepare()becauseopen_unpluggedistrue, butdcp_pcm_native_start()does not checkdcpaud->open_unpluggedat all (only!dcpaud_connection_up(), which istrue). Starting that stream will calldcpaud_link_prepare()/DCP_AUDIO_LINK_STARTwith a zero/staleselected_cookieand unconfigured DMA.
- Classic path (
- Broad error masking (§2): catching every
ret < 0fromdcpaud_read_remote_info()turns persistent or transport/allocation failures (-ENOMEM,-ETIMEDOUT, persistent-EIO) into a silently succeeding void stream. Distinguish transient service unavailability/restart from persistent errors, guard bothdcp_pcm_hw_free()anddcp_pcm_native_start()(or invalidateopen_cookie/ handleopen_unpluggedconsistently across all PCM ops), and extendtools/asahi/dcpaud-open-fallback-tests.pybeyonddcp_pcm_open()alone to coverhw_freeand native-start behavior. - Also worth checking in
drivers/gpu/drm/apple/av.c: on the classic path,av_audiosrv_init()/av_audiosrv_teardown()never clearasrv->is_open, and__av_service_disconnect()returns early ifasrv->srvis alreadyNULL. If the firmware replacesDCPAVAudioInterfacewhileasrv->is_openstaystrue,av_service_connect()skipscmds.openon the new instance.
- Previously,
-
Code correctness & ABI —
dcp_is_v27_external()conflates endpoint layout (0x2bvs0x29) with link payload & lifecycle (drivers/gpu/drm/apple/dcp-internal.h,drivers/gpu/drm/apple/av.c)- Returning
falsefromdcp_is_v27_external()on J473 switches not only the endpoint/transport (0x29classic EPIC vs0x2bcompact EPIC inav.c:1404andafk.c:530,539), but also turns offdcp_audiosrv_native_link()(av.c:309,322),dcp_audiosrv_link_by_format()(av.c:314,564), andav_v27_start()(av.c:873,1079). - That sends J473 through legacy
dcp_audiosrv_prepare()/dcp_audiosrv_startlink()with a 24-byteElementDatacookie (and 16 KiBDCPAUD_ELEMENTS_MAXSIZE), whereas the PR notes "macOS describes the stream by format here, as on T6050" and playback has not been tested yet. Prove working playback on both ports and decouple link payload/lifecycle selection from endpoint layout if firmware-27 classic requires format-based links. - Minor config note:
av.c:1455still guardscase DCP_FIRMWARE_V_27_0:under#if IS_ENABLED(CONFIG_DRM_APPLE_DCP_T6030_AUDIO), so disabling that option breaks classic firmware-27 audio with-ENODEV.
- Returning
-
§1 No model gating —
dcp->hw.dptx_endpoint == DPTX_ENDPOINT_V2at probe acts as a two-SoC allowlist and silently changes other firmware-27dcpexts- At probe,
dcp->hw.dptx_endpoint = DPTX_ENDPOINT_V2is only populated forapple,t6050-dcpextandapple,t6041-dcpext(dcp.c:7626,10431). Every other compatible leavesdptx_endpoint == 0(whichdcp-internal.h:316anddptxep.c:1645define as firmware 27's defaultDPTX_ENDPOINT_V2unlessdcp_v27_dptx_layout()overrides it from RTKit's endpoint map) orDPTX_ENDPOINT(apple,t8142-dcpext). - Consequently, this predicate silently flips
t8142-dcpext(M5 Air / J704) andt8122-dcpext(M3 on 27.2) out ofdcp_is_v27_external()without any hardware evidence on those machines, and misclassifies any future firmware-27dcpextrelying on the0default. Either derive the audio endpoint/role from what the firmware advertises (or a dedicated capability/DT property rather than overloading probe-timedptx_endpoint), or prove and document behavior ont8142-dcpextandt8122-dcpextas well.
- At probe,
-
§5 Evidence — incomplete for a non-draft PR
- The J473 two-commit boot row (
r15d) confirms read-back enumeration and0 AVC / 0 failed units, but:- Actual DP/HDMI audio playback on both J473 ports has not been run yet (and
group 0 cmd 11failed with0xe00002d7in that boot). - Missing regression rows (
0 SELinux denials, 0 failed units, 0 new kernel errors) on the rebased head for: J473 playback, a 13.x/14.x HDMI Mac, a desktop-role firmware-27 Mac (t6050/t6041/ J616s), and the newly affectedt8142-dcpext/t8122-dcpextif their predicate result changes.
- Actual DP/HDMI audio playback on both J473 ports has not been run yet (and
- Until those rows and exact-head CI land (or while the fix is still in progress), please convert to draft or land the fixes + evidence before merge.
- The J473 two-commit boot row (
Passing Checklist Items
- §3 Safety: Pass — external DP/HDMI digital audio only; no speaker amp /
speakerguarddor hardcoded safety limits touched. - §4 Clean-room & Attribution: Pass — both commits carry human author/committer (
Ryan Murray <ryan@aurorasilicon.org>) and humanSigned-off-by:with zero AI trailers; based on own ioreg capture and lab traces; PR body includesAssisted-by:. - §6 Naming: Pass — no Honeykrisp/
hk/m1n1naming violations; new host test follows the existingtools/asahi/harness layout.
Assisted-by: LLM (Gemini 4 Neon)
The previous change opened a PCM as unplugged on any failure to read the sink info. That masked persistent errors as a silent stream, and it left the open's cookie live, so dcp_pcm_hw_free() and the native start took the sink as connected for a stream that never prepared a link. What fails at boot on the Mac mini M2 is a call to an audio service instance the firmware is replacing: it refuses it as offline and publishes the successor within a second, as dcp_audiosrv_open() already handles for the open itself. Do the same for the sink info: when the read fails and a successor is published within AV_AUDIOSRV_REPLACE_MS, take the sink as the successor reports it and read again from it. Only a service that is gone (-ENODEV) still opens as unplugged, and with a cookie no connection has, so no stream op of that open takes the sink as connected. Any other failure fails the open as before. The host test runs the real dcp_pcm_open() and dcpaud_connection_up() over nine cases and kills four mutations. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Thanks for the reviews. The PR stays a draft. State at 1. Conflict. Fixed with a merge of 2. PCM open fallback. Reworked in
3. Link payload and lifecycle. You were right that enumeration proves nothing about playback. I ran a silent row: 4 s of zero samples through each sink on fleet87. It fails, but before the link question can even be tested:
4. t8142 / t8122 dcpext. I checked what the predicate change does there:
The Evidence: |
|
Playback update: the SIO crash comes from the boot loader, not this PR. The J473's 27.2 SIO firmware speaks protocol 10, but aura built it the earlier table layout. With the protocol-10 layout (aurora-silicon/aura#495, tested as a trial Stage 2), zero-sample streams run on both HDMI/DP cards with this PR's appledrm module. The DMA pointer advances at 48 kHz, both DMA channel configs succeed, and the firmware accepts the classic link (ElementData cookie). There is no SIO crash, and the row stayed Enforcing with 0 AVC and 0 failed units. Evidence is So on the J473, firmware-27 classic takes the existing cookie link payload and lifecycle. No format-based link split is needed for this machine. Still open before ready: a playback row with real audio, and the 13.x/desktop-role regression rows. |
|
Re-review at I checked A3’s J473 receipt. With the trial Aura SIO tables, the classic cookie route was accepted and both display PCM streams returned 0. Each pointer advanced from 31,744 to 200,192 frames during the silent run, with no SIO crash. That answers the link payload question for the tested pair. The production signed Aura path and active external-display peer receipts remain to run. Assisted-by: LLM (Codex) |
|
Playback path, production shape ( A -20 dBFS tone row into the monitors' 3.5 mm jacks played (rc 0 on both), but the buildbox line-in recorded nothing on either channel. That cable needs a physical check before an audible-content proof is possible. Assisted-by: LLM (Claude:Opus 5.5) |
Problem
On the Mac mini M2 (J473) with 27.2 firmware, external HDMI and DisplayPort audio did not work. Both DP audio cards existed, but the audio service never started, the ELD stayed empty, both jacks read off and PipeWire offered no HDMI output.
dcp_is_v27_external()matched every firmware-27 DCP that has DPTX ports. It is meant for the T6050 and firmware-27 T6041 DCPEXTs, whose audio service is the desktop one (compact EPIC on endpoint 0x2b). The T8112 DCPs on 27.2 advertise the classic layout instead. On them 0x2b only carriesdcpdptx-hdcp-interface, and the audio service isdcpav-audio-interface-epicon endpoint 0x29, the same place macOS binds it on this machine (our own ioreg capture of the J473 on 27.2). The driver waited on 0x2b for a service that never comes.With that fixed, a second problem showed up. The HDMI DCP's firmware stops and restarts its audio service while the display link is set up again at boot. A PCM open in that window failed, PipeWire's one probe of that card fell in it, and the HDMI output never got its HiFi profile.
Change
DPTX_ENDPOINT_V2as set at probe, i.e. firmware 27's own layout. Every other firmware-27 DCP uses the classic audio service onAV_ENDPOINTwith the firmware-27 command table. The value is read as set at probe, because the DP audio driver binds before the DCP starts and both sides must agree on the role. There is no new SoC, board or firmware check: the role follows the endpoint layout the driver already keeps.dcp_pcm_open()opens the PCM as for an unplugged sink instead of failing. Unplugged sinks already open this way for the same reason: userspace drops an output for good if the first open fails.Testing
[Out] HDMI1available, jacks on and valid ELDs at boot, with no PipeWire restart. The firmware refused the sink-info reads at the moment WirePlumber probed the HDMI card, and the open fallback kept its profile. Enforcing, 0 AVC, 0 failed units.integration/aurora7946d189+ linux#2853 + linux#2868 + linux#2953 and the first commit as an appledrm module. Both DCPs announceDCPAVAudioInterfaceon endpoint 0x29 and start the audio service withplugged:1. BothHDMI/DP Jackcontrols read on. Both ELDs are valid: the Acer QG270 S3 (HDMI) and the MSI behind the USB-C converter each report LPCM, 2 channels, 32/44.1/48 kHz, 16/20/24 bit. PipeWire offered HiFi with an available HDMI port and a sink on the USB-C card. The HDMI card got HiFi only after a PipeWire restart, which the second commit addresses.tools/asahi/dcpaud-open-fallback-tests.pyruns the realdcp_pcm_open()over five cases and kills two mutations. The Apple DCP host suite passes, including the EDID fixture, which inlinesdcp_is_v27_external(). Apple DRM KUnit: 117 passed, 1 skipped. appledrm builds with W=1 against the fleet tree.Still to run
Evidence and detail
reference/adt/20261122-j473-272-display/ioreg-service.txt): endpoint nodeDCPEndpoint10(0x29) carriesdcpav-video-interface-epicanddcpav-audio-interface-epic, with an audio driver bound per monitor. 0x2b isdcpdptx-hdcp-interfaceonly.AFK[ep:2b]: unable to match compact service dispext*:dcpdptx-hdcp-interface, no ep:29 line, nostarting audio service.AFK[ep:29]: new service DCPAVAudioInterfaceandav_service_connect: starting audio service, plugged:1on both DCPs. On the HDMI DCP the service is announced again at about 15 s and 21 s, and onegroup 1 cmd 16read returns 0xe00002d7 in between. That is the window the second commit covers.HiFiavailable and[Out] HDMI1available.traces/display/20261124-m2mini-display-full/r15andr15c.Assisted-by: LLM (Claude:Opus 5.5)