Skip to content

drm/asahi, drm/apple: J813 (M5 MacBook Air) GPU and display on the macOS 27.2 firmware - #1683

Closed
sithglan wants to merge 5 commits into
aurora-silicon:integration/aurorafrom
sithglan:thomas/j813-272
Closed

sithglan wants to merge 5 commits into
aurora-silicon:integration/aurorafrom
sithglan:thomas/j813-272

Conversation

@sithglan

@sithglan sithglan commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Base: integration/aurora (cae47c0), which has #1174 (the firmware 27 method table per build). Branch thomas/j813-272, five commits.

This brings up the J813 (M5 MacBook Air, T8142, G17G) under a macOS 27.2 (26B123) stub: the GPU on the 26B123 G17G firmware and the panel on the 27.2 DCP firmware. 27.0 (26A428) keeps working as before; the J813 picks the interface from the firmware it finds.

It needs aurora-silicon/aura#192, which fills the GPU fw-text region and publishes 27.2 as the OS firmware version. Without it, the DT keeps the 27.0 fw-text address. The GPU then sees an unknown image and refuses to start it, and the DCP gets compat <0 0 0>: the same crash as today.

What 27.2 changes

All of it was read from the J813's own 27.2 restore image (kernelcache.release.mac17g, armfw_g17g, armfw1_g17g, t8142dcp) and compared with 27.0.

