GNOME Bugzilla – Bug 776724
Backlight brightness increases at random times due to division by zero in iio_proxy_changed
Last modified: 2017-11-28 13:49:24 UTC
On my Thinkpad Yoga 14 20FY0002US running Ubuntu 17.04, when automatic brightness is enabled (the default), GNOME increases my backlight brightness every time I start playing a video in Totem, VLC, or Chrome. This was driving me nuts for several weeks until I eventually traced the problem to a division by zero in iio_proxy_changed: brightness = manager->priv->ambient_last_absolute * 100.f / manager->priv->ambient_norm_value; brightness = MIN (brightness, 100.f); brightness = MAX (brightness, 0.f); manager->priv->ambient_accumulator = (GSD_AMBIENT_SMOOTH * brightness) + (1.0 - GSD_AMBIENT_SMOOTH) * manager->priv->ambient_accumulator; By inserting g_debug statements I found that both ambient_last_absolute and ambient_norm_value are 0 there, so brightness becomes NaN and then 100. So every time this code path executes, ambient_accumulator creeps upward. I’m pretty sure there’s something wrong with the setup of this moving average system if depends on ratios of quantities that can be zero or near zero.
I believe this was fixed by the patches in bug #786164. In particular attachment 357430 [details] [review]. *** This bug has been marked as a duplicate of bug 786164 ***