Repository navigation
drm/apple: dcp-fabric: J714s: drive a dock's third display through dcpext1 - #1921
Conversation
Review + hardware test on J714s (M5 Pro): the high-refresh caseVerdict: PASS for the case this PR left untested. A 3840x2160@240 display on the dock (merged mode) and a 3840x2160@120 DP alt mode display were both up at full refresh, with the internal panel lit. The 240 Hz tunnel now lands on dcpext1, the new tunnel-only route, and pairs with dcpext3. There's nothing in the code that blocks a merge, and the hardware result for this setup is clean. Two follow-ups below are not blocking; (2) is user-visible. What I ran
Hardware matrixDisplays: internal panel; a 3840x2160@240 display behind a Thunderbolt 5 dock on the right port (USB4 DP tunnel, DP IN 0); a Dell S2725QC 3840x2160@120 on the left-front port (DP alt mode).
Faults on the PR boot:
New warn+ lines against the stock intg7 boots: only
The Thunderbolt dock and the devices behind it stayed authorized. The default boot came back with the same routing as before: dcpext2 + DCP4. Not done:
Review findings
I haven't pushed anything to this branch. If you want the connector-ordering change from (2), I can open it as a separate PR against this one. Test: one-shot boot on the M5 Pro; the default boot was restored and checked byte-identical afterwards. |
A port's Thunderbolt DP tunnels are kept in two owner slots, primary and secondary, and dcp_fabric_dpin_slot() maps DP IN n and n + 2 onto the same one. That models the dual-stream DCPs, but on T6050 every pipeline drives a single DP IN (fixed CRTCs), and the host router has four DP IN adapters. A dock with three displays gets DP IN 0, 1 and 2; the third lands in DP IN 0's occupied slot and is refused before any free pipeline is considered: apple-dcp 2b2e00000.dcp: port already routed, not taking DP tunnel dpin2 thunderbolt-apple-acio 381ac0000.acio: dpin2: DP tunnel setup failed: -98 Widen the core port's owner array to one slot per DP IN, and let dcp_fabric_tunnel_owner() pick a DP IN's slot: its stream slot as before, or, with fixed CRTCs, the DP IN's own. dcp_fabric_tunnel_slot() takes the same choice, so DP IN 2 and 3 are admitted by the one set of rules. The driver's port keeps owner, secondary_owner and the new dpin_owner[] as views of one slots[] array in the core's order, and every owner-slot lookup goes through dcp_tb_slot() (attach, release, request finish, DP events). The fabric snapshot, the port's HPD, connector binding and route unregistration cover all four slots, and the Type-C mux path counts a tunnel in any slot as holding the port, so a DP alt mode state is not applied to a port whose DP IN 0 tunnel went first while DP IN 2's is still up. dcp_tb_candidate() still takes the stream of DP IN 2/3 from its parity; it only feeds the dual-stream pairing order, which fixed-CRTC machines do not run. The slot change follows the SoC (apple,t6050), so J716c gets it too; other SoCs keep the two-slot mapping. Tested on J714s (M5 Pro) with a Thunderbolt 5 dock (Ugreen 10-in-1) and three 1080p displays, together with the J714s device tree change that gives dcpext1 a route to the right port: DP IN 0, 1 and 2 go to dcpext0, dcpext1 and dcpext2, and all three displays light up, as they do on macOS. The firmware accepts the DPTX DFP port of DP IN 2. Signed-off-by: Isaac Duarte <31712685+Isaac-Duarte@users.noreply.github.com>
A DCP route that carries USB4 DP tunnels only is not a Type-C mode-switch: the Type-C class caps a connector's mode-switch providers (TYPEC_MUX_MAX_DEVS), and a tunnel finds its port through the route's endpoint. Add an apple,tunnel-only flag to the route node and require mode-switch only on routes without it, in both apple,dcp and the common apple,dcp-typec-routes schema. The common schema also lacked the typecN-dpin2 and typecN-dpin3 crossbar names T6050 device trees already use for the host router's third and fourth DP IN adapters; allow them, up to the 21 controls apple,dcp allows. Signed-off-by: Isaac Duarte <31712685+Isaac-Duarte@users.noreply.github.com>
A route marked apple,tunnel-only exists to give USB4 DP tunnels another pipeline. It is in its port's route list like any other, so a DP alt mode display on that port could be given it, through a path never tested on it, and take the pipeline the tunnel was meant to have. Mark such routes in the fabric core, and pass them over for a direct stream: when picking a free route, including the port's last one, in the dual-stream pairing plan, when a route follows its CRTC (as the moved stream or as the holder swapped away), and where the driver moves a DP alt mode display to another pipeline (dcp_typec_move_starved_locked(), dcp_typec_move_off_hybrid_locked() and dcp_typec_hdmi_reclaim()). Tunnels choose them as before. The pairing plan takes a port's stream for a tunnel when a tunnel holds any of its owner slots, not only the first. On T6050 every port/pipeline pair gets a DRM connector, in pipeline order. A new tunnel-only route would come before the pairs of later pipelines and renumber their connectors (DP-3 becoming DP-4), which breaks compositor configurations keyed on connector names. Create the tunnel-only pairs in a second pass, after all the others, so the existing connectors keep their names and the new ones come last. Signed-off-by: Isaac Duarte <31712685+Isaac-Duarte@users.noreply.github.com>
Follow-up: J714s with a third external display (two on the dock)The owner connected one more USB-C display to the dock. The rig now has:
The new display trains on DP IN 0 and the 4K240 on DP IN 1. Same method as before:
Verdict:
So with this PR, the owner's three-external setup doesn't fully work yet, and the remaining failure looks like something outside this diff (details below).
The stock row was read twice: at 32 s after a reboot, and again settled at 100 s. Both reads gave the same result. Faults:
What this says about the PR:
Likely cause (a lead, not proven): the T6050 DP PHY's tunnel clocks, in
In my first run, the 4K240 was the port's first display (clock 1 at HBR3, the other clocks started at HBR3 with it), and it ran fine at 239.996 Hz. The three 1080p165 displays in your test probably all trained at the same rate. A second possibility I can't rule out from this run: merged mode on the dock's second DP IN. The pair had only ever run on DP IN 0. Two tests would tell them apart:
Neither needs a change to this PR. As before: I haven't pushed anything to this branch, and the default boot was restored and verified after the test. |
654a531 to
5c82a3e
Compare
…tunnels The J714s describes routes for dcpext0 and dcpext2 only, keeping dcpext1 and dcpext3 as peers for modes wider than one pipeline. A Thunderbolt dock on the right port can carry up to four DP tunnels, so a third display has no pipeline to go to on Linux, while macOS drives three. Give dcpext1 a route to the right port's DP IN crossbar outputs. Its crossbar source, 2 (dispext1 port 0), follows the 2 * dispext pattern of dcpext0 (0) and dcpext2 (4) and matches dcpext1 on T6040; it is confirmed by a display driven through it. The route has no mode-switch: hpm2 already has TYPEC_MUX_MAX_DEVS (3) mode-switch providers, and tunnels find their port through the endpoint rather than the Type-C mux. It is marked apple,tunnel-only, so DP alt mode displays stay on dcpext0 and dcpext2. A routed DCP is no longer a merged-mode peer (dcp-peer-v27), so dcpext0 and dcpext2 now share dcpext3 as their peer: one display wider than one pipeline at a time instead of two. Needs "drm/apple: dcp-fabric: give T6050 DP IN 2 and 3 their own tunnel slots" for the third tunnel to be routed, and "drm/apple: dcp-fabric: support tunnel-only Type-C routes" for apple,tunnel-only. Signed-off-by: Isaac Duarte <31712685+Isaac-Duarte@users.noreply.github.com>
5c82a3e to
4c6a7b4
Compare
|
Thanks for both test runs and the review! Updated (4c6a7b4): (2) Connector names: fixed as you suggested. On T6050, (1) DT comment: dcpext1's comment now says dcpext0, dcpext1 and dcpext2 all pair with dcpext3, so only one display wider than one pipeline runs at a time. (6) Guards: both added in the core, with KUnit cases:
These are folded into "drm/apple: dcp-fabric: support tunnel-only Type-C routes" (retitled from "keep DP alt mode off tunnel-only routes", since it now also orders the connectors) and the DTS commit. The PR description is updated to match. Testing: On the follow-up: agreed, that's outside this diff. Your table predates the connector fix: with it, the 4K240 on dcpext2 × right would be DP-3 (as on stock), and the new display on dcpext1 × right DP-5. Your tunnel-clock lead may also explain something I see here. On every boot, DP IN 0's first link-up times out ( |
|
@DjDeveloperr Here is the follow up PR to fix the DP IN 0- first-connect timeout mentioned earlier. #1930 Essentially the skinny is the dock withdraws its first tunnel about 190 ms after DCP starts on it, and the connect kept waiting the full 2 s. The release that follows can land in DCP's link-retry window and never get answered. #1930 ends the wait as soon as the tunnel is gone. It's independent of #1921: 8 of 8 boots clean on the J714s. |
|
Test report from a second J714s, at the current head (4c6a7b4), combined with FatBoy721's J714s HDMI device tree.
Thank you for the work on the dock path. 🤖 Generated with Claude Code |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Validation on J714s: four displays lit with this PR and our follow-ups
Verdict: works. With this PR at 4c6a7b4 (carried through #2006 at 0e0169b, unchanged), dcpext1's tunnel-only route carried a dock tunnel in every kit boot: DP IN 0 from k3 on, and DP IN 1 in k2b. The three-external setup from my earlier follow-up now lights completely: the internal panel and all three externals. The remaining failure there (the DP IN 1 display dropping its link) was outside this diff. It's fixed by the PRs listed below.
Rig:
- internal panel;
- Dell S2725QC (3840x2160@120) on the left-front port, DP alt mode;
- Thunderbolt 5 dock on the right port: JTG S123 (1920x1280@60) on DP IN 0, Samsung Odyssey G81SF (3840x2160, up to 240 Hz) on DP IN 1.
Kits: integration/aurora 514ae1f + #2006 (with this PR) + #2018 (its earlier version) + our fixes, added one step at a time (k2b to k6). Each was built natively on the M5, booted once, and read out only (sysfs, debugfs, kernel log, hyprctl monitors); then the default kernel was restored and verified.
Final kit (k6), read at about 60 s and 150 s after boot, same both times:
| display | connector | pipeline | mode |
|---|---|---|---|
| internal panel | eDP-1 | 3024x1964@120 | |
| Dell, left-front, DP alt mode | DP-2 | dcpext0 | 3840x2160@120 |
| G81SF, dock DP IN 1 | DP-3 | dcpext2 | 3840x2160@120 |
| JTG, dock DP IN 0 | DP-5 | dcpext1 (tunnel-only route) | 1920x1280@60 |
Routing and faults:
- Connector names: DP-1..DP-4 kept their meaning. The Dell is DP-2 on the stock kernel and on every kit. The new pairs are DP-5 (dcpext1 × right) and DP-6 (dcpext1 × left-front, from #2006).
- Routing: from k3 on, every boot routed DP IN 0 to dcpext1 and DP IN 1 to dcpext2, and the DP alt mode display kept dcpext0. In k2b the Dell wasn't up (its port's PD controller came up late); there DP IN 0 took dcpext0 and DP IN 1 dcpext1, and both tunnels routed.
- Faults: in all kits, 0
port already routed, 0DP tunnel setup failed, 0no eligible idle peer, 0no display pipeline free. k6 had no oops/WARN, no DART fault and no GPU fault.
The G81SF runs at 120 Hz, not 240. With three external displays, a merged pair would take the last external engine. A follow-up PR limits merged modes to when a pair leaves an engine free, so here it gets one engine's fastest mode. With fewer external displays, my first comment above measured the 240 Hz pair on dcpext1 + dcpext3.
What made the DP IN 1 display hold its link: the set #2032–#2038, all based on integration/aurora. Only #2034 (tunnel-only first) needs this PR in code.
- #2035: the merged-mode limit, which is why the G81SF runs at 120 Hz here;
- #2036: the tunnel clock runs only for its link;
- #2037 + #2038: the DPTX connection names its DP IN, and the DP IN bandwidth allocation holds CM Ack. Only k6, which added these two, held the link.
Not covered:
- hot unplug/replug sequences;
- a dock on the left-front port;
- DP IN 2/3;
- KUnit.
I haven't pushed anything to this branch.
|
Validated on our M5 Pro (J714s, MacBook Pro 14"): this head (4c6a7b4) with #2006, in a test kit on integration/aurora c0a2a75 that also carried our own pending DP tunnel fixes (since merged as #2033, #2035-#2038). Two boots: the test kit, then a default candidate built from the same source.
The host-test failure is the harnesses still modelling two owner slots, not a bug here. #2041 updates them, and it merges right after this one. |
08d569e
into
aurora-silicon:integration/aurora
tools: host tests: follow #1921's per-DP IN tunnel slots
…n#1921 linux#1921 gives a T6050 Type-C port one owner slot per DP IN: the driver's owner, secondary_owner and new dpin_owner[] are views of one slots[] array, every lookup goes through dcp_tb_slot(), and dcp_fabric_tunnel_slot() makes the same per-DP IN choice. The host harnesses that compile those production bodies still modelled the old two-slot port, so they no longer built: - tiled-split: the fixture's port and core port carry the slot array, dcp_typec_fixed_crtcs() follows the T6050 topology, and the production dcp_tb_slot() and dcp_fabric_tunnel_owner() are pasted in with the other bodies (the extractor now keeps a return type on the line above). On T6050, DP IN 3 takes its own slot (t6050-dpin3-alone) and a dock's four tunnels each take theirs (t6050-dpin-own-slots). The shared-slot rule stays covered as a T6030 case (t6030-dpin3-shares-slot). The dpin3-primary-slot mutant moves to dcp_fabric_dpin_slot(), and two new mutants drop the per-DP IN choice in the driver and in the core. - tunnel-route: the fixture's port carries the slot array, and a new check and mutant cover dcp_fabric_snapshot_port() copying all four slots. - apple-dcp (transaction units): the model's owner is slot 0 of the same array, and route_set's new dcp_typec_port_tunneled() is the production helper. No production code changes. Signed-off-by: Diljit Singh <hey@djdev.me>
A Thunderbolt dock on the J714s's right port lit two displays on Linux, while macOS drives three. The third display's tunnel arrives on DP IN 2 and is refused before any pipeline is considered:
There were two causes:
1. drm/apple: dcp-fabric: give T6050 DP IN 2 and 3 their own tunnel slots (T6050 only)
dcp_fabric_tunnel_owner()picks a DP IN's slot: its stream slot as before, or, with fixed CRTCs, its own.dcp_fabric_tunnel_slot()takes the same choice, so DP IN 2 and 3 are admitted by the same rules as DP IN 0 and 1.owner,secondary_ownerand the newdpin_owner[]are views of oneslots[]array in the core's order. Every owner-slot lookup goes throughdcp_tb_slot(). The fabric snapshot, the port's HPD, connector binding and route unregistration (now one loop) cover all four slots.dcp_tb_candidate()still takes DP IN 2/3's stream from its parity. That stream only feeds the dual-stream pairing order, which fixed-CRTC machines don't run.apple,t6050), so J716c gets it too: there a dock's DP IN 2 tunnel now waits for a free pipeline instead of failing with -98 (port already routed). Other SoCs keep the two-slot mapping.2. dt-bindings: display: apple: allow tunnel-only Type-C routes
apple,tunnel-onlyroute flag.mode-switchis required only on routes without it, inapple,dcpandapple,dcp-typec-routes.apple,dcp-typec-routesalso gains thetypecN-dpin2/typecN-dpin3crossbar names that T6050 DTs already use (cells 3 and 4), up to the 21 controls thatapple,dcpallows.3. drm/apple: dcp-fabric: support tunnel-only Type-C routes
dcp_fabric_follow(), as the moved stream or as the holder swapped away), and the three paths that move a DP alt mode display to another pipeline (dcp_typec_move_starved_locked(),dcp_typec_move_off_hybrid_locked(),dcp_typec_hdmi_reclaim()). Tunnels pick it as before.owner[0]. This is the one line that is not T6050-only: the plan runs only on ordered dual-stream SoCs (M2 Pro/Max class), where it differs only whenowner[1]holds a tunnel andowner[0]doesn't. That case does not occur in practice, because a tunnel claiming the port clears its DP alt mode request (dp_wanted) first.apple_probe_typec_ports()now creates the tunnel-only pairs in a second pass (dcp_typec_port_tunnel_only()), so DP-1..DP-4 keep their stock meaning and the new dcpext1 × right connector is DP-5. Without this, dcpext2's connectors were renumbered (DP-3 → DP-4, DP-4 → DP-5).4. arm64: dts: apple: t6050-j714s: route dcpext1 to the right port's DP tunnels
mode-switch: hpm2 already hasTYPEC_MUX_MAX_DEVS(3) mode-switch providers, and tunnels find their port through the endpoint, not the Type-C mux.Trade-off: a routed DCP is no longer a merged-mode peer (
dcp-peer-v27skips DCPs with Type-C routes), so dcpext0, dcpext1 and dcpext2 now share dcpext3 as their peer. One display wider than one pipeline can run at a time instead of two; the J714s DT comment says so. Keeping dcpext1 as a peer while it carries no tunnel would need the peer reservation and the Type-C allocator to share a lock, so it is left for a follow-up.Testing
J714s (MacBook Pro 14" M5 Pro). Kernel 7.3.0-36.n1usb (integration/aurora 9219565) with this series applied cleanly on top, installed as
appledrm.ko,dcp-fabric-core.koand the J714s DTB (one-shot trial boot). Dock: Ugreen 10-in-1 Thunderbolt 5. Displays: 1920x1080@165.No
port already routed, no kernel warnings.DP tunnel PHY open failed: -22is logged at every tunnel routing, as it was before this series (same lines in the previous boot on the stock module).Also tested by @DjDeveloperr (see the review comments): a 3840x2160@240 display on the dock in merged mode (dcpext1 + peer dcpext3) beside a 4K120 DP alt mode display, both at full refresh. With a second, slower display on DP IN 0, the 4K240 on DP IN 1 is routed and paired but its sink drops; it gets no pipeline at all without this series, and the lead is the PHY's tunnel clocks (
apple_t6050_dp_tunnel_clock()), outside this diff.Seen while testing, not from this series: DP IN 0's first link-up after boot or plug-in times out (
dcp_dptx_connect: timed out waiting for port 0 link configuration). Usually the re-route recovers; sometimes the teardown times out too (-110) and the display stays dark until a re-plug. The module from before this series does the same: 3 of 3 boots timed out, 1 of 3 stayed dark.apple-dcp-fabricunder QEMU arm64. 115 tests: 114 pass, 1 skipped (S35_dual_retry_off, skipped in the source as tested by W3). New tests:fabric_per_dpin_slot_test: slot mapping, three DP INs admitted, a repeated stream,-EADDRINUSEwith shared slots,-EBUSYunder a DP alt owner.fabric_tunnel_only_test: the free-route pick, the port's last route, the pairing plan (including a tunnel held in a per-DP IN slot), following a CRTC (direct stream and swapped holder refused, tunnel allowed), a tunnel still taking it. Without commit 3's checks, its direct-stream cases get the tunnel-only route.appledrm.koanddcp-fabric-core.kofrom 7.3.0-36's source (integration/aurora 9219565) + this series, clang 22.1.8, the kit config, W=1: no warnings. The earlier revision also built at this branch's base (7c71d6d) with W=1, and commit 1 builds on its own.dt-doc-validatepasses on both schemas.dt-validateof the J714s DTB against the old schemas reports dcpext1's route (apple,tunnel-only, missingmode-switch) and the DP IN 2/3 names on dcpext0 and dcpext2. Against the new schemas it reports nothing for any DCP.Not tested