Repository navigation
Conversation
H13P packs a DBV and an iDAC into one table word and interpolates that
word. The iDAC half carries, so BrightnessLCD rejects it near the top of
a 420-nit panel ("nitsToDBV: iDAC out of range"). Interpolate the 16-bit
halves separately and always shift by 4. Clamp the lookup at 509 so the
unshifted last table word is never sent.
The legacy backlight level is CIE 1931 lightness, and its scale is
non-linear. Firmware that sends nits on the wire, including H17P and the
14.7 panel, stays linear. A report above the panel ceiling clamps to
that ceiling. Which property publishes the level is unchanged.
Signed-off-by: Lucas Goossen <lucas.goossen@hey.com>
1d056e7 to
9c6d0e3
Compare
|
Tested on a J313 (M1 Air), automated and by eye: above the bottom of the range the perceptual curve steps evenly, as intended. The bottom ~7% (about the first 10% of key presses) does nothing, and on this panel it doesn't stop
By eye, after a lid-close/open so DCP applies writes (see the note below):
Why the bottom is flat: with Why 420 is still rejected: the split DBV/iDAC interpolation alone doesn't keep 420 and 419 in range on DCP 13.5. #225's 394-nit cap does: 0 rejections in its runs, by key and by sysfs. Note for testing either backlight PR: on DCP 13.5, with the baseline, this PR or #225, the firmware ignores brightness writes after boot until the panel goes through a modeset. A lid sleep/wake does that. Before it, sysfs and the keys change Merge order with #225: both edit All lab tests passed, with no omarchy-m-test regressions. How this was tested
|
The unstretched CIE curve stays under the firmware's 4-nit floor for about the first 7% of a 420-nit range, so levels 1, 10, 20 and 32 all land on the same code. Level 1 is now the panel minimum. That span gains one nit per eight levels, then the value rejoins the visible CIE curve, so 100, 200 and 300 stay on it. The same floor is used when the maximum is the 394-nit cap. Host-checked for maxima 420 and 394. Not hardware-tested. Signed-off-by: Lucas Goossen <lucas.goossen@hey.com>
Map J313 panel nits into the DAC range with a perceptual scale.
H13P interpolates a packed DBV/iDAC word, so the iDAC half carries and BrightnessLCD rejects levels near the top of this 420-nit panel (
nitsToDBV: iDAC out of range). The halves are interpolated separately, every code is shifted by 4, and the lookup stops at 509 instead of sending the unshifted last table word. Legacy sysfs brightness is CIE 1931 lightness (scalenon-linear): level 189 of 420 is 61 nits, and 420 nits is0x7ba07b80. H17P and the 14.7 panel still send linear nits. A firmware report above the panel ceiling clamps to that ceiling. Property 19 remains the panel level only on 14.7 firmware.Machine: MacBook Air M1 2020 (J313). The userspace curve check passed; no sysfs writes.
Session build, Monday 26 Oct 2026 05:02 PM -03: linux-aurora 7.2.11-6-2-ARCH (package 7.2.11.aurora6-2), branch local/j313-test at 7638df0. makepkg exited 0. rustc 1.85.0, LLVM/clang 18.1.8. This machine is running that kernel. The stacked commit compiled in was 31d5235. This pull request's earlier head was 9c6d0e3, which is not the commit that was built.
The panel path on this running kernel has not been checked.
Follow-up, not hardware-tested
b3f159ab8858maps brightness level 1 to the panel minimum (4 nits) so the bottom of the range is not dead. Levels 1, 10, 20, and 32 all read back as 32 because the unstretched CIE curve stays under the firmware floor for about the first 7% of a 420-nit range, and the same floor applies when the maximum is the 394-nit cap from #225. Level 0 stays off. The bottom span then gains about one nit per eight levels. Above that old floor, levels follow the visible CIE curve stretched across the whole range, so mid-range levels move up with the floor.A userspace check of the header, not a kernel build and not the panel, passed for maxima 420 and 394: monotonic, level 0 is 0, level 1 is at least 4 nits, and each nit value round-trips. At 420 the check printed levels 1, 10, 20, and 32 as 4, 5, 6, and 8 nits. At 394, level 1 was 4 and level 10 was 5. This has not been hardware-tested.