Skip to content

display: hand the T6050 boot framebuffer to the engine that scanned it out - #592

Merged
RyanTheTide merged 11 commits into
mainfrom
fix/584-t6050-fb-owner
Dec 1, 2026
Merged

RyanTheTide merged 11 commits into
mainfrom
fix/584-t6050-fb-owner

Conversation

@satchlj

@satchlj satchlj commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

What: On a T6050 board without a panel, the boot framebuffer goes to the external engine this stage's own modeset scanned out on, ahead of the engine whose display DART the device tree gave the display subsystem. It matters wherever the two differ. On J775c they no longer do: the HDMI route (#590) now takes dcpext0, the engine whose DART the tree already gives the subsystem, so there the handoff picks the same engine either way and the new path only adds the simple-framebuffer's display. Stacked on #591; refs #584.

Tested: one J775c row on the previous stack (#590 at 5b5765f) never reached a modeset of its own (#590's route fell back to the internal engine), so this path did not run. No hardware row at this head. Host only: two new cases in tests/python/test_t6050_handoff_bounds.py (the existing host build of src/kboot_display_handoff.c with libfdt, ASan/UBSan) fail on its base and pass here; the file's other 155 cases pass unchanged.

Risk: two-way · T6050 boards whose device tree has no dcp/disp0 aliases, and only when this stage completed a modeset itself on an external engine. NO_DISPLAY stages and adopted displays are unchanged.

Not yet: a J775c HDMI row: the live tree shows /vram as dcpext0's and the subsystem's framebuffer, the subsystem's iommus unchanged (dispext0's DART), the simple-framebuffer's display naming dcpext0, and Linux's DCP driver finding its boot framebuffer. A row where the scanout engine differs from the tree's pick has no machine yet.

Details
  • display_configure() records the DCP it scanned out on once the swap, the boot-args update and the temporary mapping are done (display_scanout_dcp()); kboot passes it to the handoff (dt_set_display_scanout()) before dt_set_display_handoff().
  • t6050_scanout_engine(): the dcpextN that is. It comes before t6050_headless_engine()'s device-tree pick. The engine is handed off as before (t6050_ext_one()), with the display subsystem, /vram as their framebuffer, in one transaction.
  • When the subsystem's iommus lack the engine's display DART (the device-tree node at ADT dart-dispextN's address), it is appended with stream 0; the simple-framebuffer at the boot framebuffer gets the engine's phandle as display (a phandle is generated if the node has none). Any failed step leaves every node as it was.
  • A second commit corrects a comment that named dcpext1 as the J775c's HDMI engine.
  • tests/python/test_t8103_iboot_power_status.py and test_t8152_display_fb.py: their display_configure() stand-ins gain the new leaf (display_note_scanout()).
Evidence

Cases: with a scanout of its own on dcpext0 and the subsystem given another DART, the engine and subsystem are published with /vram, iommus become <9 0 2 0>, the simple-framebuffer names the engine; without a scanout the same tree hands nothing off; with the subsystem already on the engine's DART iommus stay <2 0>.

clang-format 20.1.8 clean. ESP Stage 2 builds.

@satchlj

satchlj commented Nov 30, 2026

Copy link
Copy Markdown
Member Author

Rebased onto #591's new head b401a3c (stack rebase, its commit unchanged) and one comment-only commit on top: old head a31a6a3, new head 43d0b64.

@satchlj
satchlj force-pushed the fix/584-dptx-v27-oob branch from b401a3c to 3c89289 Compare November 30, 2026 01:55
@satchlj
satchlj force-pushed the fix/584-t6050-fb-owner branch from 43d0b64 to 1cda231 Compare November 30, 2026 01:55
@satchlj

satchlj commented Nov 30, 2026

Copy link
Copy Markdown
Member Author

Rebased onto #591's new head 3c89289, conflict-free, with an identical diff: 43d0b64 -> 1cda231. The stack head now carries #590's fix for the SError on DISPEXT0_CPU's power state register.

… calls

The T6050 DCP's firmware 27 hosts its dptx-port RemotePort service on
endpoint 0x2c and announces no 0x2a, so dcp_dptx_init() waited on an
endpoint that is not there. On that endpoint it also speaks a later
message layout, and it makes its own service calls to the AP out of band:
the request and the reply are in its buffers, named by address and
length in the command, which AFK rejected.

Endpoint: use 0x2a where the firmware announces it, as before, and 0x2c
where it announces only that (rtkit_has_endpoint(), from the endpoint map
the IOP sent). The endpoint is what selects the layout below; no chip or
firmware version is checked.

On that layout (dcp_dptx_if_t.v27):

 - the connection is validated before it is taken;
 - validate-connection and connect replies are eight bytes with no status
   word; the connect reply echoes the attributes it took, and a port
   behind a DP-to-HDMI converter does not claim supportsHPD (the AP
   reports that HPD);
 - request-display and the hotplug call return no status; hotplug echoes
   the state it took;
 - the firmware's group-1 link record calls (3 and 4) carry its own
   pointers and are returned as given with their result words cleared;
   drive settings come as a lane count at 16 (set) or 0 (get) and the
   lanes from 32, checked against DisplayPort's levels before the PHY sees
   them; tiling hints are a 160-byte record whose status is at 0x90; link
   fault reports are acknowledged, as on T8152.

Out-of-band service calls (command flags bit 0), on any AFKv2 endpoint
whose service takes calls: the request is copied from the firmware's tx
buffer and the reply to its rx buffer only when every page of each is
mapped in the session's DART and lands in RAM (rtkit_access_remote(),
nothing is mapped for it), both are at most 16 KiB and the reply fits
the command's capacity. The status goes back in the response's value; a
failed call returns no bytes. Anything else is still refused as
unsupported without touching a firmware address. Before this, every such
call was refused.

