[dimdisplay] Do not change screen brightness on invalid values
ClosedPublic

Authored by anthonyfieroni on Nov 16 2018, 8:42 AM.

Details

Summary

The problem:

  1. Unplug laptop power supply
  2. On screen energy saving in settings
  3. Uncheck screen brightness (on all profiles or on that will be loaded)
  4. Wait minutes display to do off (not dimmed)
  5. Plug power supply without display on
  6. When it's on, screen brightness is 100%

Probably it's depends of backend (intel in my case) on dpms it returns *garbage* values even on max brightness (it's still not tested)

The solution:
Trying to cache max brightness level and denied to change screen brightness on garbage values

Test Plan

@broulik if you have better solution, i'll test it

Diff Detail

Repository
R122 Powerdevil
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
anthonyfieroni created this revision.Nov 16 2018, 8:42 AM
Restricted Application added a project: Plasma. · View Herald TranscriptNov 16 2018, 8:42 AM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
anthonyfieroni requested review of this revision.Nov 16 2018, 8:42 AM
anthonyfieroni added a comment.EditedNov 19 2018, 6:30 PM

So i made simple script to test, it looks like the problem isn't that

xset dpms force off
sleep 1
cat /sys/class/backlight/intel_backlight/max_brightness
cat /sys/class/backlight/intel_backlight/brightness
cat /sys/class/backlight/intel_backlight/actual_brightness

Results:

187
22
0

Any other ideas?

mart accepted this revision.Nov 23 2018, 1:53 PM
This revision is now accepted and ready to land.Nov 23 2018, 1:53 PM

It looks like the problem is in dimming.

anthonyfieroni retitled this revision from [brightnesscontrol] Do not change screen brightness on invalid values to [dimdisplay] Do not change screen brightness on invalid values.

This bug is bothering me too and I haven't found a fix either.
I use an external screen connected to my laptop and I turn my laptop screen off by setting its brightness to 0. Then whenever I go away for a moment and the screen is turned off because energy saving kicks in, when I get back to work the laptop screen brightness gets to 100%. Particularly not nice when it's night time ...

@thsurrel try this patch, if it not help disable dim display from power saving configuration, is that help?

Neither helped... The problem may not be in plasma.

Isn't there. https://phabricator.kde.org/source/powerdevil/browse/master/daemon/backends/upower/xrandrbrightness.cpp$160 You can investigate on what backend it's used for you and it may set value only one output not to all.

@broulik, @thsurrel any other ideas or to commit it?

This revision was automatically updated to reflect the committed changes.