Skip to content

drm/apple: T6050: one display coprocessor restart per wake (panel lit 0.84 s after the wake) - #2029

Merged
DjDeveloperr merged 5 commits into
integration/aurorafrom
j714s/dcp-v27-one-restart
Nov 16, 2026
Merged

DjDeveloperr merged 5 commits into
integration/aurorafrom
j714s/dcp-v27-one-restart

Conversation

@DjDeveloperr

@DjDeveloperr DjDeveloperr commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

With #2028 the J714s's internal panel lights about three seconds after each wake from a deep sleep. Most of that time goes into steps of macOS's dark wake, where macOS leaves the display off until user activity makes the wake a full one. A Linux wake is a full wake, and macOS's full wake restarts each display coprocessor once, right after its first A500; the hard power-on, the display stage and the plain power-on then follow back to back in that one session, with no A500 or idle between the calls. Each external display coprocessor is likewise restarted once and gets its wake calls in the new session.

This makes that the default:

  • v27_rtkit_cycles=1: the single restart. 2 brings back the A500 and the restart after the hard power-on, 3 also the restart after each display stage call (with v27_lit_delay_ms=2000, the previous form).
  • v27_lit_delay_ms=0: no pause between the hard power-on and the display stage.
  • v27_ext_a500_again=0: one A500 and one restart per external coprocessor.

Dependencies

#2028 (and, through it, #2027): this PR includes their commits; review only the top commit here. The tested configuration also has #2030.

Testing

J714s, the private test stack whose public form is #2027 + #2028 + this + #2030 (the run's kernel also had console diagnostics and a forced-refusal switch, which are not in this series). Wi-Fi and Bluetooth connected, an external 4K display on the dock, RTC alarm about 28 s after entry:

Sleep Asleep / alarm due (s) Panel lit after the wake Restarts: panel, ext0-3 After the wake
1 29.0 / 28.3 0.84 s 1; 1, 1, 1, 1 backlight back at its level; GPU, AOP, SIO, camera back; external at 3840x2160@120
2 28.4 / 27.7 0.84 s 1; 1, 1, 1, 1 same
3 28.4 / 27.8 0.84 s 1; 1, 1, 1, 1 same
4 forced .enter refusal 0.79 s 1; 1, 1, 1, 1 back to normal; external at 3840x2160@120

No display coprocessor crash, underrun or failed restart in any pass.

Checks

🤖 Generated with Claude Code

After a strict warm restart, as after a sleep or a stop and restart of a
coprocessor in place, every buffer request has to be answered from the
buffers kept from the first boot, and a request for one that was never
set up fails the boot with -EPROTO. The firmware asks for its crash log's
buffer only when it crashes, so that buffer is normally never set up
before a restart, and a crash after one ended the boot with -EPROTO
instead of giving its crash log.

Serve the crash log endpoint's buffer request after a strict restart as
at the first boot. Every other endpoint keeps the strict rule.

