Skip to content

daemon: Only use ddcutil display objects for awake monitors

Jakob Petsovits requested to merge work/jpetso/brightness-ddc-remove-asleep into master

Previously, m_displays in DDCutilDetector contained all valid ddcutil displays, and ASLEEP/AWAKE events would pause/resume the affected display. Upon resuming, we needed to write the current brightness value so that it's still in line with any changes that were made in the meantime.

This has two downsides:

  • DDCutilDetector exposes a display that it can't control, but which may still show a brightness slider to the user in certain circumstances.
  • We force a long-delayed brightness write that may or may not be desired at that point, especially if we've missed previous external brightness changes due to DDC/CI limitations.

Instead of trying to figure out how to decide whether we want to issue a brightness write or emit externalBrightnessChangeObserved(), we can reduce complexity by making use of a more basic concept: removing and adding displays.

With this commit, a monitor that has gone to sleep will not expose brightness controls anymore. Once it wakes up, we read its current brightness again from scratch. If the controller wants to restore any brightness values upon seeing the display again, it can set its brightness as a reaction to displaysChanged(). Tracking and restoring brightness across sleep/wake events is not the responsibility of our DDC/CI classes anymore.

With back-off retries in place for DDCutilDisplay initialization, we don't need to worry about delaying DDC/CI commands after wake-up as resumeWorker() used to do.

CCBUG: 482713 CCBUG: 493329


This also addresses this Discuss thread wherein X11 users were asking for PowerDevil not to overwrite their custom brightness values after they had already disabled dimming.

Merge request reports

Loading