Skip to content

drm/apple: support unshared T8122 dcpext display DART with fbdma mirror for J615 - #3093

Merged
RyanTheTide merged 7 commits into
aurora-silicon:mainfrom
ericjuta:j615/dcpext-7.3
Nov 26, 2026
Merged

RyanTheTide merged 7 commits into
aurora-silicon:mainfrom
ericjuta:j615/dcpext-7.3

Conversation

@ericjuta

@ericjuta ericjuta commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

What: Keep the external display DART out of the shared scanout domain when DT requests it, and mirror GEM framebuffers through the fbdma child instead. J615 selects that path from DT, without a display-policy command-line override. If the required domain cannot attach, only the external pipe is disabled; a failed framebuffer mapping is never submitted to scanout.

Tested: T8122 display-gate KUnit 30/30; the wider run has the same seven T6041-Max failures as unmodified main. Changed objects built with W=1; focused DT binding and board DTB checks ran. No exact-head hardware result yet.

Risk: one-way · T8122 external display handoff and the J615 DT binding; retain a matched, known-good kernel and bootloader DT for rollback. Do not pair a kernel that always shares the DART with an explicitly enabled J615 external display handoff.

Not yet: J615 external display through the normal bootloader handoff, same-head J613 shared-path regression, and verified return to each machine's default. Prior combined-kernel measurements are baseline only.

Details and evidence
  • Head: d1213c5fa733867ca22fc0717d228e0e780dc231. Forwarded main at 49fc037ee by merge. Kept upstream wake and retained-framebuffer handling; the mirror is removed before GEM releases its DMA address and backing pages.
  • Gate coverage includes the default loader marker, refusal of unknown markers and an unshared DT without an fbdma child, and the 27.2 mirror policy. Arm64 QEMU: 68/75 total versus 63/70 on baseline, with the identical seven unrelated T6041-Max failures.
  • W=1 built DCP, DRM, the 14.7 and v27 IOMFB objects and display-gate with no compiler warnings. Individual non-merge commits pass checkpatch.
  • dt_binding_check scoped to apple,dcp.yaml and CHECK_DTBS=y for the J615/J613 DTBs completed. An offline enabled-node negative fixture rejected an unknown property. Both enabled-node fixtures report the existing shared DTS apple,sync-syslog-ack schema warning; the unshared-DART property and fbdma child are on J615 only.

…dma and t8122-dcpext-firmware-ready

Document the properties needed for T8122 external display processors whose
display DART cannot be joined to the display subsystem's IOMMU domain:

- apple,no-shared-display-dart: keep the external coprocessor's display
  DART out of the display subsystem's IOMMU domain and mirror framebuffers
  through the fbdma child instead.
- fbdma: child node naming the display DART stream and display subsystem
  DVA window used to mirror framebuffers.
- apple,t8122-dcpext-firmware-ready: set by the boot loader to 2 (default)
  or 1 (explicitly requested by the owner, accepted by older kernels that
  share the display DART unconditionally).

Signed-off-by: Eric Juta <ericjohnjuta@gmail.com>
…and loader-default marker

