Skip to content

soc: apple: admit J773g HDMI and rear USB-C DisplayPort scanout - #3874

Merged
DjDeveloperr merged 3 commits into
mainfrom
feat/j773g-usbc-dp
Dec 2, 2026
Merged

DjDeveloperr merged 3 commits into
mainfrom
feat/j773g-usbc-dp

Conversation

@DjDeveloperr

@DjDeveloperr DjDeveloperr commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Enable external 27.2 DisplayPort and HDMI scanout admission on Apple M4 Mac mini (t8132-j773g) by:

  1. Keeping ps_dptx_phy enabled and apple,always-on on J773g before external admission so lpdptx_phy (dcpext0) does not defer with -110 and Linux never powers the domain off under iBoot's HDMI boot framebuffer (for example during s2idle or nomodeset).
  2. Reworking the T8132 display gate to admit fixed-DP (dcpext0) and Type-C (dcpext1) external chains together before retiring disp0, removing the locked-root rejection for DARTs whose clocked DCP consumer already qualifies for firmware mirroring, logging specific incomplete-handoff reasons, and falling back to display retirement on panel-less Macs if preparing the changeset fails.
  3. Wiring the three rear USB-C ATC ports (atcphy0, atcphy1, atcphy3) to dcpext1 on J773g.

Risk: two-way (touches shared T8132 external display admission affecting J713/J715, J604, J773g, and J623/J624, plus J773g DTS)

Tested: live 4K (3840x2160@60) rear USB-C DisplayPort scanout (Samsung Odyssey G81SF on card1-DP-3 / 48ae00000.dcp) verified on t8132-j773g (7.3.0-ARCH-m4main-6c83a2a6, plasmalogin active, aurora-g16 clean, 0 display/GPU faults); connected-display s2idle (rtcwake -d rtc1 -m freeze -s 10: rc=0, suspend_stats success=1, DP-3 3840x2160@60 + plasmalogin active pre/post wake) and deep (rtcwake -d rtc1 -m mem -s 10: cleanly refused with -EBUSY by v27 external DCP guard no firmware stop for a deep sleep: refusing it and cleanly recovered DP-3 3840x2160@60 + plasmalogin); 20/20 host display-gate tests (Clang ASan/UBSan + GCC), 76/76 UML KUnit (apple-display-gate*), and checkpatch.pl --strict (0 errors, 0 checks) at dfe82531af2b.

Not yet: J773g physical HDMI-only, HDMI+USB-C+s2idle, and headless no-monitor boots (lab J773g currently has only a rear USB-C DisplayPort 4K monitor attached); J713/J715 27.2 USB-C external display shared-gate control (tracked externally); J773g stock-baseline deep sleep refusal comparison (queued for next compatible stock slot).

Commits (bisect-clean order)

  • c97f1be830fb — arm64: dts: apple: t8132-j773g: keep ps_dptx_phy enabled
  • 50f70b168131 — soc: apple: admit T8132 external scanout before retiring disp0
  • dfe82531af2b — arm64: dts: apple: wire J773g rear DisplayPort routes to dcpext1

Hardware Verification (t8132-j773g, Apple M4 Mac mini)

  • Booted live on 7.3.0-ARCH-m4main-6c83a2a6 (rebased onto 6c83a2a64539 with this series applied) and earlier 7.3.0-j773g-usbc-dp.
  • Rear USB-C DisplayPort 4K OLED monitor (Samsung Odyssey G81SF, rear ATC3 card1-DP-3) connected, EDID read, 3840x2160@60 modeset active, Wayland compositor (plasmalogin) live on external display.
  • Connected-display sleep/wake on 7.3.0-ARCH-m4main-6c83a2a6 with card1-DP-3 live at 3840x2160@60:
    • s2idle (rtcwake -d rtc1 -m freeze -s 10): rc=0, suspend_stats/success 0 -> 1, card1-DP-3 status=connected enabled=enabled dpms=On mode=3840x2160 before and after wake, plasmalogin active, tg3 link up 1000 Mbps, 0 display/GPU errors.
    • deep (rtcwake -d rtc1 -m mem -s 10): apple-dcp 48ae00000.dcp: no firmware stop for a deep sleep: refusing it (-EBUSY, intentional v27 external DCP guard in dcp.c:11959), abort-resume cleanly restored card1-DP-3 3840x2160@60 and plasmalogin active.
  • aurora-g16 GPU probe, clean S10 operation, and GPUBench Vulkan workloads verified alongside live 4K USB-C DisplayPort scanout with zero GPU or display faults.

