Repository navigation
drm/apple: name the brightness and 180 Hz probe retry budgets and report their exhaustion - #2387
Conversation
A panel level rides on a present; there is no separate brightness write. The driver already waits for the firmware's acknowledgement: dcp_bl_complete() runs only from the swap reply and the swap-complete callback. When the firmware refuses such a present (swap_submit answers a non-zero status, or the swap watchdog retires a present that never completed), commit 8978179 ("drm: apple: retry rejected H17P brightness presents with a bound") presents the level again after 100, 200 and 400 ms, and then leaves it pending. The firmware gives no reason for a refusal and sends nothing that says when a later present would be taken, so there is no event to wait on instead, and no capture shows what the firmware refuses. Keep the bounded retry, but stop it hiding anything: - Name the budget, DCP_BL_RETRY_MAX and DCP_BL_RETRY_BASE_MS, and document where the level is acknowledged, why the retry is timed and the open question (issue #2332). - Count refused presents in the backlight state. - Warn, with the level and the count, when a level has used up its deferred presents, on both paths that schedule them. The H17P queue said only "backlight retry limit reached"; the 26.x desktop path (dcp_backlight_desktop_finish()) gave up silently. Behaviour is otherwise unchanged: the same three delays, the same reset on a new request or an accepted present. Bring the native regression tools/testing/apple/check-backlight-retry.py back to building against the current sources (stubs for min/max, div_u64, mul_u32_u32, the dropped-scanout list, ext26_control_pending, callback_count, fw_compat, system_dfl_wq; -Wno-unused-function for the header's inline helpers) and make it check that only the refusal ending the budget warns and that every refusal is counted. Signed-off-by: Ryan Murray <[email protected]>
While a 1920x1080 at 180 Hz exception mode is pending on an H17P Type-C connection but not yet proven, get_modes calls dcp_180hz_retry(), which probes the connector again up to 8 times, 300 ms apart. After the 8th probe it stopped without a word, and the mode was simply not offered. Each input of the proof already has an event that probes again (the link rate and lane facts and the firmware announcement through dcp_180hz_notify(), the AV service through its publication, a new catalog through dcp_180hz_catalog_changed()), so the re-probe is a poll. It is kept until every order of arrival is shown to be covered by one of those events, tracked in #2346. Name its bound and delay, and warn once when it runs out, with whether the current connection's link rate and lane facts are proven, so a missing 180 Hz mode can be told from a missing event. The count goes to DCP_180HZ_PROBE_RETRIES + 1 to mark the warning as given; a new connection or proof resets it as before. The host selftest checks the bound, the single warning and the reset. Signed-off-by: Ryan Murray <[email protected]>
dcp_s2r_quiesce() retries a refused RTKit idle once, after polling the mailbox and a fixed 30 ms sleep, on the assumption that the firmware still had messages queued. Nothing shows that assumption: the one recorded refusal on a J700 (-62 after 1137 ms) was refused again and went down the undo path. Say so at the retry and point at #2347, which tracks counting both outcomes and then either removing the retry or waiting on the condition the sleep stands for. No functional change. Signed-off-by: Ryan Murray <[email protected]>
|
Blockers: 1.
The rest is sound: the delays, the cap and the reset points are unchanged, the H17P path still schedules only on backlight_failed, and HW row: already given for J616s (20/20 steps, 0 refusal lines). Still missing: the Neo J700 with the panel lit (it was DPMS off), 20 steps, 0 "refused" lines, 0 AVC, 0 failed units and 0 new kernel errors, on this head once CI is green. Assisted-by: LLM (Claude:Opus 5.5) |
The retry counter stops at DCP_BL_RETRY_MAX + 1, so dcp_bl_retry_exhausted() stays true for as long as the request is pending. Every later present of that level that the firmware refused warned again, with the same "refused 4 times". Mark the refusal that takes the counter past the budget in dcp_bl_complete() and let dcp_backlight_retry_delay_locked() take that mark: one warning per exhausted budget, for the refusal that used it up. Later refusals of the same request are still counted in "refused". A new request or an accepted present starts a new budget, which can warn again. tools/testing/apple/check-backlight-retry.py now refuses the exhausted request twice more and expects no second warning, then exhausts a new request and expects its own. Signed-off-by: Ryan Murray <[email protected]>
dcp_backlight_desktop_finish() now calls the static dcp_backlight_retry_delay_locked(), which the desktop-brightness-notifications case did not extract, so the unit no longer compiled: host.c: error: call to undeclared function 'dcp_backlight_retry_delay_locked' Extract the helper and stub what it uses: lockdep_assert_held() checks the fixture's lock, dev_warn_ratelimited() counts. The case only covered notifications. Make it follow refused desktop presents as well: the first refusal schedules the deferred present after DCP_BL_RETRY_BASE_MS, each further one doubles the delay, the refusal that ends the budget schedules nothing and warns, and later refusals of the same request do not warn again. A new request gets its own budget and its own warning. No refusal notifies userspace. Signed-off-by: Ryan Murray <[email protected]>
|
Review blocker + nit fixed (4371746, 8a11afa):
Testing: apple-dcp display group 18/19 before -> 19/19 after; |
…; document the T8140 refused-idle retry Folds #2365 into this PR unchanged. Signed-off-by: Ryan Murray <[email protected]>
Signed-off-by: Ryan Murray <[email protected]>
There was a problem hiding this comment.
The new 180 Hz exhaustion message reports eight probes, but dcp_180hz_retry() counts calls that reschedule delayed work with mod_delayed_work(), including calls before the existing timer fires. A burst of unresolved mode enumeration can spend the budget and print the warning before the corresponding delayed probes ran. Please report what is actually counted or count completed retry work, and cover repeated scheduling before the first timer fires. Keep the exact 180 Hz and refused-brightness rows pending.
dcp_180hz_retry() counted every request against the eight re-probe budget, but a request while the delayed probe is still pending only moves its timer (mod_delayed_work()). A burst of unresolved mode enumerations before the timer fired could spend the whole budget and print 'still not offered after 8 probes' before any probe had run. Count in dcp_180hz_retry_work() instead, when the probe for the current cable generation actually runs. A request now spends nothing; the one that finds all eight spent says so, once, as before. The delay, the generation, disconnect, quiesce and ownership checks are unchanged. The bounded-retry host case now sends 100 requests before the first timer fires (nothing spent, no warning), then runs the eight probes one at a time. On the previous code it fails at the first check. Reported by the aurora-silicon review of #2387. Signed-off-by: Ryan Murray <[email protected]>
|
Fixed in 005f9e4 (one commit, no force push), per the review at d637f88: the budget now counts the 180 Hz re-probes that ran, not the requests.
The exact 180 Hz and refused-brightness rows stay pending, as asked. The boot rows in the body predate this commit. This commit only changes when the retry budget is counted, and neither boot reaches that path. |
There was a problem hiding this comment.
Verdict: FINISH at 005f9e4
In dcp_180hz_retry_work(), the timer increments the count before schedule_work() queues the connector hotplug work. If hotplug work is already pending, schedule_work() returns false and the counter still advances. Also, the generation check and increment use separate lock acquisitions, so a generation reset between them can charge the new proof for an old timer. Account under the same generation check, and count the actual reprobe or rename the metric to what it counts. Please cover already-pending hotplug work and a generation change in the fixture. The current fixture explicitly permits a ninth queue attempt after exhaustion.
The retry work counted a re-probe before schedule_work(), so a timer that found the connector's hotplug work still pending was charged for a probe it did not queue. It also checked the cable generation and counted under two separate lock sections, so a proof that started over in between could be charged for the old generation's timer. Check the generation, queue the hotplug work and count in one metadata.lock section, and count only when schedule_work() queued it. The bounded-retry host case now also covers a timer that fires while the hotplug work is pending (no probe, no charge) and an old generation's timer after the proof starts over (no charge to the new one). Its schedule_work() mock checks that it runs under the lock. Reported by the aurora-silicon review of #2387. Signed-off-by: Ryan Murray <[email protected]>
|
Fixed in 510d633, per the review at 005f9e4:
|
There was a problem hiding this comment.
Verdict: FINISH at 510d633
The generation check and charge now share one lock section, and coalesced hotplug work spends no budget. One bound remains unenforced. In dcp_180hz_retry_work(), schedule_work() is evaluated before retries < DCP_180HZ_PROBE_RETRIES. A timer already pending when the eighth queue succeeds can therefore queue a ninth probe without charging it. The fixture explicitly expects scheduled==9 when invoking the worker after exhaustion. Check the budget before scheduling, and assert that the stale timer leaves the queue count at eight.
schedule_work() ran before the budget check, so a timer still pending when the eighth re-probe had been queued could queue a ninth one, uncharged. Check that the budget has room first, then queue and charge. The bounded-retry host case now expects such a stale timer to leave the queue count at eight. Reported by the aurora-silicon review of #2387. Signed-off-by: Ryan Murray <[email protected]>
|
Fixed in 82fb102, per the review at 510d633: |
There was a problem hiding this comment.
Verdict: MERGE at 82fb102 after hosted CI and feature validation.
Checked: the same generation lock now covers the budget check, scheduling and successful-queue increment. Exhaustion short-circuits before scheduling. The fixture expects eight queues after a stale timer and still covers coalescing and a generation reset. Keep the exact 180 Hz and brightness refusal hardware evidence outstanding.
|
code-owner ping <@422957901716652033> / @DjDeveloperr: merge train at |
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
|
Merging under the 6-point rule (Ryan 09:29, permanent), at |
What: Names the DCP brightness and 180 Hz probe retry budgets and reports when they run out (folds #2365); no change to the retry itself.
Tested: J615 (M3 Air) and J473 (M2 mini) at 963ca06, in one combined one-shot test kernel 7.3.0-aurora-dsw1 (main d8c6043 + this PR + 15 other drafts). This PR's files there are byte-identical to the current head d637f88 (= 963ca06 + a clean merge of main) (dcp.c and iomfb.c there also carried #2364/#2460/#2464 hunks). J615 (eDP, v26_6 client) and J473 (HDMI + USB-C DP): boot on the default command line, panels connected, backlight set, no new DCP error lines against the fleet kernel's boot (sorted diff), one 15 s s2idle rc 0 each, 0 WARN/BUG.
Risk: two-way · all Macs with DCP (log text and counters)
Not yet: a refused present that runs the budget out (no repro on these Macs); log text only otherwise
Evidence
git merge-treemerges of linux#2263 power: supply: macsmc: Report net discharge as discharging on every battery #2303 soc: apple: sep: Count sensor bring-up and frame failures; document the remaining SEP retries #2363 drm/apple: dcp: give each Type-C reconnect request its whole budget #2364 drm/apple: name the brightness and 180 Hz probe retry budgets and report their exhaustion #2387 drm/apple: stop the DCPLink when a start or swap ends the session #2460 drm/apple, kbuild, tools/aurora-sep: drop dead kill switches, Kconfig/Makefile leftovers and the login refresh unit #2464 btrfs: verify large data reads in parts #2493 soc: apple: display-gate: request T8122 storage by soc-device record #2682 drm/asahi: mmu: publish a binding without the VM reservation #2799 soc: apple: aop: refuse EPIC calls once the firmware has crashed #2800 soc: apple: sep: gate per-user key bags on a proven capability, not the create variant #2806 soc: apple: sep: read the pnon digest on the two-to-four-page SEPs #2810 PCI: apple: T6050: wait for the radio's port with a wait queue #2377 PCI: apple: t6050: write the gen5 shadow tunables into the 32 GT/s bank #2794 wifi: apple: centauri: T6050: don't veto s2idle for a failed or stopped N1 #2795, fleet89 config (+CONFIG_USB_BILLBOARD=m), LLVM 22.1.6 / rustc 1.97.1; build warnings are the same as main's (23 rustc dead-code warnings, all present on main).grub2-rebootone-shot, no Stage 2 or DTB change. Each Mac went back to its saved fleet kernel, the test kernel was removed, and production state was verified: saved entry, empty next_entry, Enforcing, 0 failed units.genpd_prepare -11, brcmfmac LPAS fallback), and the fleet kernel's own s2idle shows them too. On J615, dsw1's boot also had one brcmfmacring 4: r_ptr 0 outside depth 0line, not seen on 3 fleet boots. No PR in the batch touches brcmfmac.Merge main into hack/drm-misc-retry-b(no conflicts).Original description
What: drm/apple: name the brightness and 180 Hz probe retry budgets and report their exhaustion. This PR now carries these drafts as one feature (merge commits, the commits themselves unchanged):
Tested: each part as tested on its own PR (folded bodies below; no hardware row on this head yet). Combined with current main (ba29027) together with the other folds of 11-25: full arm64 build (Image, modules, dtbs; fleet89 config, clang 22, rustc 1.97.1) clean.
Risk: two-way · all Macs with DCP (log text only)
Not yet: a boot row on one DCP Mac on this head.
#2387 original description
Problem
A panel level on H17P and the 26.x desktop path rides on a present; there is no separate brightness write. The driver already waits for the firmware's acknowledgement:
dcp_bl_complete()is called only from the swap reply and the swap-complete callback. When a present carrying a level is refused (swap_submitanswers a non-zero status, or the swap watchdog retires a present that never completed), 8978179 ("drm: apple: retry rejected H17P brightness presents with a bound") presents the level again after 100, 200 and 400 ms and then leaves it pending.The firmware gives no reason for a refusal and sends nothing that says when a later present would be taken, so there is no event to wait on instead. No capture shows what it refuses. Meanwhile the budget was two bare constants (
100U << n,retries < 4), the H17P queue said only "backlight retry limit reached", and the desktop path (dcp_backlight_desktop_finish()) gave up silently.Change
The bounded retry stays, since removing it without knowing the cause would lose levels on a static display. It is now visible:
DCP_BL_RETRY_MAXandDCP_BL_RETRY_BASE_MSname the budget. A comment indcp_backlight.hexplains where the level is acknowledged, why the retry is timed, and links issue drm/apple: refused brightness presents are retried on a timer with no known cause #2332.refusedcounts refused presents in the backlight state.dcp_backlight_retry_delay_locked(), serves both paths that schedule deferred presents. When a level has used up its budget it warns (ratelimited) with the level and the refusal count. The warning iniomfb_queue_advance()moves into it.The delays, the resets on a new request or an accepted present, and every other behaviour are unchanged. The native regression
tools/testing/apple/check-backlight-retry.pyno longer built against current sources. It now has stubs for what the H17P queue gained since, and it checks that only the refusal that ends the budget warns and that every refusal is counted.Testing
tools/testing/apple/check-backlight-retry.py(clang, ASan/UBSan): PASS on this branch. The same harness fixes on the base also PASS, without the new assertions.make W=1ofdcp_backlight.oandiomfb.oand a full build ofdrivers/gpu/drm/apple/(arm64, LLVM, release config): no warnings.dcp_backlight_test) not run: it needs a full arm64 kernel booted under QEMU. The helpers it checks keep their values (same delays, same cap), and the native harness runs the changed functions themselves.checkpatch.pl --strict: clean apart from commit-id lookups that need a tree.Still to run
On the J700 and the J616s (the panels that use this state; M1 Pro and M2 use the older brightness path and run none of this), step the brightness up and down 20 times with
brightnessctl, then rundmesg | grep -E "refused|swap_clear failed". Expected: no lines before or after, and the panel reaches every level. On the J316s and J413, the same steps should show no change from the base.Hardware rows (combined test kernel, 2026-11-20)
This change was booted in a combined test kernel: integration/aurora 0abc2f3 plus the open gate-sweep drafts plus this and the related drafts (7.3.0-aurora-hk2/pwr1/hk3). It ran once on each lab Mac (M1 Pro J316s, M2 J413, J616s, Neo J700) and was compared against the production kernel on the same Mac, using the same silent row script:
M1 Pro, M2 and J616s matched production on every row, apart from the new counters and lines the drafts add. The Neo row found the old-DTB display regression that #2358's follow-up commit fixes.
This PR: Panel brightness, 20 steps at or below 10 %: 20/20 reached on J616s, M1 Pro and M2, before and after, with 0 refusal lines from this path. Not measurable on the Neo, whose panel was DPMS off for the whole run.
#2365 original description
Problem
Two bounded retries in drivers/gpu/drm/apple run on assumptions nothing has shown yet:
dcp_180hz_retry()(dcp-180hz.c, from a7a7e2f) re-probes the connector up to 8 times, 300 ms apart, while a 1920x1080 at 180 Hz exception mode is pending but not yet proven on an H17P Type-C connection. Each input of the proof already has an event that probes again, so this is a poll, and when it ran out it stopped silently: the mode was just not offered.dcp_s2r_quiesce()(dcp.c, T8140 suspend-to-RAM from d9b438c by Diljit Singh) retries a refused RTKit idle once after a mailbox poll and a fixed 30 ms sleep, assuming queued messages were the cause. The one recorded refusal on a J700 was refused again.Change
DCP_180HZ_PROBE_RETRIES,DCP_180HZ_PROBE_DELAY_MS) and warn once when the probes run out, with whether the current connection's link rate and lane facts are proven. Behaviour is otherwise unchanged. The host selftest checks the bound, the single warning and the reset on a new connection. Removing the poll is tracked in drm/apple: 180 Hz exception mode is found by a bounded re-probe poll, not by its proof events #2346.Testing
drivers/gpu/drm/apple/dcp.oanddcp-180hz.owith W=1 on the release config: 0 warnings.tools/testing/selftests/drivers/gpu/apple-dcphost suite: 88/88 ok, including the updatedbounded-retry.Still to run
Hardware rows
dmesg | grep -c "180 Hz exception mode still not offered"= 0 when 1920x1080@180 is listed inmodetest/kscreen-doctor; if the mode is missing, exactly 1 such line per connection, naming which fact is missing.dcp_180hz_init()returns early there. Boot plus external display up as a no-regression check, 0 such lines.Hardware rows (combined test kernel, 2026-11-20)
This change was booted in a combined test kernel: integration/aurora 0abc2f3 plus the open gate-sweep drafts plus this and the related drafts (7.3.0-aurora-hk2/pwr1/hk3). It ran once on each lab Mac (M1 Pro J316s, M2 J413, J616s, Neo J700) and was compared against the production kernel on the same Mac, using the same silent row script:
M1 Pro, M2 and J616s matched production on every row, apart from the new counters and lines the drafts add. The Neo row found the old-DTB display regression that #2358's follow-up commit fixes.
This PR: "180 Hz exception mode still not offered": 0 on all four Macs (no 180 Hz sink attached).