After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 776724 - Backlight brightness increases at random times due to division by zero in iio_proxy_changed
Backlight brightness increases at random times due to division by zero in iio...
Status: RESOLVED DUPLICATE of bug 786164
Product: gnome-settings-daemon
Classification: Core
Component: power
3.22.x
Other Linux
: Normal normal
: ---
Assigned To: Richard Hughes
gnome-settings-daemon-maint
Depends on:
Blocks:
 
 
Reported: 2017-01-02 18:30 UTC by Anders Kaseorg
Modified: 2017-11-28 13:49 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Anders Kaseorg 2017-01-02 18:30:01 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.
Comment 1 Benjamin Berg 2017-11-28 13:49:24 UTC
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 ***