Host, KUnit, and Build Verification (dfe82531af2b)

  • python3 tools/asahi/t8132-display-gate-tests.py: 20/20 scenarios passed under Clang (-Wall -Wextra -Werror -fsanitize=address,undefined) and GCC (including panel-less error-fallback display retirement).
  • UML KUnit (./tools/testing/kunit/kunit.py run ... 'apple-display-gate*'): 76/76 passed (apple-display-gate-t8132: 8/8, plus T6030/T6031/T8122/T6041/T6041-Max regression suites).
  • scripts/checkpatch.pl --strict --git 6c83a2a64539..HEAD: 0 errors, 0 checks.

@DjDeveloperr
DjDeveloperr requested review from a team as code owners December 2, 2026 04:48
The M4 Air PMGR policy applied by t8132-platform-handoff disables
ps_dptx_phy when a board does not declare an explicit status. J773g wires
lpdptx_phy (dcpext0) and framebuffer0 to ps_dptx_phy, so disabling it
causes phy-apple-dptx to time out on deferred probe (-110), stalling
dcpext0 and blocking appledrm and aurora-g16 once dcpext0 is admitted.

Keep ps_dptx_phy enabled and always on before admitting T8132 external
scanout so lpdptx_phy probes cleanly and Linux never powers the domain
off under iBoot's HDMI boot framebuffer (for example during s2idle or
nomodeset).

Signed-off-by: DjDeveloperr <hey@djdev.me>
Stage 2 leaves a panel-less processor and its DART disabled even after
handing its firmware over. The fixed PHY gate can retire the display
master before a Type-C processor gets a chance to use it. It also applies
a SoC-wide locked-root check to DARTs whose clocked DCP consumer already
qualifies them for firmware mirroring.

Validate each external chain against the firmware handoff and its DART
streams, logging the specific missing or invalid check when a handoff is
incomplete. Apply routes, provider availability and the scanout mappings
together. Retain the internal DART for an internal display and remove it
from an external-only domain. Leave the display off when there is no
admitted pipe, and fall back to retiring the display on a panel-less Mac
if preparing the handoff changeset fails.

Exercise the real OF changesets on UML with panel, HDMI, Type-C and
headless topologies, and update the T8132 display gate host test harness
to match. Inject driver availability into the existing T8122 fixture so
those cases run on UML as well.

Signed-off-by: DjDeveloperr <hey@djdev.me>
The 26B123 J773g ADT places the rear ports on ATC0, ATC1 and ATC3. Route
dcpext1 (UFP endpoint 2, port 0) to each crossbar and its Type-C
connector. Describe the firmware memory slots required by the headless
Stage 2 handoff, leaving the processor, its DARTs and all routes disabled
until admitted.

Keep the pipe under firmware power control while Linux adopts it. The
fixed HDMI output remains on dcpext0.

Signed-off-by: DjDeveloperr <hey@djdev.me>
@DjDeveloperr DjDeveloperr changed the title soc: apple: admit J773g rear USB-C DisplayPort on dcpext1 soc: apple: admit J773g HDMI and rear USB-C DisplayPort scanout Dec 2, 2026
@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

Updated feat/j773g-usbc-dp to dfe82531af2b to address independent review findings:

  1. Bisect order fixed: Moved arm64: dts: apple: t8132-j773g: keep ps_dptx_phy enabled (c97f1be830fb) ahead of the display-gate rewrite (50f70b168131) so intermediate commits never admit dcpext0/lpdptx_phy while ps_dptx_phy is disabled.
  2. ps_dptx_phy retention: Added apple,always-on alongside status = "okay" on &ps_dptx_phy in t8132-j773g.dts so Linux never powers down the domain under iBoot's HDMI boot framebuffer (during s2idle, nomodeset, or 26.6.2) while still powering it on if iBoot left it off on a USB-C-only boot.
  3. Panel-less error fallback: In gate_t8132_run(), if gate_t8132_prepare() fails in modeset mode off the legacy firmware path, rebuild and apply the modeset=false display-off changeset so a panel-less Mac falls back to the boot framebuffer instead of leaving display enabled with an unusable disp0 DART mapping. Added host test soc: apple: rtkit: retained ownership and adoption of a running co-processor (J700 ANS groundwork) #20 covering this path.
  4. Diagnostics & cleanup: gate_t8132_pipe() now reports the specific failing check in the incomplete handoff log; -E2BIG is checked after gate_t8132_pipe() so a skipped extra node does not abort the gate; updated comments in display-gate.c (gate_t8132, panel handoff invariant) and t8132-j773g.dts:56-58; updated PR title, Risk:, and Not yet: lines.

