Skip to content

M5: J704 (MacBook Pro 14-inch, M5) GPU and display - #2093

Open
term-guy wants to merge 3 commits into
aurora-silicon:integration/aurorafrom
term-guy:j704-board-upstream
Open

term-guy wants to merge 3 commits into
aurora-silicon:integration/aurorafrom
term-guy:j704-board-upstream

Conversation

@term-guy

@term-guy term-guy commented Nov 16, 2026 •

Copy link
Copy Markdown

Adds the MacBook Pro 14" M5 (J704) to the G17 driver and its device tree. The J704 shares the J813's T8142 SoC, GPU identity and 26A428 COMMON26 firmware interface, but not its power data.

  • drm/asahi: g17: M5: add the J704 board. A J704 board on the COMMON26 graph, from the J813 one with the values that differ, each taken from the J704 ADT or from the init data macOS 27.0 hands its GPU firmware: 14 perf states (13 GPU states, 338-1620 MHz) with the J704 voltages, AON rows, region C and power-policy words, idle standby time, and no clearing write at hw_data 0x1118 (the 1620 MHz entry here). hw::t8142::select() picks the board by the root compatible
    (apple,j704; everything else keeps the J813) and fails the probe if it cannot be read. aurora.m5_probe_only=1 logs the ID registers and refuses the GPU before the UAT or firmware are touched.
  • arm64: dts: apple: t8142-j704: Add the GPU. As t8142-j813-gpu.dtsi, addresses and interrupts from the J704 ADT; 14 OPPs (perf-state-count 14).
  • arm64: dts: apple: t8142-j704: Give the DCP its firmware clocks. apple,clock-ids 585/431 as on the J813; without them the firmware-27 DCP does not start.

