Repository navigation
drm/apple: fix two brightness floor edge cases on wake and M4 default - #4412
RyanTheTide wants to merge 1 commit into
Conversation
Fix the two edge cases tracked in #3579 for panels that set apple,min-brightness: 1. Firmware 27 wake path (dcp_backlight_wake_lit()): clearing core_blank and suspended before the backlight core's resume callback meant the subsequent resume notification arrived with unchanged flags and was mistaken for a user request, raising a loader-inherited level below the floor. Move the state update into dcp_bl_wake_lit() and record wake_resume_pending when blank or suspend was active so the matching resume notification preserves the loader level while any subsequent user request still enforces the floor. 2. M4 default presentation: dcp_bl_set_minimum() left an uninherited registration default untouched, so an M4 panel configured with a 120-nit default and a higher floor presented 120 nits on its initial dcp_bl_jump() before the floor took effect. Raise an uninherited, uncontrolled default in dcp_bl_set_minimum() while keeping loader- inherited levels and late loader hints below the floor intact. Add KUnit cases in dcp_backlight_test.c covering both edge cases, v27_keep_level=1 (core_blank only), already-unblanked wake_lit, M4 default clamping, and late loader hints below the floor. Closes: #3579 Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
There was a problem hiding this comment.
Verdict: MERGE at bbf2f71
Checked: Replayed the exact backlight-only test routines using the exact inline implementation. GCC and Clang each passed 724 assertions under UBSan. Verified the wake marker preserves the inherited level through the matching resume callback, the next unchanged brightness request applies the floor, and the uninherited default is clamped before its first present. The configured-floor hardware row remains open.
|
Code-owner notice for @aurora-silicon/core @aurora-silicon/omarchy-mac @aurora-silicon/aurora-maintainers: approved by |
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
What: Fix both
apple,min-brightnessedge cases in the DCP backlight policy: keep a loader-inherited level below the floor across the firmware-27 wake/resume sequence, and raise an uninherited default (such as the M4 120-nit default) to the floor before its first present. Fixes #3579Tested: At head
bbf2f71c50a8:make ARCH=arm64 LLVM=1 W=1 drivers/gpu/drm/apple/dcp_backlight.o drivers/gpu/drm/apple/dcp_backlight_test.o: 0 errors, 0 warningspython3 tools/testing/selftests/drivers/gpu/apple-dcp/run.py --source . --group all: 104/104 passeddcp_backlight.hfloor assertions (clang -Wall -Wextra -Werror): passedscripts/checkpatch.pl --strict --git HEAD~1..HEAD: 0 errors, 0 warnings, 0 checksRisk: two-way door · Apple panels with
apple,min-brightnessconfigured in DT (no tree sets it onmainyet; runtime no-op for panels withminimum == 0)Not yet: Hardware row on a panel with
apple,min-brightnessset (e.g. K114s once #3181 lands, and an M4 panel with a configured floor above 120 nits)Details
dcp_backlight.h,dcp_backlight.c):dcp_backlight_wake_lit()previously clearedcore_blankandsuspendedbefore the backlight core resumed, so the matching resume callback arrived with unchanged blank/suspend flags anddcp_bl_request()treated it as a new user brightness request (raising a loader level belowminimum). Move the state transition intodcp_bl_wake_lit()and recordwake_resume_pendingwhencore_blank || suspendedwas set;dcp_bl_request()consumeswake_resume_pendingonce on the matching unblanked resume notification, while any subsequent user write (or awake_litwhile already unblanked) enforces the floor as before.dcp_backlight.h): Indcp_bl_set_minimum(), when!state->level_known && !state->controlled && state->target < minimum, raisetarget,level, andactualtominimumimmediately sodcp_backlight_configure()'sdcp_bl_jump()on M4 never presents 120 nits below a higher floor. Loader-inherited levels (level_known == true) and late loader hints viadcp_bl_report()remain unaffected.dcp_backlight_test.c): Extendedbacklight_floor_test()with cases for firmware-27 wake + resume (both full suspend andv27_keep_level=1), already-unblankedwake_lit, M4 default clamping below a 150-nit floor, and late loader hints below the floor.Evidence
make ARCH=arm64 LLVM=1 W=1 O=... drivers/gpu/drm/apple/dcp_backlight.o drivers/gpu/drm/apple/dcp_backlight_test.o: clean build (0 warnings, 0 errors)tools/testing/selftests/drivers/gpu/apple-dcp/run.py --source . --group all:1..104allokscripts/checkpatch.pl --strict --git HEAD~1..HEAD:total: 0 errors, 0 warnings, 0 checks, 164 lines checked