Skip to content

J813: H17G backlight, CoreAnalytics reply, soft DPMS and colours (MacBook Air M5) - #1002

Merged
Acelogic merged 4 commits into
aurora-silicon:aurora-wipfrom
sithglan:j813/rb/display
Nov 6, 2026
Merged

Acelogic merged 4 commits into
aurora-silicon:aurora-wipfrom
sithglan:j813/rb/display

Conversation

@sithglan

@sithglan sithglan commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Four fixes to integration's drm/apple for the MacBook Air M5 (J813, H17G DCP firmware), which otherwise already drives the J813 panel:

  • Backlight control: H17G announces powerlog-service with only ep-has-desc-mgr and interface-id, so the service carrying the brightness reports never bound ("AFK[ep:20]: failed to extract init props: -2"); match it by name for the H17G method profile only. H17G ignores the DAC words and takes nits in the H17P swap encoding, so the flush uses that encoder on H17G.
  • CoreAnalyticsSendEvent: answer H17G with the empty dictionary as on H17P. The zeroed reply fails the firmware's OSDictionary deserialization and the DCP panics with "app NMI" one hour after boot.
  • Soft DPMS: blank the H17G internal panel instead of stopping the pipe, so the panel comes back after lid close and idle-off.
  • Colours: H17G blends the fourth byte of an XRGB surface as alpha and ignores the opaque-X property, as H17P does. The primary plane now offers only formats with alpha, and the fbdev console is ARGB as on H17P. Before this, sway scanned out XR24 and blue and cyan text showed as black and grey on the panel, although the pixels in memory were right.

Tested on the J813: backlight control was verified on the J813 kernel this comes from (apple-panel-bl 0-500 nits, actual_brightness follows, the powerlog error gone; DPMS and CoreAnalytics as described above). On the rebased tree (integration/aurora 11eccbe with all nine J813 branches) drm/apple drives the panel through a full boot; the brightness and DPMS retest on this exact base is still to be done.

Stability caveat: a second boot of the same image hung about 38 s in, just after the NTP step set off the daily fstrim/apt timers, with no panic record (no pstore). The first boot went through the same timer burst and stayed up for minutes. Until the hang is understood, the combined tree is not proven stable across reboots.

cc @Acelogic @DjDeveloperr @RyanTheTide @LiamRay10

On H17G the system endpoint announces powerlog-service on channel 1 with
only ep-has-desc-mgr and interface-id, so parse_epic_service_init()
returned -ENOENT and the service carrying the mNits reports never bound.
Match such announces by their name, as props-less announces are
(only for the H17G method profile, so H17P is unchanged).

H17G publishes no NITS property, so register the backlight device from
the first powerlog report instead (140 nits at boot on the J813).

H17G firmware ignores the DAC words (bl_unk/bl_value/bl_power at
swap+0x32f) and takes the H17P brightness encoding in the same swap
bytes (activation at +0x354, binary64 nits at +0x35e, ceiling pair at
+0x36e/+0x376), which the unserialized 26.6 request already spans.
Factor the H17P encoder to take the swap record and use it from the
flush on a brightness update.

Tested on the MacBook Air M5 (J813): apple-panel-bl 0..500 nits; writes
of 100/300/140 give DCP "send_brightness" at those levels and matching
actual_brightness, and the panel follows.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
…pty dict

The M5's DCP (H17G) panicked with "app NMI" one hour after every boot,
taking the display with it. Its crash log shows "OSDictionary
deserialization failed": D114 CoreAnalyticsSendEvent was answered with
trampoline_zero on H17G, so the reply starts with 0 instead of an
OSDictionary. H17P already returns an empty dictionary ('d', 0x1004
bytes); D114's sizes are the same on H17G (0x1044/0x1004), so use that
reply there too.

DJ identified the analytics callback as the one-hour trigger.

Tested on J813 (M5 MacBook Air): two boots run past one hour (3799 s,
4269 s+) without a DCP crash; before, every boot crashed at about 3600 s.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
On the M5 (H17G) internal panel, DPMS off stopped the DCP pipe:
setPowerState(0) times out and the following setPowerState(1) is never
answered ("wait for power timed out, connector will be broken"), so the
panel stays frozen after a lid close or a compositor's output power off.

Keep the pipe running instead, as H17P soft DPMS does: DPMS off submits
a black, surface-free clear swap that also takes the backlight to 0 nits;
DPMS on only requests a brightness update, and the next frame restores
scanout and level.

Tested on J813: fbdev blank/unblank and sway output power off/on cycles
and a lid close/open; the firmware reports brightness 0 and back to the
previous level, no timeouts.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The H17G (M5) DCP firmware blends the fourth byte of an XRGB surface as
alpha, and it ignores the opaque-X property as H17P does. A compositor
that picks XRGB8888 leaves that byte to whatever its renderer stored:
the GPU-rendered sway output on J813 showed blue and cyan text as black
and grey while the pixels in memory were right.