On the J615 (MacBook Air 15", M3), appending dispext0_dart to the display
subsystem's shared IOMMU domain causes the internal DCP's DART to fault
and take down the internal panel. Keep dispext0_dart out of the display
subsystem when the dcpext node sets apple,no-shared-display-dart, leaving
framebuffer mirroring to the fbdma child node instead.

- Accept apple,t8122-dcpext-firmware-ready = <2> (boot loader default)
  beside <1> (owner's explicit request), so older kernels that always
  share the display DART will not enable dcpext on a J615 sharing the
  same device tree.
- Refuse a dcpext node with apple,no-shared-display-dart and no available
  fbdma child.
- Disable the fbdma child when the display DART is shared (by board
  default or via apple_t8122_display.dcpext_disp_dart=1), so framebuffers
  are never mapped twice on dispext0_dart.
- Add apple_t8122_display.dcpext_disp_dart (tri-state: -1 lets the board
  device tree decide, 0/1 override).
- Extend t8122-gate-test.dtso and display-gate-test.c to cover marker
  values 1/2/3, board mirroring with/without fbdma, overrides 0/1, and
  27.2 firmware with mirroring.

Signed-off-by: Eric Juta <ericjohnjuta@gmail.com>
When the display gate keeps a T8122 dcpext's display DART out of the
display subsystem's shared IOMMU domain (apple,no-shared-display-dart),
the external pipe scans framebuffers through a DART stream nothing maps.
Mirror framebuffers read-only into the dcpext's available fbdma child
domain at the display subsystem's DVAs:

- Create the optional fbdma child platform device during pipe bind when
  an available fbdma child node is present (the display gate disables it
  when the display DART is shared instead).
- Walk the display subsystem IOMMU domain's own translations via
  iommu_iova_to_phys() so both native and imported buffers are mirrored
  without reaching into an exporter's scatterlist, coalescing contiguous
  physical runs and rolling back partial mappings on failure.
- Track mirrored GEM objects in an xarray and unmap each object from
  every apple_crtc (skipping t8132_ext_crtc) before
  drm_gem_dma_object_free() releases its pages and DVA; drop all mirrors
  before tearing down the fbdma device.

Signed-off-by: Eric Juta <ericjohnjuta@gmail.com>
…wire fbdma

On the J615 (MacBook Air 15", M3), sharing dispext0_dart with the display
subsystem's IOMMU domain triggers internal DCP DART faults. Mark &dcpext
with apple,no-shared-display-dart and add the fbdma child on dispext0_dart
stream 0 with the display subsystem's DVA window so appledrm mirrors
framebuffers there instead. The Type-C routes remain shared with the J613
in t8122-j613-j615.dtsi.

Signed-off-by: Eric Juta <ericjohnjuta@gmail.com>
@ericjuta
ericjuta requested review from a team as code owners November 24, 2026 21:42
@github-actions github-actions Bot added area:display Area from CODEOWNERS (bot) area:platform Area from CODEOWNERS (bot) blast:m3 Macs affected, from Merge risk (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 d1213c5f: ready to merge

Check Detail
CI at head ok no CI for this change (the hardware row is the gate)
Review ok approved by DjDeveloperr
Requested changes ok none
Hardware row at head ok comment at d1213c5f
Conflicts ok none
PR text ok Risk: one-way · T8122 external display handoff and the J615 DT binding; retain a matched, known-good kernel and bootloader DT for rollback. Do not pair a kernel that always shares the DART with an explicitly enabled J615 external display handoff.

Areas: area:display, area:platform
Merge: gh pr merge 3093 --merge (Owners and Core through the bypass: add --admin).

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

@github-actions github-actions Bot added door:two-way Revertible or not, from Merge risk (bot) and removed needs-template PR body lacks Tested or Risk (bot) labels Nov 24, 2026
satchlj
satchlj previously approved these changes Nov 25, 2026

@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.

Gemini 4 Neon on @satchlj's behalf

Verdict at 0a1289fc6015

Approve — clean, fail-closed fbdma framebuffer mirroring for unshared T8122 dcpext display DART domains with proper GEM teardown ordering and KUnit coverage.

Blockers

None for code review.

Note on merge readiness: As noted in Not yet and pr-readiness, a standalone exact-head J615 hardware boot row at 0a1289fc6015 (outside the local 7.3 combined build) is still owed before merge.

Checked

  • Full static audit of all 10 changed files (+448/-16):
    • drivers/gpu/drm/apple/apple_drv.c: apple_drm_gem_create_object installs apple_drm_gem_funcs (.free = apple_drm_gem_free). Verified against drivers/gpu/drm/drm_gem_dma_helper.c (__drm_gem_dma_create()), which invokes drm->driver->gem_create_object for both native and PRIME-imported drm_gem_dma_objects; apple_drm_gem_free() unmirrors from every non-T8132-ext CRTC's dcp before calling drm_gem_dma_object_free(gem), preventing stale fb_dom aliases after IOVA/page release.
    • drivers/gpu/drm/apple/dcp.c + dcp.h + iomfb_template.c:
      • dcp_fb_mirror_range() validates matching minimum page sizes and alignment, coalesces contiguous physical runs mapped IOMMU_READ, and cleanly rolls back mapped bytes on error (leaving nothing mapped).
      • dcp_fb_mirror() is called from iomfb_flush() via DRM .atomic_flush (process context, no spinlock held), so mutex + GFP_KERNEL xa_store() / iommu_map() are safe; rolls back iommu_unmap() if xa_store() fails.
      • Teardown safety: when dcp->retain_dma is false, dcp_release_piodma_iommu_dev() calls dcp_fb_unmirror_all() under fb_mirror_lock and clears dcp->fb_dom before destroying fbdma; when dcp->retain_dma is true, dcp, fbdma, and fb_dom remain retained until reboot so subsequent apple_drm_gem_free() -> dcp_fb_unmirror() calls remain valid.
    • DT/bindings/KUnit tests: apple,fbdma binding, J615/T8122 dcpext DT updates, and dcp_fb_mirror KUnit tests all match implementation.
  • CI at 0a1289fc6015: all completed checks SUCCESS (dt-checks, host-tests, kunit, pr-text, readiness, policy checks).
  • Untested scope: no local J615/T8122 hardware boot performed (static diff + CI verification only).
Evidence
  • Changed files (10): +448/-16 across apple_drv.c, dcp.c, dcp.h, iomfb_template.c, DT/bindings, and KUnit test files.
  • Verified drivers/gpu/drm/drm_gem_dma_helper.c:79 uses drm->driver->gem_create_object for all drm_gem_dma_object allocations (including PRIME imports).
  • Verified dcp_release_piodma_iommu_dev() / dcp_fb_unmirror_all() / dcp_fb_unmirror() locking and retain_dma lifetime semantics in drivers/gpu/drm/apple/dcp.c.
  • CI: dt-checks, host-tests, kunit, pr-text all green at 0a1289fc6015.

@github-actions github-actions Bot added merge-conflict Conflicts with the base branch (bot) and removed merge-conflict Conflicts with the base branch (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 25, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor

Verdict: FINISH, then merge at 0a1289fc6015.

Blockers: The current branch conflicts with main in drivers/gpu/drm/apple/dcp.c. Please forward with a normal push, preserving the merged DCP lifecycle and framebuffer ownership paths while carrying the fbdma change.

Checked: The bindings and other driver files merged automatically in the preview against a60fef7d. The forwarded head needs a J615 external display row via the normal bootloader handoff and a same-block J613 regression, using the exact default kernel and verified restore.

@github-actions github-actions Bot added the merge-conflict Conflicts with the base branch (bot) label Nov 25, 2026
Signed-off-by: Eric Juta <ericjohnjuta@gmail.com>
Do not let a boot parameter force sharing on a DT that prohibits
sharing. Keep the display DART choice independent of the command line.

Signed-off-by: Eric Juta <ericjohnjuta@gmail.com>
If the described fbdma child cannot attach, let the failsafe external
pipe give up without disturbing the panel. On mapping failure, submit
the plane as disabled instead of passing an untranslated DVA to firmware.
Keep the GEM mirror teardown order unchanged.

Signed-off-by: Eric Juta <ericjohnjuta@gmail.com>
@ericjuta

Copy link
Copy Markdown
Contributor Author

Hardware regression request — J613 USB-C external display. No result yet.

Source: aurora-silicon/linux PR head.

Can someone with a T8122 J613 check that its normal shared-display handoff is unchanged? Compare with your known-good packaged kernel on the same loader and display. In the test boot, check a real image on the internal panel and external display, then disconnect/reconnect and move the same display to the other USB-C port. Record mode/refresh, the handoff path, and any new DCP or DART errors. Return to the original default and check both displays again.

Source-only build and boot kit

In a fresh checkout on arm64, with the normal Aurora build dependencies:

git init linux-pr3093 && cd linux-pr3093
git fetch --depth=1 https://github.com/ericjuta/linux.git d1213c5fa733867ca22fc0717d228e0e780dc231
git switch --detach FETCH_HEAD
mkdir out
cp /path/to/your/packaged-aurora.config out/.config
scripts/config --file out/.config --disable LOCALVERSION_AUTO --set-str LOCALVERSION -pr3093-d1213c5fa733
make ARCH=arm64 LLVM=1 LOCALVERSION= O=out olddefconfig
make ARCH=arm64 LLVM=1 LOCALVERSION= O=out -j4 Image modules dtbs

Preserve the loader's live DT and reservations and use the normal command line with no display-policy override. Use your lab's one-shot procedure; do not change Stage 1 or the permanent default. A listed connector without an image is not sufficient. Report board/chip, source head, kernel and loader versions, any deviations, mode/refresh and result, failed units, new kernel errors, SELinux denials if applicable, and restore status. No raw serials or hardware logs needed. The same J613 can cover #3092 in a separate boot if available.

@github-actions github-actions Bot added the door:one-way Revertible or not, from Merge risk (bot) label Nov 25, 2026
@github-actions github-actions Bot added needs-review No approving review from Core or Omarchy Mac yet (bot) and removed door:two-way Revertible or not, from Merge risk (bot) merge-conflict Conflicts with the base branch (bot) labels Nov 25, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor

J615 check at d1213c5f: kernel-side no-regression only, the new path is not exercised

Kernel: main ba29027 + this PR + #3092, on the default fleet command line. Non-default one-shot boot, then restored.

  • Why the new path didn't run: the J615 boots the device tree embedded in its Stage 2, which doesn't carry this PR's DT opt-in. No external monitor is cabled to it either.
  • What still holds: the display subsystem comes up as before, eDP-1 is lit, DP-1/DP-2 are present, 0 DART faults, s2idle 1/1, 0 AVC denials, 0 failed units.

A real row needs a Stage 2 whose DT carries the opt-in, plus a USB-C monitor on the J615. Given the one-way risk you note, that pairing should be done deliberately: a matched kernel and Stage 2 DT, with rollback kept.

@github-actions github-actions Bot removed the needs-hw-row No hardware row at the PR head (bot) label Nov 25, 2026
@ericjuta

Copy link
Copy Markdown
Contributor Author

J615 hardware result — tested head d1213c5fa733867ca22fc0717d228e0e780dc231 on a one-shot boot with the existing J615 loader device tree and aurora.t8122_pstate_cap=5 on the test entry only. Attached-boot PASS: the Samsung G9 visibly displayed at 5120×1440 @ 120 Hz alongside eDP-1. After a same-physical-port USB-C reconnect, DRM/Hyprland showed the G9 active again at 5120×1440 @ 120 Hz; that final reconnect was verified by the display stack, not separately by eye. The logs confirmed framebuffer mirroring initialized; no display/DART/GPU faults matched the targeted checks. The only failed unit was the Proton VPN service. The earlier cap-8 boot is not a display verdict: this test kernel rejected that cap and disabled GPU startup. Verified return to the normal kernel at cap 8 with the G9 active at 120 Hz. No both-ports or suspend pass claimed; J613 coverage remains open.

@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.

Audited all 7 signed-off commits and full diff at d1213c5: clean DT binding and fail-closed display-gate wiring (refuses apple,no-shared-display-dart without fbdma, disables fbdma when shared), proper fb_mirror_lock + xarray lifecycle with apple_drm_gem_free() teardown and dcp_fb_unmirror_all() cleanup, fail-closed scanout skip in iomfb_flush when mirroring fails, and matching display-gate KUnit coverage. Holding merge until full CI checks run green at head (and J613/paired coverage is confirmed).

@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) ready-to-merge Meets the merge policy: merge it (bot) labels Nov 25, 2026
@RyanTheTide
RyanTheTide merged commit 34ed34d into aurora-silicon:main Nov 26, 2026
0 of 2 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) area:platform Area from CODEOWNERS (bot) blast:m3 Macs affected, from Merge risk (bot) door:one-way Revertible or not, from Merge risk (bot) ready-to-merge Meets the merge policy: merge it (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants