Skip to content

drm: apple: H17P review follow-ups: unknown backlight level, aborted-present log, sleep drain - #226

Merged
RyanTheTide merged 3 commits into
aurora-wipfrom
j700/sashiko-dcp-h17p-followups
Oct 9, 2026
Merged

RyanTheTide merged 3 commits into
aurora-wipfrom
j700/sashiko-dcp-h17p-followups

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

drm: apple: H17P review follow-ups: unknown backlight level, aborted-present log, sleep drain

Three small fixes to the H17P (MacBook Neo) display code, from Sashiko review of #203 and #208. Each
is its own commit.

  1. drm: apple: present a backlight write while the H17P level is unknown
    • Without a loader brightness report, the backlight registers with the middle of the panel range
      as its reported level, while the panel keeps the loader's level until a present carries one.
    • dcp_bl_request() only marked a request dirty when it differed from the target. A write of
      exactly the reported level was therefore never presented. systemd-backlight makes that write
      when it restores a level saved on an earlier boot without a report. The panel stayed at the
      loader's level, the reported level stayed wrong, and the first DPMS or suspend cycle jumped to
      it.
    • A request is now also dirty while the level is not known, so the first write is always
      presented and makes the level known.
    • New KUnit case backlight_fallback_same_level_test.
    • Fixes: 34cd8f3032b3 ("drm: apple: register the H17P backlight without a loader level")
  2. drm: apple: do not report an aborted H17P present as a failed swap
    • When the firmware aborts a present before its submit reply arrives, the abort is logged
      (rate-limited), and the reply handler then logged an unrate-limited swap failed! status 4294967295 as well. A firmware aborting every frame would log that once per frame, with a
      status the firmware never returned.
    • dcp_present_submit() now returns why a present does not stand, and the failure message is
      skipped for an abort that was already reported. The present is still finished as a failure.
    • Fixes: 239607cb12c3 ("drm: apple: finish H17P presents that the firmware aborts")
  3. drm: apple: check for a dead DCP after each H17P sleep drain pass
    • 744c2c7 checks for a crashed or stopped DCP at the start of each drain pass. A crash
      during the last pass was not seen: the queue drain then reports the DCP idle at once, the level
      is still pending, and the loop ended with the brightness change still pending at suspend
      warning that commit set out to avoid. The early return also skipped the queue drain, whose lock
      orders the suspend after a queued transaction that is still being started.
    • The check now runs after the queue drain, before the pending test.
    • Fixes: 744c2c7abc15 ("drm: apple: skip the H17P sleep drain on a crashed or stopped DCP")

Testing

  • MacBook Neo (J700), one-shot boot of the public tip 4f3a64e7baa9 with all six review-fix branches merged (J700 configuration, plus MAC80211_HWSIM=m for one regulatory test). It was compared, with the same scripts, against the Neo's current default kernel (the tip plus the PMC/CLPC series) booted on the same boot chain. The branches were then rebased onto ccedac0c6a30 with unchanged diffs, and the Neo test was repeated there (see the re-check below).
    • General smoke identical to the default: display (DCP boot, eDP 2408x1506, brightness 2-525 nits, 3 DPMS cycles, all dcp-qual checks pass), keyboard/trackpad, Wi-Fi, Bluetooth, Touch ID (3 fingers), audio enumeration (no playback), battery, thermal, cpufreq/cpuidle, camera, GPU (vkcube, glmark2 2277 vs 2241). 0 Oops/WARN/SError; the same 15 error/warning-like dmesg lines on both boots; no DART fault.
    • Backlight: this boot had a loader brightness report, so the level was known from the start and
      the changed request path behaves exactly as before; a write of the current level (5 nits) left the
      reported level and the panel unchanged. The no-report fallback was not
      reachable on hardware; the new KUnit case covers it.
    • Presents: 0 swap failed, swap_clear failed or firmware aborted present lines; the firmware
      never sent an abort (D593) in any run, so the quieter abort path was not exercised.
    • Sleep drain: system suspend was not run (the reference machines are kept awake), so the reordered
      drain did not run on hardware; the code path is unchanged for a live DCP.
  • M1/M2: not affected (H17P-only code); the merged kernel ran on both Macs without change (see the legacy
    reply PR).
  • MacBook Neo re-check on ccedac0c6a30 (adds the DART display hand-off fix, iommu: apple-dart: keep live T8140 firmware translations out of TLB invalidates #221), with the
    Neo default's configuration (including PMC/CLPC), one-shot boot, compared with the default kernel
    booted right after it on the same boot chain: identical results. All smoke items pass (glmark2 2234 vs
    2205), dcp-qual boot, brightness and 3 DPMS cycles pass, 0 D452/D454 among about 1005 DCP callbacks,
    0 DART faults, 0 Oops/WARN. The only extra log line was an intermittent sn201202x 1-0c: failed to configure Type-C connection: -110, also seen on other kernels' boots and unrelated to this series.

Checks

  • KUnit (Apple DCP suites, kunit.py --arch=arm64 LLVM=1 under QEMU): base 30/30; this branch
    31/31 (on 4f3a64e7baa9, 3fecb279810d and ccedac0c6a30); the new test alone on the base 30/31 (the new
    case fails without the fix).
  • checkpatch.pl --strict: 0 errors, 0 checks; 1 warning per commit, the Assisted-by trailer
    format.
  • Builds on the final base ccedac0c6a30 (clang 22.1.6, LLVM=1): with the J700 configuration (the Neo default's) every commit builds Image modules dtbs and passes a W=1 build of drivers/pmdomain/apple/, drivers/gpu/drm/apple/, drivers/net/wireless/mediatek/mt7932/ and drivers/bluetooth/; with the M1/M2 configuration (Fedora Asahi based) every commit passes the same W=1 build, and the merge of all six review-fix branches builds in full with no warning that a full build of the unpatched tip lacks. No new warnings (the 4 existing W=1 kernel-doc lines on dcp_crtc_send_page_flip_event are unchanged). The same checks passed on 4f3a64e7baa9 and 3fecb279810d.

Provenance

Written for this tree; tested on the MacBook Neo (J700).

🤖 Generated with Claude Code

Without a loader brightness report the H17P backlight registers with the
middle of the panel range as its reported level, while the panel keeps
the loader's level until a present carries one. dcp_bl_request() only
marks a new request dirty when it differs from the target, so a write of
exactly the reported level, as systemd-backlight makes when it restores
a level saved on an earlier boot without a report, presents nothing.
The panel then stays at the loader's level, the reported level stays
wrong, and the first DPMS or suspend cycle jumps to it.

Also mark a request dirty while the level is not known, so the first
write is always presented and makes the level known. Add a KUnit case.

Fixes: 34cd8f3 ("drm: apple: register the H17P backlight without a loader level")
Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
When H17P firmware aborts a present before its submit reply arrives,
dcp_present_submit() logs the abort, rate-limited, and the reply handler
then turns the accepted reply into a failure and logs it again, without
a rate limit, as "swap failed! status 4294967295". A firmware that
aborted every frame would log that error once per frame, with a status
the firmware never returned.

Let dcp_present_submit() return why a present does not stand, and skip
the failure message for an abort that has already been reported. The
present is still finished as a failure.

Fixes: 239607c ("drm: apple: finish H17P presents that the firmware aborts")
Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
Commit 744c2c7 ("drm: apple: skip the H17P sleep drain on a crashed
or stopped DCP") checks for a crashed or stopped DCP at the start of each
drain pass. A crash during the last pass is not seen: the queue drain
then reports the DCP idle at once, the level is still pending, and the
loop ends with the "brightness change still pending at suspend" warning
that commit set out to avoid. Returning before the first pass also skips
the queue drain, whose lock orders the suspend after a queued
transaction that is still being started.

Check after the queue drain instead, before the pending test. A crashed
or stopped DCP now always goes through the drain, which returns at once
for it.

Fixes: 744c2c7 ("drm: apple: skip the H17P sleep drain on a crashed or stopped DCP")
Assisted-by: LLM
Signed-off-by: Ryan Murray <[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