Skip to content

drm/apple: count the panel backlight in millinits where a swap carries a DAC value - #3612

Closed
Ante042 wants to merge 1 commit into
aurora-silicon:mainfrom
Ante042:dcp-backlight-millinits
Closed

Ante042 wants to merge 1 commit into
aurora-silicon:mainfrom
Ante042:dcp-backlight-millinits

Conversation

@Ante042

@Ante042 Ante042 commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

Hi! This comes from letting the panel follow the ambient light on my J314s. The backlight device counts in whole nits, and at the dim end one nit is a step of 10 to 25 %, so a slow change of level is a visible staircase there, although the DAC tables are much finer than that.

Where a swap carries a DAC value this lets the backlight device count in millinits, so max_brightness on the J314s goes from 500 to 500000. The H17G panel shares the registration but takes whole nits in its swaps, and keeps them. The level read back is the one presented last, or before the first present the firmware's own report, in the same unit. At every whole nit the DAC word is the one the whole-nit arithmetic gave; I compared that on the host for 0 to 520 nits and both kinds of panel. One small change rides along: a level at the very end of a table now gives the table's last entry instead of the WARN and the middle entry.

On the machine, with main at 3a6d154 plus this and my other open drafts, every level I wrote read back the same in brightness and actual_brightness, 2500 and 20500 included, and the ambient light sensor next to the panel rose with the level in a dark room. I run the same change on my daily kernel, which is an older base. I have not booted main with only this commit, so it is a draft until then and until my sign-off is on it.

The part I'd like your opinion on is the unit itself, since user space sees it: max_brightness becomes a thousand times larger on these panels, and a level saved under the old kernel is read in the new unit on the first boot. systemd-backlight restores at least 5 % of the maximum, so it should not come up black, but I have not tried that transition. If you'd rather keep whole nits in the backlight device and expose the finer scale some other way, I'm happy to rework it.

Thanks for looking!

…s a DAC value

The DAC tables are far finer than whole nits, and at the dim end of the
range a whole nit is a step of 10 to 25 %: a slow change of level, such as
one following the ambient light, is a visible staircase there.

Where a swap carries a DAC value, let the backlight device count in
millinits. The H17G panel shares the registration but takes whole nits in
its swaps, and keeps them. The level read back is the one presented last,
or before the first present the firmware's own report, in the same units.

At every whole nit the DAC word is the one the whole-nit arithmetic gave
(compared on the host for 0 to 520 nits, both kinds of panel).

Assisted-by: LLM
@Ante042

Ante042 commented Nov 29, 2026

Copy link
Copy Markdown
Contributor Author

This commit now lives in #2844 together with the off-at-0 change, since both touch the same backlight path and are easier to review as one. Closing this one in favour of it.

@Ante042 Ante042 closed this Nov 29, 2026
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