The AFKv2 command's tx buffer is cleaned to memory after it is written
and its rx buffer invalidated before it is read, as the firmware's DMA
needs on any machine where those buffers are cached.

Signed-off-by: Satya Benson <satya@benson.earth>
…t out

On a T6050 board without a panel the display handoff gives the boot
framebuffer to the external engine whose display DART the device tree
gave the display subsystem. When this stage did the modeset itself on
another engine, that is the wrong one: on J775c the tree's subsystem
names dcpext0's DART (rear USB-C) while HDMI scans out on dcpext1, so
dcpext1 is handed over without its framebuffer and Linux finds none.

Record the DCP a completed modeset scanned out on, once the swap, the
boot-args update and the temporary mapping are done
(display_scanout_dcp()), and pass it to the handoff
(dt_set_display_scanout()). An external engine named there comes before
the device tree's pick. In the same transaction as before it is handed
off with the display subsystem and /vram becomes their framebuffer; in
addition its display DART (ADT dart-dispextN) is added to the
subsystem's iommus when the tree gave the subsystem another one, and the
boot framebuffer's simple-framebuffer node gets the engine as its
"display". Any failed step leaves every node as it was, as before.

Without a modeset of this stage (a NO_DISPLAY stage, or one that only
adopted the display) nothing changes.

Signed-off-by: Satya Benson <satya@benson.earth>
The HDMI route now takes the crossbar's lowest-numbered engine, dcpext0
on the J775c, which is also the engine whose display DART the device
tree gives the display subsystem. The scanout engine still comes first
where the two differ; on the J775c the handoff picks the same engine
either way.

Signed-off-by: Satya Benson <satya@benson.earth>
@satchlj
satchlj force-pushed the fix/584-dptx-v27-oob branch from 3c89289 to f7771e5 Compare November 30, 2026 15:32
@satchlj
satchlj force-pushed the fix/584-t6050-fb-owner branch from 1cda231 to d86af18 Compare November 30, 2026 15:32
@satchlj

satchlj commented Nov 30, 2026

Copy link
Copy Markdown
Member Author

