Skip to content
Snippets Groups Projects

Implement backlight brightness curve

  1. Dec 27, 2024
    • Basil Mari's avatar
      gsd-power: Apply a backlight brightness curve · 659899e9
      Basil Mari authored
      gsd-power controls display backlight brightness with an API that takes
      values from 0-100 and currently sets the brightness of the backlight
      linearly according to that value. This creates a usability issue due to
      the non-linearity of human perception of lightness. Steps in the lower
      range appear very large, while those in the upper range appear very
      slight, making it impossible to match screen brightness to your
      surroundings in dim lighting conditions using keyboard shortcuts. This
      commit introduces a tunable backlight brightness curve, which allows for
      close to perceptual linearity, increasing granularity in low brightness
      levels and responsiveness in high brightness levels.
      
      The curve is created with the clutter_ease_cubic_bezier() function
      inherited from clutter. The curve can be tuned by changing the input
      parameters of the function. The curve is currently described by the
      following parameters bezier(.1, 0.05, 0.87, 0.12).
      
      The brightness curve is applied based on the linearity of the display
      backlight, described by the "scale" sysfs attribute of the backlight.
      User override is possible by setting a custom "GSD_BACKLIGHT_SCALE"
      property to the backlight scale type corresponding to the desired
      behavior. The curve is applied according to the table below, where
      "GSD_BACKLIGHT_SCALE" is given priority to allow user configuration:
      
      +----------------------+--------------------------+
      | backlight scale type | brightness curve applied |
      +----------------------+--------------------------+
      | linear               | yes                      |
      | non-linear           | no                       |
      | unknown              | yes                      |
      +----------------------+--------------------------+
      659899e9
Loading