Signed-off-by: Diljit Singh <[email protected]>
On the T6050 (M5 Pro) each firmware 27 display coprocessor is stopped
and restarted once after a wake, outside the system sleep (the display
driver's part follows in the series). Its DART has to go down and come
back with it, and the internal display pipe's DART loses the streams
Linux owns when the display's power domain is cycled for that restart.

Three helpers for the display driver:

- apple_dart_m5_display_cycle(): at a stop, the error interrupts masked
  and cleared, the coprocessor's streams 23 and 24 disabled one write
  each, a TLB flush, then the DART's GAPF slice set to 0x2; before a
  start, the slice back to 0x12, the diagnostic lock and the error mask
  cleared and both streams enabled. These are the writes macOS makes
  around every stop and run bit of a display coprocessor. No translation
  table is touched. The display coprocessors' DARTs have no GAPF range
  in the J714s's tree, so each one's slice is found by the DART's
  address.
- apple_dart_m5_display_snapshot(): before the display's domain goes
  off, every stream with a valid context is remembered, with the enabled
  streams.
- apple_dart_m5_display_rewrite(): once the domain is back on, every
  stream that is not one of the firmware's locked ones and no longer
  reads as remembered is written back, and the TLB is flushed. Without
  it the firmware's first scan-out after the restart faults on the
  framebuffer stream's cleared context entry.

Only a T8110-type DART is accepted, and only the J714s's display
coprocessors' DARTs have a slice.

Signed-off-by: Diljit Singh <[email protected]>
…its restart

On the T6050 (M5 Pro) each firmware 27 display coprocessor is stopped
and restarted once after a wake, outside the system sleep. A stopped
display coprocessor starts again only if its power domains are cycled
between the stop and the start, as macOS does at that point: with the
domains left on, the firmware gives no HELLO after the run bit.

Two helpers for the display driver, both on the sleep profile's display
power words (ps.disp[]):

- apple_sleep_m5_display_power(): the internal display's CPU, FE and
  SYS words, lowered (CPU, the coprocessor core's gate pair, CPU, FE,
  SYS) or raised (SYS, FE, CPU, the gate pair, CPU), each step polled
  until its state has settled. The display pipe DART's own streams are
  remembered before the power-off and written back after the power-on
  (m5_disp_dart_rewrite=0 leaves them). The display driver makes the
  PMC requests around it.
- apple_sleep_m5_dispext_power(): the same for one external display
  coprocessor, found by its device, with its bits in the PMC's boost and
  bandwidth enable words cleared before the power-off and set after the
  power-on. The PMC's request word is left alone: the other external
  coprocessors stay on.

The values and the order are the ones macOS uses for these restarts.
The sleep's entry and exit don't call either; both refuse unless the
T6050 profile is the one running.

Signed-off-by: Diljit Singh <[email protected]>
On the T6050 (M5 Pro, firmware 27) the internal panel stays dark after
a deep sleep: the display coprocessor boots again from its stopped CPU
and answers the wake's calls, but the panel is not lit, and a display
on an external coprocessor does not come back. macOS restarts each
display coprocessor again between its wake calls; this does the same.

The restart, dcp_v27_rtkit_cycle(): every session closed, the
coprocessor idled, its receive side off and its CPU stopped; its DART
stopped; for the internal display, the display PMC handshake and the
display domain's power words off; at least v27_cycle_hold_ms (12 ms)
with the domain off; then the words on, the PMC handshake, the DART
started and the display pipe DART's Linux-owned streams written back;
a strict warm restart, the run bit, the boot and every session open
again. An external coprocessor's restart has its own power words and
PMC bits instead, and one retry with a longer time off when its
firmware gives no HELLO. A failed restart is logged, no other is tried
in that wake, and the wake goes on.

The internal display's wake (v27_rtkit_cycles=2): A500's wake form and
a restart; A489, the flags-form A484(1) and A115(1); A500 and a restart
held through v27_lit_delay_ms (2 s); the display stage with a restart
after each of its calls; the plain A484(1) with an out-of-band A442
beside it. That is macOS's dark wake followed by its lit wake, and the
panel lights about three seconds after the wake.

An external coprocessor's wake: A500's wake form and a restart (or,
with v27_ext_cycles=0, its sessions closed and opened again); A489,
with A442 beside it on a coprocessor that had a display; the flags-form
A484(1); A115(1); A500 again with a second restart.

The sleep side: A489 before and A115 after each flags-form A484
(v27_a115), and, when the display sleeps before the hard off, its DART
stopped right after its plain A484(0): stopped before the display
stage, the still-lit pipe reads through it and the firmware dies of a
bus error at A414.

The panel's backlight level is kept through a firmware 27 sleep
(v27_keep_level), as macOS does, so that the first frame after the
wake carries it rather than 0.

The host selftest that builds dcp_set_brightness() gets mocks for the
level switch and pm_suspend_via_firmware().

Each step has a module parameter. All of it runs only on a T6050 DCP or
DCPEXT on firmware 27 with the late display sleep selected
(dcp_v27_sleep_selected()), and the PMC handshake only with the J714s's
display register block.

Signed-off-by: Diljit Singh <[email protected]>
The internal panel lit about three seconds after each wake. Most of
that time went into steps of macOS's dark wake, which the wake had
copied: there macOS leaves the display off until user activity makes
the wake a full one, then lights it. A Linux wake is a full wake.

- v27_lit_delay_ms held the display's domain off for 2 s between the
  hard power-on and the display stage. A full wake has no such pause.
- After the hard power-on the display coprocessor was given A500 and
  restarted a second time, and then restarted again after each of the
  display stage's six calls, with A500 before each stop. macOS does that
  only in its dark-to-lit step. Its full wake restarts each display
  coprocessor once, right after its first A500, and the hard power-on,
  the display stage and the plain power-on follow back to back in that
  one session, with no A500 or idle between the calls.
- Each external coprocessor was restarted a second time after its A115
  (v27_ext_a500_again). A full wake restarts it once too, and gives it
  its wake calls in the new session.

That is now the default: v27_rtkit_cycles=1 is the single restart,
v27_lit_delay_ms=0, and v27_ext_a500_again is off. v27_rtkit_cycles=2
adds the A500 and restart after the hard power-on, and 3 also the
restart after each display stage call (with v27_lit_delay_ms=2000, the
previous form).

On the J714s the panel is lit 0.84 s after the wake, with one restart
of its display coprocessor per wake.

Signed-off-by: Diljit Singh <[email protected]>
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.

1 participant