Needs aura with the J704 perf-state fix (aurora-silicon/aura#276) to fill the GPU nodes.

Testing on J704 (macOS 27.0 / 26A428 firmware, booted through aura, this branch on integration/aurora 24b3230): the GPU initializes every boot, t1-t4 (DRM info, Vulkan compute, GLES and Vulkan rendering) pass, the dEQP runs listed in aurora-silicon/mesa#397 pass, the internal panel runs through DCP (eDP-1 3024x1890) with backlight, and Ubuntu 26.04 runs with the GPU from an NFS root (t1-t4 pass there too).

Known problem, not caused by this board data as far as I can tell: with more than four
concurrent clients running geometry/tessellation work, the firmware occasionally restarts the
GPU (it recovers; the affected render is lost). Details in omacom/linux-aurora#493.

Written with an AI assistant (noted in each commit) and tested on the hardware by me.

@joshuaswarren

Copy link
Copy Markdown
Contributor

[Joshua's agent] Friendly heads-up for when this board lights up under a Hyprland 0.57 desktop: the "apple,t8142-dcp" primary keeps xrgb_is_alpha = true on V_27_0 and H17G-compat firmware in integration/aurora today (apple_drv.c, with the opaque-X property skipped for V_27_0), so the plane will not offer XRGB8888. We measured what that does on the sibling M5 panel: Hyprland asks for XR24, falls back to AR24 buffers while its monitor format stays XR24, and ensureBufferPresent then shows the frame from two updates back (buffer read 34 of 34 two-back; 2987 of 2987 current once XRGB was offered with X opaque). Details: #1816 (comment). Worth checking the first desktop boot with a buffer read or a camera walk before assuming vsync is fine. Happy to help test on our M5 machines.

@joshuaswarren

Copy link
Copy Markdown
Contributor

[Joshua's agent] Correcting my heads-up above. Two things I said were wrong for this board. First, the "frames two updates late" symptom is not what stock Hyprland does: it came from our own downstream aquamarine patch (hyprwm/aquamarine#496, closed), which allocates AR24 when XR24 is missing; on a stock stack a plane without XR24 fails to start on that output ("GBM: Failed to allocate a GBM buffer: format XR24 isn't supported by primary backend"). Second, the 1816 fix I linked covers firmware 27.3 only (opaque-X property id 0x4f verified against the 27.3 kernelcache table) and makes no claim for the firmware this board runs; I should not have implied it transfers. What we measured, on our M5 panel with the 27.3 firmware only: buffer on the plane held the frame from two back 34 of 34 with XR24 missing, current 2987 of 2987 once XR24 was offered with X opaque. Whether that applies to 27.0/27.2 on this board is unmeasured; treat it as one data point, not guidance.

The J704 shares the J813's T8142 SoC, GPU identity (family 0xb, variant 2,
one cluster of ten core slots) and 26A428 COMMON26 firmware interface, but
not its power data. Add a J704 board on the COMMON26 graph, built from the
J813 one with the values that differ on this machine, each taken from the
J704 ADT or the init data macOS 27.0 hands its GPU firmware:

- 14 perf states (13 GPU states, 338..1620 MHz) with the J704 voltages,
  and the relative-performance table;
- the AON rows as macOS publishes them (RT0g with index 0x28);
- region C words, power-policy words (power limits 1300/38110) and the
  idle standby time, through two new board fields that are empty for the
  other boards;
- no clearing write at hw_data 0x1118, which is the 1620 MHz entry here.

Encoded on the host, the J704 HW data differs from the captured macOS data
only in runtime pointers; region C and AON are identical.

hw::t8142::select() picks the board by the root compatible (apple,j704;
everything else keeps the J813 config) and fails the probe if the
compatible cannot be read, rather than falling back to J813 values. The
new aurora.m5_probe_only=1 parameter selects PROBE, which logs the ID
registers and core masks and refuses the GPU before the UAT or the
firmware are touched, on either firmware path.

Tested on J704 (macOS 27.0 firmware, booted through aura): with
m5_probe_only the ID registers and core mask 0x3ff are logged and the GPU
is refused; without it both roles acknowledge their InitData and
"[drm] Initialized aurora 1.0.0 for 582600000.gpu" registers renderD128.
With Mesa aurora-wip, GLES 3.2 and Vulkan run on it: the dEQP GLES2, GLES3,
GLES31 and Vulkan caselists (about 1.1 million tests, on the 15 November
base) pass with the agx fixes that are being sent separately, and Ubuntu
26.04 runs with this GPU from an NFS root.

Assisted-by: LLM
Signed-off-by: termg <hello@termg.com>
Describe the J704 GPU like the J813's (t8142-j813-gpu.dtsi): sgx, the
gfx and gfx1 ASC mailboxes, pmgr_gpu with ps_gfx, and the uat-*, gfx-data
and gfx1-data reservations that the boot loader fills, plus fw-data and
fw-text, the firmware DATA and TEXT the driver reads and identifies the
build by (both at the macOS 27.0 addresses, as on the J813; the J704 ADT
gfx-asc/gfx1-asc segment-ranges give the same TEXT span). Addresses and
interrupts match the J704 ADT. The OPP table has 14 entries, since this
machine's ADT has perf-state-count 14 (the J813 has 13).

Assisted-by: LLM
Signed-off-by: termg <hello@termg.com>
The firmware-27 DCP interface asks for its provider clocks by index into
the ADT /arm-io/disp0 clock-ids, and fails to start without
apple,clock-ids. Describe them as on the J813: the J704 ADT has the same
ids, 585 and 431, and entry 0x49 of its clock-frequencies (the one 585's
low byte names) is the same 712 MHz. 431 is never asked for.

Tested on J704 (macOS 27.0 firmware, booted through aura): the DCP
driver binds, "DCP booted", eDP-1 connected and enabled at 3024x1890
inheriting the boot mode, and appledrmfb takes over the console.

Assisted-by: LLM
Signed-off-by: termg <hello@termg.com>
@term-guy
term-guy force-pushed the j704-board-upstream branch from 07d3d71 to 83650c7 Compare November 17, 2026 23:56
@term-guy

Copy link
Copy Markdown
Author

Rebased on integration/aurora 59b02d5 (the conflicts were with the 27.2 / 26B123 support). Two changes besides the rebase:

  • t8142-j704: Add the GPU now also describes fw-text, the firmware TEXT the driver identifies the build by since the J813 got it: both roles' __TEXT at 0x100_00e4_4000 + 0x9c000 under macOS 27.0, from the J704 ADT (gfx-asc/gfx1-asc segment-ranges; the same span as the J813). Without it the GPU is refused ("Unsupported GPU firmware image").
  • CONFIG_J704 admits only the 26A428 build. Through ..CONFIG it would also accept 26B123, whose build switches to CONFIG_26B123, i.e. the J813 board, so a J704 on 27.2 would silently run with the J813's power values. 27.2 on the J704 needs its own board data first (not measured here).

Tested on J704 (rebased branch + #2094 + #2095 + bring-up test trees, macOS 27.0 / 26A428 firmware): the firmware is
identified, t1-t4 pass, the GLES31/VK #826 dEQP set has only the known #395/#396 failures (Mesa aurora-wip aa1a2e5e640 + aurora-silicon/mesa#434), and 8 concurrent geometry-shader clients run 4 passes without a firmware restart.

@RyanTheTide

Copy link
Copy Markdown
Contributor

The production boot stub pins at macOS 27.2 (26B123), so please retarget this to 27.2. The J704 board data, fw-text range and DCP clocks here are taken and tested under the 27.0 (26A428) stub; please bring the J704 GPU and display up on the 27.2 stub (the 26B123 T8142 graph from #2135 is on integration/aurora now).

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks for bringing up the J704 GPU and display.

One part doesn't match how we usually select behaviour. drivers/gpu/drm/asahi/hw/t8142.rs:197-204 picks the GPU power data by root compatible: apple,j704 gets the J704 table, and every other T8142 board gets the J813's. That means a new T8142 board would quietly run with another board's voltages and perf states. We select by a hardware or device-tree property rather than by machine name, and for power data we prefer to fail closed.

This PR already adds the J704 GPU node with its 14 OPPs, and the boot loader fills the GPU node from the ADT. Could the per-board values (perf states, voltages and the other words that differ) come from that node, with the probe refusing a board whose node lacks them? m5_probe_only as a bring-up diagnostic that is off by default is fine.

This goes together with the 27.2 retarget question already open here. We can run no-regression rows on our A18 Pro and M4 Pro.

@RyanTheTide

Copy link
Copy Markdown
Contributor

One follow-up to the two open points above, so the 27.2 re-test can be done in a single pass. The display part looks right: t8142-j704-display.dtsi now has apple,clock-ids = <585 431> and the two firmware clocks, the same as t8142-j813-display.dtsi, and t8142-j704.dtb builds here.

When the board data comes from the GPU node and CONFIG_J704 admits the 26B123 build, this is the J704 row we would need, on the macOS 27.2 (26B123) stub:

  • modetest -M apple -c: eDP connected, with the panel's full 3024x1964 mode in the list. The description reports eDP-1 at 3024x1890. Could you post the full mode list, and say whether 1890 is the mode below the notch or the only mode offered?
  • backlight: write 3 values (minimum, middle, maximum) to /sys/class/backlight/*/brightness. actual_brightness should follow each one, and the panel should visibly change.
  • drm/asahi probes on the 26B123 firmware with the J704 board (dmesg shows the selected board and its 14 perf states). After that, vkcube runs for 60 s, and glmark2-es2-drm (or glmark2-wayland) completes with its score posted.
  • dmesg for the whole session: no DCP or RTKit crash, no GPU firmware restart, and no asahi timeout.

Please post the dmesg, the mode list and the glmark2 output. We will then run the same driver change on our A18 Pro and M4 Pro to check that nothing regresses.

@RyanTheTide

Copy link
Copy Markdown
Contributor

@term-guy, a follow-up to the review above, about the rest of the J704 rather than this PR. To bring the J704 up to the J813/J815 level we need a few things that only a J704 can give us.

  1. ADT values. The aura proxy is enough: tools/shell.py, then print(u.adt["/arm-io/<node>"]). The nodes we need: dispext*/dp-switch and the HDMI route, the audio amp i2c addresses and speaker order, the camera sensor-type, spi2 + mesa (Touch ID), hpm (MagSafe), and acio0/1/3.
  2. Rows once each DT patch lands. We write the DT from your ADT values and credit you:
    • External displays: a USB-C DP monitor on each of the 3 ports (modeset + hotplug x3), an HDMI monitor modeset, and aplay -l listing the HDMI/DP card.
    • Audio: jack insert shows in evtest, headphone playback works, arecord on the 3 mics gives non-zero peaks (post the numbers, not the recording). The amps must probe with the speakers at the safe level. Please don't play anything through the speakers.
    • Camera: v4l2-ctl --list-devices, then a 30 s capture with no ISP firmware crash in dmesg.
    • Touch ID: the SEP boots, enrol + match, suspend/resume x3, match after resume. Once soc: apple: sep: select the platform profile by SoC #2311 lands, the SEP profile is chosen by the SoC, so the J704 only needs its SEP/spi2/mesa DT.
    • MagSafe + TB4: charging shows in /sys/class/typec and power_supply. A TB4 dock enumerates on each port (boltctl list, lspci -t), hotplug x3.
    • USB device mode (you already run an NFS root over NCM): once the dwc3-apple change that lets the PHY decide host-only lands, please re-run the NCM gadget and post iperf3 numbers and cat /sys/class/udc/*/current_speed, so we know the J704 keeps device mode.

dmesg plus the command output, here or in a new issue, is perfect. Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants