Repository navigation
drm: apple: H17P review follow-ups: unknown backlight level, aborted-present log, sleep drain - #226
Merged
Merged
Conversation
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
drm: apple: present a backlight write while the H17P level is unknownas 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 ofexactly 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.
presented and makes the level known.
backlight_fallback_same_level_test.Fixes: 34cd8f3032b3 ("drm: apple: register the H17P backlight without a loader level")drm: apple: do not report an aborted H17P present as a failed swap(rate-limited), and the reply handler then logged an unrate-limited
swap failed! status 4294967295as well. A firmware aborting every frame would log that once per frame, with astatus the firmware never returned.
dcp_present_submit()now returns why a present does not stand, and the failure message isskipped 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")drm: apple: check for a dead DCP after each H17P sleep drain passduring 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 suspendwarning 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.
Fixes: 744c2c7abc15 ("drm: apple: skip the H17P sleep drain on a crashed or stopped DCP")Testing
4f3a64e7baa9with all six review-fix branches merged (J700 configuration, plusMAC80211_HWSIM=mfor 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 ontoccedac0c6a30with unchanged diffs, and the Neo test was repeated there (see the re-check below).dcp-qualchecks 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.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.
swap failed,swap_clear failedorfirmware aborted presentlines; the firmwarenever sent an abort (D593) in any run, so the quieter abort path was not exercised.
drain did not run on hardware; the code path is unchanged for a live DCP.
reply PR).
ccedac0c6a30(adds the DART display hand-off fix, iommu: apple-dart: keep live T8140 firmware translations out of TLB invalidates #221), with theNeo 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-qualboot, 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.py --arch=arm64 LLVM=1under QEMU): base 30/30; this branch31/31 (on
4f3a64e7baa9,3fecb279810dandccedac0c6a30); the new test alone on the base 30/31 (the newcase fails without the fix).
checkpatch.pl --strict: 0 errors, 0 checks; 1 warning per commit, theAssisted-bytrailerformat.
ccedac0c6a30(clang 22.1.6, LLVM=1): with the J700 configuration (the Neo default's) every commit buildsImage modules dtbsand passes aW=1build ofdrivers/pmdomain/apple/,drivers/gpu/drm/apple/,drivers/net/wireless/mediatek/mt7932/anddrivers/bluetooth/; with the M1/M2 configuration (Fedora Asahi based) every commit passes the sameW=1build, 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 existingW=1kernel-doc lines ondcp_crtc_send_page_flip_eventare unchanged). The same checks passed on4f3a64e7baa9and3fecb279810d.Provenance
Written for this tree; tested on the MacBook Neo (J700).
🤖 Generated with Claude Code