rebased onto fix/584-dptx-v27-oob f7771e5: old head 1cda231, new head d86af18, conflicts in src/kboot_display_handoff.c (the scanout flag sits beside main's new dcp_fw field).

@satchlj

satchlj commented Nov 30, 2026

Copy link
Copy Markdown
Member Author

J775c (M5 Max Studio) row for the rebased stack at these heads: #589 a81571f6, #590 0b82cba4, #591 f7771e54, #592 d86af18d, #597 85982071, #602 83946b1d, #605 f8d4f63e, all on main f380f03c. Trial Stage 2 is lab/584-rebased-trial c9cb7a0c = this stack + #587 + #338 (raw image sha256 9473514e…). Only Stage 2 changed from this Mac's default. The kernel is the packaged linux-aurora (linux main e6c7b032 + linux#3686/#3689/#3682), Stage 1 is main 1e01a273 NO_DISPLAY, firmware 27.2.

Stage 2:

dart: /arm-io/dart-dcpext0: three-table stream, vm-base 0x10000000000, 1 root entry
dcp-dptx: endpoint 0x2c announces the dptx-port service
display: swapped! (swap_id=0)
DCP: T6050: dcpext0 handed off with the display subsystem: firmware 27.0, framebuffer 0x10fd805c000+0x854000
DCP: T6050: dcpext1 handed off: bw-scratch 0x30000
FDT: dcpext0: live RTKit session v12, 3 system buffer(s), epmap 0000011d 00823f3f
Preparing to boot kernel at 0x10004400000 with fdt at 0x1000eb80000

Linux: HDMI-A-1 connected 2560x1440, boot scanout retired by displayed swap 3, system level cache allocation enabled on 32 planes, 0 failed units, Wi-Fi up, and it returned to the saved default unaided. GPU bandwidth d4/d8 742/856 GB/s, render tri d1/d8 133.3/23.9 µs, llama-2-7B Q4_0 pp512 3,088 / tg128 110.7. That matches the pre-rebase stack within run-to-run spread.

DjDeveloperr
DjDeveloperr previously approved these changes Nov 30, 2026

@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: MERGE at d86af18d, after #591 lands under it.

Blockers: none in this PR.

Checked: the scanout engine is recorded only after display_configure() completes, and it only takes effect on the T6050 headless path when the tree has no dcp/disp0 aliases. The engine is matched exactly against /arm-io/dcpextN. The iommus append checks for 2-cell entries and skips a DART already listed. The simple-framebuffer is found by its base and compatible before display is set. Node offsets are looked up again after each write. All of it runs on the scratch copy, so a failure leaves the live tree alone. Other machines only gain the recorded pointer. The J775c row for the rebased stack is at this head, and it shows dcpext0 handed off with the subsystem.

@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 Nov 30, 2026

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: MERGE at d86af18d8736

Converts this App's earlier review at the same head to an approval under the 12-01 merge bar (better than before and doesn't break; block only on a shown failure). No code blocker was found in it. The merge gate (a row on one Mac at this head + fast CI) is tracked by pr-readiness, not held here.