Offer the overlay formats, which all carry alpha, on the H17G primary
plane, so that compositors write the byte. Treat the fbdev console the
same way as on H17P: an XRGB console with X = 0 stays black.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
@Acelogic
Acelogic changed the base branch from integration/aurora to aurora-wip November 6, 2026 06:21
@Acelogic
Acelogic merged commit 3150812 into aurora-silicon:aurora-wip Nov 6, 2026
RyanTheTide added a commit that referenced this pull request Nov 6, 2026
Carries the work merged on aurora-wip since #1018 into the release
branch: M5 T8142/J813 bring-up (#995 #996 #997 #998 #1001 #1002 #1003),
T8152/J873 bring-up (#984 #1009 #1013 #1022), J813 AVD/ISP (#1026)
and the selftest harness updates (#1014). The merge is clean; the 13
integration/aurora commits since #1018 are kept.

Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>
Assisted-by: LLM

MrNews89 commented Nov 6, 2026

Copy link
Copy Markdown

On J815/T8142 (15-inch M5 Air, 25G76), GPU/MSAA/AVD/Wi-Fi pass, but DCP startup times out. D408 requests service PROV (0x50524f56), arg=0. The public H17P handler rejects arg 0; Linux has a 24 MHz primary clock and no clock-194. Same-boot ADT has 174 clock-frequency cells and disp0 IDs 0x249/0x1af, outside the older id-256 lookup.

On the working J813 boot, does D408 request PROV/0, and what rate/source supplies the reply? Which exact combined kernel and aura commits produced the working panel, and is another provider-property/clock handoff required?

@Acelogic

Acelogic commented Nov 6, 2026

Copy link
Copy Markdown
Member

@MrNews89 Thanks for the trace. I checked aurora-wip at 5778921cef98: the clock decoder only accepts 0x154 and 0x194, and does not inspect service. For ID 0, it returns -ENOENT; the D408 wrapper then replies with a zero rate. So the mismatch you identified is present. This PR does not change that path. The zero reply alone does not establish the intended rate or whether it fully explains the startup timeout.

The working J813 boot reported here used 11eccbedc3ed plus the nine J813 branches. The newer report in #997 documents a working panel after rebasing onto c6cc36e4, booted as 7.3.0-aurora-j813-rb+. Those reports do not identify the final combined kernel SHA, installed aura SHA, or D408 request/reply, so I cannot confirm that the working J813 also requests PROV/0.

@sithglan Could you share, from the working J813 boot:

  • The combined kernel SHA and installed aura revision, including any local changes.
  • The raw D408 request/reply and the source of the returned rate.
  • The corresponding disp0 ADT clock properties and Linux DT clock/provider properties.

That comparison should help distinguish H17G callback semantics from a missing clock/provider handoff. We do not yet have evidence that the 24 MHz primary clock is the correct reply to PROV/0.

@sithglan

sithglan commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

@MrNews89 @Acelogic Both J813 questions: yes, the working J813 makes the identical D408 call, and nothing supplies the rate — the reply is a plain zero.

1. The raw D408 request/reply on the working J813 (live configured boot, kernel 7.3.0-aurora-j813-rb+ #9, integration/aurora c6cc36e4 plus the nine J813 branches; the same four lines also appear in the 7.3.0-aurora-j813+ boot on 11eccbedc3ed and in the 2026-11-01 7.1.12-aurora-j813-pm+ boot, so it is not kernel-base dependent):

[1.584020] apple-dcp: RTKit: peDCP_H17GSCD.cpp:13076: IOMFB updateFrequencies: minimum-frequency property not found, using getClockFrequency(0) instead.
[1.584413] apple-dcp: unknown display clock ID 0x0
[1.584670] apple-dcp: RTKit: peDCP_H17GSCD.cpp:13079: IOMFB updateFrequencies getClockFrequency returned pixelClock = 0
[1.584981] apple-dcp: RTKit: peDCP_H17GSCD.cpp:13108: IOMFB updateFrequencies EDT ERROR: getClockFrequency(0) (0) < videoClock 138521008! Giving up on frequencies.
[1.586355] apple-dcp: RTKit: ipeDCP_H17GSCD.cpp:1646: IOMFB: videoClock is zero, defaulting to 138521000

It repeats twice per boot (two updateFrequencies calls), and the panel comes up regardless (card1-eDP-1 connected, 2560x1600). Frame programming then continues: set_disp_perf_state: video_clock = 138521000, disp_clock = 180077280, program_frame_size: pixel_clock 277042000, vid0 138521000.

So the arg is 0, in the same slot your trace shows as PROV. The service 4CC is not printed on our side because trampoline_get_frequency_h17p() never inspects it, but it is the same firmware call. The reply is rate 0 from no source: apple_dcp_h17p_clock_rate() (dcp-link.h) accepts only 0x154 → dcp->clk (the DT's single 24 MHz fixed-clock clkref) and 0x194 → clock-194 (optional and absent on J813, clk_get_rate(NULL) = 0); ID 0 hits the default, returns -ENOENT, and the wrapper writes 0. The 24 MHz primary clock is not what answers this — on J813 nothing answers it, and the H17G firmware recovers internally to its 138.521 MHz videoClock default. A zero reply to PROV/0 is therefore evidently not fatal to this H17G firmware build. Unless the J815 firmware revision differs, I would look elsewhere for the startup timeout first.

2. Clock properties, DT and ADT. J813 ADT disp0 clock-ids = [585, 431] = [0x249, 0x1AF] — the same IDs as the J815 — but the J813 ADT carries no clock-frequency table for disp0 (only two clock-frequency properties in the entire ADT, neither under disp0; the J815's 174 cells are the machine difference). Linux DT: the dcp node has exactly one clock — clkref, 24 MHz fixed-clock (phandle 7, clock-frequency 0x16e3600); no clock-194, no apple,clock-ids. Provider property (VORP) requests are short-circuited with a cleared reply on the H17G method profile, D003 bandwidth answers from the pmgr_dcp bw-scratch/bw-doorbell cells, and D408 replies zero as above. No other provider/clock handoff runs, and the panel works. If J815's firmware does block on PROV/0, the candidate fix is to extend the decoder past 0x154/0x194 and answer the ADT clock IDs 0x249/0x1af with real rates from the 174-cell clock-frequency table that only J815's ADT carries.

3. Exact commits behind the working panel.

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