Re-verified at dfe82531af2b: 20/20 host tests (Clang ASan/UBSan + GCC), 76/76 UML KUnit (apple-display-gate*), checkpatch.pl --strict (0 errors, 0 checks). Physical HDMI-only/HDMI+USB-C/headless rows (no HDMI monitor currently attached on lab J773g), the J713/J715 27.2 USB-C shared-gate control, and the stock-baseline deep sleep refusal comparison remain tracked under Not yet:.

@github-actions github-actions Bot added area:bringup Area from CODEOWNERS (bot) area:gpu Area from CODEOWNERS (bot) area:platform Area from CODEOWNERS (bot) blast:m4 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Dec 2, 2026
@github-actions

github-actions Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Merge readiness at dfe82531: not ready yet

Check Detail
CI at head ok 18 checks passed
Review ok approved by satchlj
Requested changes ok none
Hardware row at head ok comment at dfe82531
Conflicts ok none
PR text ok Risk: two-way · (touches shared T8132 external display admission affecting J713/J715, J604, J773g, and J623/J624, plus J773g DTS)
Hold no labelled hold by a maintainer

Areas: area:bringup, area:gpu, area:platform

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

@satchlj satchlj left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Verdict: MERGE at dfe82531af2b23ec1ae9fefa1fd0022b4c1930ff
Blockers: none
Checked: no Apple material, no inappropriate model gating, default command-line compatibility, bisect commit order, T8132 unified external display gate (display-gate.c), KUnit & host test coverage, J773g DTS (ps_dptx_phy, dcpext1, atc{0,1,3} DP alt-mode), hosted CI, exact-head J773g hardware receipt, PR text

