Explainer
Which layer is dimming your screen: hardware, software, or neither
Two apps can both say “brightness 40%” and produce completely different pictures. The reason is that brightness is carried by different layers, and only one of them touches the backlight.
The four states
A working implementation has to model this explicitly, because the whole point is the hop from hardware down to software. There are four states, and they are not interchangeable:
- hardware — the panel's own backlight answers DDC/CI. This is real brightness: the light behind the pixels goes down, and blacks stay black.
- software — the gamma table is rewritten. The picture gets darker, the backlight does not. At contrast 1 it is a pure scale, so true black stays black. Once contrast drops below 1 it is not: the contrast term pivots around 0.5, which pushes the bottom of the ramp above zero — and that, not the dimming itself, is what turns black into dark grey.
- unavailable — nothing works. The honest thing is to say so rather than pretend a slider is doing something.
- unknown — not yet probed. Distinct from unavailable on purpose: one means “we asked and the panel said no”, the other means “we have not asked”.
Why “unknown” is not “unavailable”
Collapsing those two into one state is how an app ends up telling you a display is unsupported before it has ever tried. Keeping them apart costs one word in the source and saves a wrong diagnosis.
The delays are part of the design
Fallback is not a single retry. Panels need a moment after wake before they answer DDC/CI at all — replaying the instant the notification lands is exactly why naive wake handlers fail. A real implementation waits 2.5 seconds after wake, and then retries after 1, 2 and 4 seconds.
Why the ladder is kept testable
The retry/fallback ladder is written free of the window toolkit and of any concrete DDC type: the caller injects both the writer and the sleeper. That is what lets the ladder itself be exercised on a machine whose panel ignores DDC/CI entirely — which is the only kind of machine that would otherwise never reach the code.
Honest limits
- Software dimming is not “the same but cheaper”. It changes the picture, and at low values it visibly lifts the black level.
- The specific delays are one implementation's choice, measured against its own hardware. They are not a specification, and panels differ.
- Hardware control is not always better: on a panel that answers DDC/CI slowly, a hybrid can be worse than a clean software dim.