Checked: - Audited all production changes (src/display.c, src/display.h, src/kboot.c, src/kboot_display_handoff.c) and verified call ordering in src/kboot.c (dt_set_chosen() at L15304 creates /chosen/framebuffer@<base> before dt_set_display() at L15344 runs dt_set_display_scanout() + dt_set_display_handoff(), followed by dt_publish_live_rtkit() at L15357).

  • Verified display_note_scanout() records conf->dcp only after display_configure() completes swap, boot-args update, and temporary mapping; t6050_scanout_engine() strictly matches /arm-io/dcpext0..N and runs ahead of t6050_headless_engine().
  • Verified transactional atomicity: t6050_scanout_iommu() and t6050_scanout_simplefb() mutate only the dcp6_scratch(dt) copy inside t6050_headless_publish(), re-resolving node offsets after every property write, so any failure leaves the live FDT untouched.
  • Verified t6050_scanout_iommu() validates 2-cell iommus entries (len % 8 == 0) and avoids duplicate appends when the scanout engine's DART is already listed; t6050_scanout_simplefb() generates a phandle on the DCP node if absent and verifies "simple-framebuffer" compatibility before writing display.
  • Hosted CI is green at d86af18d (policy, ESP stage 2 vital size, selftest, pr-text, readiness), host ASan/UBSan tests (test_t6050_handoff_bounds.py + display_configure() test stand-ins) pass, and exact-head J775c row (#592#issuecomment-7283293944) confirmed `HDMI-A-1 connect

Follow-ups (not blocking): Merge parent #591 first (has CR); code, CI, J775c row clean

Signed-off-by: Satya Benson <satya@benson.earth>
Signed-off-by: Satya Benson <satya@benson.earth>
@satchlj

satchlj commented Dec 1, 2026

Copy link
Copy Markdown
Member Author

Merged main 2a7854a via the branch below, no conflicts.

@github-actions github-actions Bot added needs-hw-row No hardware row at the PR head (bot) and removed ready-to-merge Meets the merge policy: merge it (bot) labels Dec 1, 2026
…ache ops

Validate reply_size against 32 + count * sizeof(*port->drive) on v27
SET_DRIVE_SETTINGS as well as GET_DRIVE_SETTINGS, preventing a short
reply buffer from being overrun when echoing the lane settings.

In rtkit_access_remote(), align cache maintenance spans down and up to
64-byte cache lines and use dc_civac_range() on the !to_iop read path so
unaligned firmware DVAs never skip trailing cache lines or discard
adjacent dirty AP data sharing a boundary line.

Extend test_dptx_v27_oob.py to cover both cases.

Signed-off-by: Satya Benson <satya@benson.earth>
Signed-off-by: Satya Benson <satya@benson.earth>
@satchlj

satchlj commented Dec 1, 2026

Copy link
Copy Markdown
Member Author

Merged #591 (ece3e344, including main 378497cf) -> head f086b09c. Updated J775c Stage 2 hardware row will follow once the build completes.

@satchlj

satchlj commented Dec 1, 2026

Copy link
Copy Markdown
Member Author

J775c (M5 Max) row: a Stage 2 built from aura main 2a7854a3 with #590→#605 merged at their current heads (built tree 6b52b129, reports 1.0.0b17-g6b52b129), trial boot on the default command line: Stage 2 handed dcpext0 over live, apple-drm bound 2b2e00000.dcp, HDMI connected (console and greeter), SLC enabled, 0 failed units; the reboot out returned to the default unaided.

@satchlj

satchlj commented Dec 1, 2026

Copy link
Copy Markdown
Member Author

J775c (M5 Max Studio) Stage 2 hardware row at the updated heads: #591 ece3e344, #592 f086b09c, #597 0bc4529b, #602 5d3b1f39, #605 6b52b129 on main 378497cf (Stage 2 built cleanly from main + this stack: 1.0.0b17-g6b52b129, raw aura.bin sha256 2a7f7410…; Stage 1 1e01a273 NO_DISPLAY, system firmware 27.2, kernel 7.3.0-1-46.5-ARCH, default command line):

  • One-shot Stage 2 trial booted cleanly and returned unaided to default.
  • apple-drm display-subsystem: bound 2b2e00000.dcp (ops dcp_comp_ops [appledrm])
  • HDMI-A-1 status: connected
  • apple-mcc 2220000000.memory-controller: system level cache allocation enabled on 32 planes
  • systemctl --failed: 0 failed units.

@github-actions github-actions Bot added ready-to-merge Meets the merge policy: merge it (bot) and removed needs-hw-row No hardware row at the PR head (bot) labels Dec 1, 2026
@github-actions github-actions Bot added ci-failing A check failed at the PR head (bot) ready-to-merge Meets the merge policy: merge it (bot) and removed ready-to-merge Meets the merge policy: merge it (bot) ci-failing A check failed at the PR head (bot) labels Dec 1, 2026
@RyanTheTide
RyanTheTide changed the base branch from fix/584-dptx-v27-oob to main December 1, 2026 11:34
@RyanTheTide
RyanTheTide dismissed DjDeveloperr’s stale review December 1, 2026 11:34

The base branch was changed.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Merging at 8eafae2a6223 (B2 merge train, 12-01 merge bar). Approval at this head: aurora-silicon-review[bot]. Row: J775c (M5 Max Studio) Stage 2 row for the whole stack (satchlj, on #591; heads since then only merge main). CI: aura train A3 = main f6d78b6 + #591 #592 #597 #602 #605 (candidate 548f83df): gcc normal + ESP_STAGE2 pass, no new warnings; pytest 1749 passed / 0 failed. Hosted CI is queued behind the backlog. Revert: git revert -m 1 <merge commit>.

@RyanTheTide
RyanTheTide merged commit 7304c21 into main Dec 1, 2026
14 of 17 checks passed
@RyanTheTide
RyanTheTide deleted the fix/584-t6050-fb-owner branch December 1, 2026 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blast:m5 Macs affected, from Merge risk (bot) door:two-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.

3 participants