GPU (RTKit 3514.41.1, the same firmware family as the J873's 26B123 G18G in #1652, and the same deltas):

  • The InitData root version word is 0x0c8b_6339_83a0_04c0 (bit 45 added).
  • The policy grows 0x60 bytes: 0x7168 -> 0x71c8 for G17G, 0x7800 -> 0x7860 in the common table. It moves in three bands: [0, 0x2f0c) +0, [0x2f0c, 0x2f18) +0x10 and [0x2fb4, 0x6da0) +0x18. A new word at +0x2f28 is 5000.
  • The status config grows 8 bytes, 0x6d0 -> 0x6d8: [0x59c, 0x5b4) +4 and [0x5b4, 0x6d0) +8, with a new word at +0x5b8 = 5000.
  • The power controller's +0x1122c is 5000.
  • Everything after the policy in the shared cluster moves +0x80. The private cluster is unchanged.
  • iBoot loads the GPU TEXT 64 KiB higher (0x100_00e5_4000) and the data 80 KiB higher (0x100_0245_8000).

DCP: 27.2 renumbers the AP -> DCP methods. #1174 has the 27.2 table from the T6050. The J813's own IOMobileGraphicsFamily-DCP and AppleMobileDispH17G-DCP, compared with 27.0's by method name, agree with it entry for entry. UnifiedPipeline2 gained getDisplayCaps at A380, so A380-A399 move up by one. Every IOMobileFramebufferAP and DCPPowerManager method moves up by 50: A427 get_color_remap_mode is A477, A408 swap_submit_dcp_main is A458, A484 setPowerState is A534. Everything else matches 27.0: the in/out sizes (swap_submit_dcp stays 0x1d30), the DCP -> AP callbacks, and the methods below A380. The one entry #1174 leaves out is dfb_ready_query (UnifiedPipeline2::headless), which is A385 (27.0: A384). #1174's own 27.3 trace sends it there as well.

The commits

  1. arm64: dts: apple: t8142-j813: Describe the GPU firmware TEXT: a fw-text reserved-memory node, which aura fills from the ADT. Its static value is the 27.0 placement, like fw-data.
  2. drm/asahi: g17: M5: InitData for the macOS 27.2 (26B123) common firmware: a 26B123 profile of the common 26A428 graph. The 26A428 encoding is moved by the bands above, and a byte that no band carries is refused rather than dropped. The 26A428 encoding is unchanged.
  3. drm/asahi: t8142: Identify the J813 GPU firmware and admit macOS 27.2: the J813 identifies the loaded build by the TEXT digest, as the T6041/T6050 do (Firmware::Identified), and gets the 26A428 or 26B123 config. An unknown build is refused. There is a new KUnit case, t8142_identifies_each_build.
  4. drm/apple: dcp: T8142: Drive the macOS 27.2 firmware: T8142 admits apple,firmware-compat 27.2.0 as firmware 27, so probe picks drm/apple: traced firmware 27.3 IOMFB method IDs #1174's 27.2 table.
  5. drm/apple: dcp: Give firmware 27.2 its dfb_ready_query: A385 in the 27.2 table, so 27.2 boots with the same sequence as 27.0. Without it, boot_5() skips the query. This also applies to the T6050 on 27.2; it is a separate commit so it can be dropped on its own.

Testing

All of this is on the J813 under the 27.2 stub, with aura aura-j813-272a (the J813's enrolled branch plus aurora-silicon/aura#143's fw-data and aurora-silicon/aura#192's two commits), chainloaded in place from the DebugUSB proxy. This head (4592ae5, built as 7.3.0-aurora-j813-272+) and the same series on integration 3d6f0f5 (where the J813 still carried its own 27.2 table with A385) were both booted through aura-try with the kernel's own DTB, so aura filled fw-text and fw-data:

  • Ten CPUs. The GPU reports "GPU firmware: 27.2 (26B123), G17G", and EGL and Vulkan see "Apple M5 (G17G C0)". The DCP gets compat <27 2 0> and boots with no crash; its boot callback chain completes, so it answered dfb_ready_query at A385. eDP-1 runs at 2560x1600, appledrmfb binds, and sway runs on the panel: the plane alternates between sway's framebuffers as the bar redraws, and no swap fails. The sound card is present.
  • CTS with Mesa j813 (/opt/mesa-j813, JOBS=4), on the 3d6f0f5 build. drivers/gpu/drm/asahi is identical on this head:
  • Each of the five commits builds (Image.gz, modules, dtbs; LLVM 22).
  • KUnit asahi_fwid: 9 passed, 1 skipped (the j713 case, which skipped before this series too). The new t8142_identifies_each_build passes.
  • The first three commits on integration 9746918 were also booted with aura 27av, which publishes no 27.2 version and fills nothing, using a DTB that carries the 27.2 addresses. The GPU ran the same CTS there: 16955/0, 44379/1 (texture.units.8_units.mixed.8, which passes alone 3 of 3) and 37339/0. With all four commits under 27av, the DCP gets compat <0 0 0>, falls back to H17P and crashes on A427, as it does today.

Known on 27.2, and as far as I can tell on firmware 27 generally:

  • The DCP's powerlog-service is announced with only ep-has-desc-mgr and interface-id. The AFK name fallback covers only the H17G profile, and T8142 on firmware 27 runs the default profile, so the service is not bound ("AFK[ep:20]: failed to extract init props: -2") and no loader brightness arrives. The backlight starts from the fallback level.
  • A new KMS client's surfaceless first present can be dropped at the backlight step ("present dropped: backlight prepare -61"). Sway runs normally afterwards.
  • Both are left for a follow-up.

cc @Acelogic @DjDeveloperr @RyanTheTide @LiamRay10

@sithglan

Copy link
Copy Markdown
Contributor Author

Rebased onto cae47c0 right after opening, because #1174 had just merged. The J813's own 27.2 method table is gone in favour of #1174's per-build tables. They agree entry for entry with what the J813's 27.2 kernelcache gives, so T8142 now only admits 27.2.0. The one entry #1174 leaves out, dfb_ready_query at A385, is a separate commit on top. The new head was booted on the J813 under 27.2 (DCP, panel, sway, GPU) and ran GLES2 at 16955/0.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Reviewed the build identification, the band relayout and the T8142 firmware-compat change. The J700 and other profiles keep their old values in every edited match, and the CTS runs on the 27.2 stub cover it.

@sithglan one change before this goes in: the dcp_methods_27_2 comment says the A385 tag comes from the J813's 27.2 kernelcache. Please describe it from your own 27.3 call trace only and drop the kernelcache reference.

The J813 GPU driver is about to identify the firmware build iBoot loaded
before it starts it, as the M5 Pro and Max do: it measures both roles'
__TEXT, which iBoot loads back to back (ADT gfx-asc and gfx1-asc
segment-ranges, 0x50000 + 0x4c000 bytes).

Add the region as fw-text. Like fw-data, it is fixed at the address
iBoot uses under macOS 27.0 (26A428), 0x100_00e4_4000, until the boot
loader fills it in. Under 27.2 (26B123) iBoot loads the TEXT 64 KiB
higher, at 0x100_00e5_4000, and the DATA at 0x100_0245_8000, so a 27.2
boot needs a loader that fills both.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The J813 runs the common 26A428 InitData graph, the J873's interface. macOS
27.2 (26B123) ships a new G17G build (RTKit 3514.41.1), which never
acknowledges that graph: the secondary's InitData times out.

The 26B123 interface differs from 26A428 in three places, the same three
as the J873's G18G build of this release:

- both roles expect the InitData root version word with bit 45 set,
  0x0c8b_6339_83a0_04c0;
- the policy grows by 0x60 and the status config by 8; the other 22
  allocations keep their sizes. Everything after the policy in the shared
  cluster moves by 0x80; the page total and the private cluster (0x6d8
  still packs to 0x700) stay as they are;
- policy fields +0x2f0c..+0x2f17 move by 0x10 and +0x2fb4..+0x6d9f by
  0x18, with a new word at +0x2f28; status-config fields +0x59c..+0x5b3
  move by 4 and +0x5b4 to the end by 8, with a new word at +0x5b8 and
  +0x59c left zero. The new words carry a new accelerator power-controller
  field, which the generic power and performance setup sets to 5000 and
  the G17G one leaves alone.

The HW data, the roots, the main configs, status B and region C keep
their field offsets.

Add the 26B123 profile and graph. The 26A428 encoders run unchanged and
their policy and status config are moved in place by bands; a nonzero
byte no band carries is refused. Compile-time checks keep the bands
ascending and inside the new sizes. The board for it is J813_26B123; no
configuration selects it yet, and the 26A428 encoding is unchanged.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The J813 ran a fixed variant: it started whatever firmware iBoot had
loaded on the 26A428 graph. Under the macOS 27.2 stub that is the 26B123
build, which needs its own graph.

Identify the loaded build as the M5 Pro and Max do, from the fw-text
region: both roles' TEXT (G17G c000, then c010), with the entropy
records and the ranges iBoot fills zeroed (the image header's load
fields, the boot arguments before each role's GKTS record and the
records from it). The 26A428 build keeps the J813 configuration; the
26B123 build runs the board on the 26B123 graph. Both digests reproduce
from the stock images in the IPSWs with the same ranges zeroed and were
measured on 27.0 (two boots) and 27.2 boots. An unknown build is refused
before anything is written to the GPU.

Tested on a J813 under the macOS 27.2 stub, with fw-text and fw-data at
the 27.2 addresses: both roles acknowledge the 26B123 InitData, the
render node registers, and Mesa runs GLES2 16955/0, GLES3 44379/1 (an
order-dependent texture-units case that passes alone) and GLES31 37339/0,
matching the 27.0 results.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
On a macOS 27.2 (26B123) stub, the J813 refuses its DCP's
apple,firmware-compat of 27.2.0. It then drives the DCP with the H17P
interface, and the 27.2 DCP firmware crashes on the first call
("ap_link: rpc_callee_gated: link_rpc_lookup callback not found:
'A427'").

The firmware 27.2 method table (iomfb_v27_methods("27.2.0")) drives the
J813's 27.2 DCP: with it the DCP boots, the panel comes up at 2560x1600
and sway presents on it.

Admit 27.2.0 on T8142 as firmware 27, so that probe picks that table.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The firmware 27.2 table has no ID for dfb_ready_query, so boot_5()
skips the query on 27.2. The 27.3 trace sends it at A385, one above its
27.0 ID, as 27.2 moved set_create_DFB and vi_set_temperature_hint up by
one.

Give the 27.2 table A385, so 27.2 boots with the same sequence as 27.0.
The J813 ran with this table on 27.2: boot_done() acknowledges the DCP's
boot callback only after the query's reply, and the DCP booted and the
panel came up.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
@sithglan

Copy link
Copy Markdown
Contributor Author

@RyanTheTide done, force-pushed as 17229b9 (was 4592ae5; the diff between them is comments and commit messages only).

  • dcp_methods_27_2: the A385 comment now says what we observed: the 27.3 trace sends dfb_ready_query at A385, and the J813's DCP answers it there on 27.2. The kernelcache reference is gone.
  • I applied your drm/asahi: g18: J873 G18G on the macOS 27.2 (26B123) firmware #1652 note here as well. The 26B123 InitData comment block in g17/fw/m5/initdata.rs described the change by kext functions and image offsets; it now describes it by the fields and sizes only. The three commit messages that cited the kernelcache or kext (InitData, DCP 27.2 admission, dfb_ready_query) are reworded the same way.

The fw-text build tables in hw/t8142.rs keep their image ranges, as the T6041/T6050 tables do: the identification hashes those ranges. The asahi and apple drivers build.

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

gig3m pushed a commit to gig3m/linux that referenced this pull request Nov 17, 2026
hw.s2r stops the internal DCP's firmware and powers its domains off when
the display is turned off, and restarts it warm on DPMS on. Only T8140
had the data for it. This adds what T8142 needs:

- the power words and DART streams become a per-SoC layout
  (dcp_s2r_layout), with T8140's values unchanged and T8142's derived
  from the macOS 27.2.1 device tree and PMGR (DISP_SYS at 0x290,
  retention words 0x11cc/0x11f0, no exclave streams, no pmc-dcp);
- the firmware 27 sleep calls: set_power_state, D572 (powerUpDART) and
  the AP link's release, which 27.0 dispatches as A500 and 27.2 as A550
  (aurora-silicon#2063, the first commit of this series). A build whose table has no
  tag for the release (27.3 so far) is not offered the stop;
- T8142 has no DCP secure mailbox (no dcp-exclave-mailbox in the 27.0 or
  the 27.2.1 device tree of a J813), so the stop no longer requires one
  on this SoC (s2r_no_secure_port).

The stop stays off by default on T8142 (appledrm.s2r_untested=1 enables
it). On firmware 27.2 it also needs the DCP to run the firmware 27
interface there, which aurora-silicon#1683 ("drm/apple: dcp: T8142: Drive the macOS
27.2 firmware") adds; without it a 27.2 J813 runs H17P and the stop is
not offered.

This is a screen-off (DPMS) power saving. A SoC behind
appledrm.s2r_untested does not take the stop's system sleep path.

Tested on a J813 (MacBook Air 13" M5) with appledrm.s2r_untested=1:
- firmware 27.0, on this series with and without the option: DPMS off
  stops the firmware, DPMS on restarts it ("RTKit: Initializing") and
  the panel comes back at its brightness, 6 of 6 cycles. System power
  with the screen off (SMC PSTR, on battery, 12 and 15 samples): 2.72 W
  without the stop, 1.81 W with it.
- firmware 27.2 (t8142dcp 26B123), with the A550 entry: DPMS off logs
  "IOMFB: power on -> off" and "power_down_M3: disabling M3", DPMS on
  restarts the firmware ("RTKit: Initializing") and the panel comes back
  at its brightness, 3 of 3 cycles. Screen-off system power (SMC PSTR,
  on AC at the charge limit, 8 samples per cycle, 3 cycles each, the
  same boot setup with appledrm.s2r_untested=0 for the other side):
  4.84 W without the stop, 3.91 W with it.

m0d16l14n1 ran it on a J815 on firmware 27.2 with the A550 entry: 4 DPMS
cycles over 3 boots, the firmware stopped and restarted each time.

The driver part is from m0d16l14n1's J815 sleep work
(m0d16l14n1#1, 192a56c), without its hibernation and deep
sleep pieces; the secure mailbox change and the J813 test are new.

Assisted-by: Claude Opus 5.5
Assisted-by: Claude Fable 5.2
Signed-off-by: Kyle Arrington <kyle@arrington.co>
gig3m pushed a commit to gig3m/linux that referenced this pull request Nov 17, 2026
hw.s2r stops the internal DCP's firmware and powers its domains off when
the display is turned off, and restarts it warm on DPMS on. Only T8140
had the data for it. This adds what T8142 needs:

- the power words and DART streams become a per-SoC layout
  (dcp_s2r_layout), with T8140's values unchanged and T8142's derived
  from the macOS 27.2.1 device tree and PMGR (DISP_SYS at 0x290,
  retention words 0x11cc/0x11f0, no exclave streams, no pmc-dcp);
- the firmware 27 sleep calls: set_power_state, D572 (powerUpDART) and
  the AP link's release, which 27.0 dispatches as A500 and 27.2 as A550
  (aurora-silicon#2063). A build whose table has no
  tag for the release (27.3 so far) is not offered the stop;
- T8142 has no DCP secure mailbox (no dcp-exclave-mailbox in the 27.0 or
  the 27.2.1 device tree of a J813), so the stop no longer requires one
  on this SoC (s2r_no_secure_port).

The stop stays off by default on T8142 (appledrm.s2r_untested=1 enables
it). On firmware 27.2 it also needs the DCP to run the firmware 27
interface there, which aurora-silicon#1683 ("drm/apple: dcp: T8142: Drive the macOS
27.2 firmware") adds; without it a 27.2 J813 runs H17P and the stop is
not offered.

This is a screen-off (DPMS) power saving. A SoC behind
appledrm.s2r_untested does not take the stop's system sleep path.

Tested on a J813 (MacBook Air 13" M5) with appledrm.s2r_untested=1:
- firmware 27.0, on this series with and without the option: DPMS off
  stops the firmware, DPMS on restarts it ("RTKit: Initializing") and
  the panel comes back at its brightness, 6 of 6 cycles. System power
  with the screen off (SMC PSTR, on battery, 12 and 15 samples): 2.72 W
  without the stop, 1.81 W with it.
- firmware 27.2 (t8142dcp 26B123), with the A550 entry: DPMS off logs
  "IOMFB: power on -> off" and "power_down_M3: disabling M3", DPMS on
  restarts the firmware ("RTKit: Initializing") and the panel comes back
  at its brightness, 3 of 3 cycles. Screen-off system power (SMC PSTR,
  on AC at the charge limit, 8 samples per cycle, 3 cycles each, the
  same boot setup with appledrm.s2r_untested=0 for the other side):
  4.84 W without the stop, 3.91 W with it.

m0d16l14n1 ran it on a J815 on firmware 27.2 with the A550 entry: 4 DPMS
cycles over 3 boots, the firmware stopped and restarted each time.

The driver part is from m0d16l14n1's J815 sleep work
(m0d16l14n1#1, 192a56c), without its hibernation and deep
sleep pieces; the secure mailbox change and the J813 test are new.

Assisted-by: Claude Opus 5.5
Assisted-by: Claude Fable 5.2
Signed-off-by: Kyle Arrington <kyle@arrington.co>
@sithglan

sithglan commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

All five commits of this PR are already in integration/aurora (0abc2f3), patch-identical, through the J813 merges (#2135 and #2063's line): f68394b, b70bc80, adc54e1, 6f565e2 and the J813 fw-text DT node. Nothing is left to merge, so I'm closing this PR.

@joshuaswarren thanks for the heads-up and the correction. The J813 here runs sway, and sway runs on this plane. gig3m reported the same missing XRGB8888 on the J813 under stock Hyprland in #2135; that belongs to the T8142 plane setup in apple_drv.c, not to this PR.

@sithglan sithglan closed this Nov 18, 2026
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