Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] backlight: convert linear to gamma float brightness #6

Open
wants to merge 1 commit into
base: aosp-12.0
Choose a base branch
from

Commits on Feb 7, 2023

  1. backlight: convert linear to gamma float brightness

    The brightness controller in Android frameworks convert initial value
    from the slider to a new value not linear [1].
    The value is modified by convertGammaToLinearFloat.
    
    The current implementation in light HAL doesn't take account the none
    linearity of this incoming value, these values are logarithmic [2].
    Thus the brightness of the panel is very low most of the time.
    
    In order to get back a linear value, one solution is to re-convert the
    incoming value to a linear form: convertLinearToGammaFloat.
    
    The implementation convertLinearToGammaFloat has been highly inspired
    by the one in BrightnessUtils [3].
    
    [1] https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-12.0.0_r34/packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessController.java#354
    
    [2] https://tunjid.medium.com/reverse-engineering-android-pies-logarithmic-brightness-curve-ecd41739d7a2
    
    [3] https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-12.0.0_r34/packages/SettingsLib/src/com/android/settingslib/display/BrightnessUtils.java#129
    
    Signed-off-by: Julien Masson <jmasson@baylibre.com>
    massonju committed Feb 7, 2023
    Configuration menu
    Copy the full SHA
    fe968e3 View commit details
    Browse the repository at this point in the history