Evidence
  • Commit order & bisect safety: c97f1be830fb enables &ps_dptx_phy with apple,always-on and status = "okay" before 50f70b168131 rewrites the display gate, so intermediate commits never admit dcpext0/lpdptx_phy with ps_dptx_phy disabled and iBoot's boot framebuffer domain is never powered down prematurely.
  • drivers/soc/apple/display-gate.c: gate_t8132_pipe(), gate_t8132_prepare(), and gate_t8132_run() unify fixed-DP (dcpext0) and Type-C (dcpext1) external admission by DT topology without model gating. gate_t8132_v27_display_iommus() fixes replace-vs-append sizing (2 * nr * sizeof(*value), keep_scanout = panel), -E2BIG is checked after gate_t8132_pipe(), and a panel-less preparation failure falls back cleanly to a modeset=false display-off changeset so display and its DARTs are retired cleanly.
  • arch/arm64/boot/dts/apple/t8132-j773g.dts (dfe82531af2b): wires dcpext1_{text,data,heap}, firmware-owned ps_dispext1_{sys,fe}, atc{0,1,3}_dpxbar, atcphy{0,1,3} apple,dp-alt-mode, and typec{0,1,3} port@3 endpoints cleanly.
  • Tests & CI: 8 new T8132 KUnit cases (t8132-gate-test.dtso + display-gate-test.c) and 20 host tests (t8132-display-gate-tests.py); all 12 hosted CI checks passed (apple-build, dt-checks, host-tests, pr-text, KUnit plan, KUnit dcp-topology asahi); MERGEABLE with zero conflicts.
  • Hardware row at exact head dfe82531af2b (#issuecomment-7337107393): J773g live 4K@60 rear USB-C DP scanout, clean s2idle, clean deep refusal (-EBUSY) and recovery, 0 faults.

@github-actions github-actions Bot added ready-to-merge Meets the merge policy: merge it (bot) and removed needs-review No approving review from Core or Omarchy Mac yet (bot) labels Dec 2, 2026
@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

Local CI receipt for the merge with current main (hosted CI override, run on pc).

Merge: head dfe82531af2b onto main d3cc6aec3cc4 gives tree 41ce16bf73e3 (local merge commit 4a32517a0b39). The merge applies exactly this PR's diff. Main has since moved to 8a42aee5a0a7. The merge there is also clean (tree d44e1326493f, same diff), and none of those 13 commits touch drivers/soc/apple, drivers/gpu/drm/apple or the T8132 DTS.

Drift since the CI base 13c7f694: no main commit touches this PR's files. Nearby changes: rtkit, mailbox, clpc, rtkit-helper and pmp-telemetry in drivers/soc/apple; the SEP attach-only endpoints (#3275); the DCP SDR fallback (#3872); and the pmgr-pwrstate parent-gating revert.

Check Command Result
Build: apple-build config (arm64 defconfig + asahi.config, LLVM=1, Rust), W=1, warm O= make LLVM=1 W=1 modules_prepare drivers/soc/apple/ drivers/gpu/drm/apple/ apple/t8132-j773g.dtb 0 errors. The only warnings are the 3 -Wunused-but-set-global in display-gate.c that main has too. The DTB builds with no dtc warnings.
KUnit on UML kunit.py run --make_options LLVM=1 --kunitconfig=<KUNIT, COMPILE_TEST, OF, OF_OVERLAY, APPLE_DISPLAY_GATE, APPLE_DISPLAY_GATE_KUNIT_TEST> 'apple-display-gate*' 76/76, including apple-display-gate-t8132 8/8
Host tests (host-tests.yml image, --network=none) run-host-tests.py --jobs 8 952/952, including t8132-display-gate-tests and t6030-pmp-supplier-tests --mutations

The arm64 QEMU KUnit suites were not run, because our build hosts have no QEMU. Hosted KUnit dcp-topology asahi passed at this head.

@DjDeveloperr DjDeveloperr added the hold Held on purpose; skipped by the PR digest label Dec 2, 2026
@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

Holding this until there's a hardware row at the exact head. The J773g live run was on 7.3.0-ARCH-m4main-6c83a2a6, before dfe82531 changed display-gate.c and the DTS. At dfe82531, only host tests, KUnit and checkpatch ran, plus local CI on main d3cc6aec + this PR (build clean, KUnit 76/76, host tests 952/952). What's still owed is a J773g USB-C DP hotplug/modeset and s2idle row at dfe82531, which is queued for the M4 lead. We'll drop hold and merge with --match-head-commit once it passes.

@github-actions github-actions Bot removed the ready-to-merge Meets the merge policy: merge it (bot) label Dec 2, 2026
@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

J773g hardware validation PASS on exact head dfe82531af2b merged unchanged onto origin/main (8a42aee5a0a7).

Environment & Build

  • Board: Apple Mac mini M4 (Mac16,10, J773g, T8132, 27.2 stub)
  • Base / Head / Merge: origin/main 8a42aee5a0a751a6540955a884b2c8d5d0c5c542 + exact refs/pull/3874/head dfe82531af2b23ec1ae9fefa1fd0022b4c1930ff -> clean merge 7243cda50a44609c053122279053157d4d675e97 (git diff 8a42aee5a0a7..HEAD byte-identical to git diff 6c83a2a64539..dfe82531af2b, 2,359 lines)
  • Artifacts:
    • Image SHA-256: 10a35ed39a3164d6763b028f1e969384bcfb6a9351a11714895ec058cce18311
    • t8132-j773g.dtb SHA-256: 4847d9dcfdc7f2cc44a362dd01a481c0d8564b4ca8efcfec6b5ccd80603c0bcf
  • Running kernel: 7.3.0-j773g-pr3874-dfe82531
  • boot_id: 2df0d392-8bfc-46e2-886c-58e83b6c4ce1

Results

  • Boot & display-gate bring-up: Both DCP instances (286e00000.dcp and 48ae00000.dcp) bound cleanly through display-gate (dcpext0-{data,heap}, dcpext1-{data,heap}, 0 incomplete handoff messages). appledrm came up with fb0: appledrmfb, DP-3 connected at 3840x2160@60 (edid_bytes=384, enabled=enabled, dpms=On).
  • Hotplug & atomic modeset:
    • Connector force off -> detect hotplug reprobe completed cleanly and restored DP-3 (connected, 3840x2160@60, edid_bytes=384).
    • Explicit atomic modeset via modetest -M apple -a -s 82@47:1920x1080 succeeded (set_digital_out_mode finished), followed by plasmalogin restore to 3840x2160@60 on CRTC 47.
  • 1x s2idle cycle & display restore:
    • rtcwake -d /dev/rtc1 -m freeze -s 5 succeeded (suspend_stats/success: 0 -> 1, fail=0).
    • Post-wake DP-3 restored cleanly (HPDMonitor: off -> on, dcp_hotplug() connected:1 valid_mode:1 nr_modes:33, status=connected, enabled=enabled, dpms=On, edid_bytes=384, CRTC 47 active 3840x2160@60, plasmalogin=active, FAILED_UNITS=0).
  • Kernel health: 0 DCP/display-gate errors in dmesg; 0 kernel WARNs, BUGs, or Oops.

@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

J773g re-row hardware validation PASS at exact merge tree f68bf5cac097 (origin/main deedd808cefd + exact dfe82531af2b, incorporating #3815 ab187c40 Type-C DPTX DPMS behavior).

Environment & Build

  • Board: Apple Mac mini M4 (Mac16,10, J773g, T8132, 27.2 stub)
  • Base / Head / Merge Tree: origin/main deedd808cefd51c08ba11350e4990437984e7521 + dfe82531af2b23ec1ae9fefa1fd0022b4c1930ff (git merge --no-ff) -> verified HEAD^{tree} = f68bf5cac09797b299bb113988ec7ba384e2e6d1
  • DTB: byte-identical to prior passing row (t8132-j773g.dtb SHA-256 4847d9dcfdc7f2cc44a362dd01a481c0d8564b4ca8efcfec6b5ccd80603c0bcf)
  • Running kernel: 7.3.0-j773g-pr3874-f68bf5ca
  • boot_id: 39620b10-3587-4fe2-814c-8d2c912984a8

Results (all 5 checks PASS)

  1. Boot & display-gate bring-up: Both DCP instances (286e00000.dcp and 48ae00000.dcp) bound cleanly via display-gate, 0 "incomplete handoff" messages; DP-3 (conn=82, CRTC 47) came up at 3840x2160@60 (594000 kHz, edid_bytes=384, enabled=enabled, dpms=On, plasmalogin=active, FAILED_UNITS=0).
  2. 3x DPMS off/on cycles on DP-3 (>= 15 s off each): Executed via DRM DPMS property (Off -> 17.00 s -> On x3). On every cycle: dpms transitioned Off (IOMFB: power on -> off) for 17.00 s and returned cleanly to On at 3840x2160@60 (color:93 timing:65, DSC=NO VRR=NO link: 1, set_digital_out_mode finished) with unplug.was_called:0 (isPlug:1 un/plug.aborted: 00 un/plug.notified:01), zero HPD bounce, zero link-rate/lane drop, and 0 DPTX/DCP errors.
  3. Force connector off -> detect hotplug: DP-3 transitioned disconnected -> connected, enabled=enabled, dpms=On, edid_bytes=384.
  4. 1x s2idle cycle with DP-3 and plasmalogin restored: rtcwake -d /dev/rtc1 -m freeze -s 5 (suspend_stats/success incremented cleanly, fail=0); post-wake DP-3 restored at 3840x2160@60 on CRTC 47 (status=connected, enabled=enabled, dpms=On, edid_bytes=384), plasmalogin=active, FAILED_UNITS=0.
  5. Kernel health: 0 DCP/DPTX/display-gate errors in dmesg; 0 kernel WARNs, BUGs, or Oops.

@DjDeveloperr DjDeveloperr removed the hold Held on purpose; skipped by the PR digest label Dec 2, 2026
@DjDeveloperr
DjDeveloperr merged commit 2d62dc9 into main Dec 2, 2026
18 of 22 checks passed
@DjDeveloperr
DjDeveloperr deleted the feat/j773g-usbc-dp branch December 2, 2026 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:bringup Area from CODEOWNERS (bot) area:gpu Area from CODEOWNERS (bot) area:platform Area from CODEOWNERS (bot) blast:m4 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants