Skip to content

Commit

Permalink
Add support for fixed time brightness fading
Browse files Browse the repository at this point in the history
Previously display brightness fading was done using constant velocity
or in constant time without considering the type of transition that
was taking place. This made large changes like changing brightness
settings or display dimming take a long time and/or easy to miss.

Now separate fade durations are used when:
- blanking screen
- unblanking screen
- dimming screen
- other display state changes
- adjusting to ambient light / brightness setting changes

The values can be changed via mcetool options
      --set-brightness-fade-def=<msecs>
      --set-brightness-fade-dim=<msecs>
      --set-brightness-fade-als=<msecs>
      --set-brightness-fade-blank=<msecs>
      --set-brightness-fade-unblank=<msecs>

Setting a value to zero disables fading and immediate transition is made.

Also prefers direct sysfs manipulation for brightness control over using
android hal via libhybris since the latter introduces some overhead and
does not provide a way to read current backlight brightness level.

[mce] Add support for fixed time brightness fading. Fixes JB#21713
  • Loading branch information
spiiroin committed Aug 5, 2014
1 parent 56d5013 commit 642fd01
Show file tree
Hide file tree
Showing 5 changed files with 603 additions and 347 deletions.
30 changes: 30 additions & 0 deletions builtin-gconf.c
Expand Up @@ -1228,6 +1228,36 @@ static const setting_t gconf_defaults[] =
.type = "i",
.def = "30",
},
{
// MCE_GCONF_BRIGHTNESS_FADE_DEF @ modules/display.h
.key = "/system/osso/dsm/display/brightness_fade_def",
.type = "i",
.def = "150",
},
{
// MCE_GCONF_BRIGHTNESS_FADE_DIM @ modules/display.h
.key = "/system/osso/dsm/display/brightness_fade_dim",
.type = "i",
.def = "1000",
},
{
// MCE_GCONF_BRIGHTNESS_FADE_ALS @ modules/display.h
.key = "/system/osso/dsm/display/brightness_fade_als",
.type = "i",
.def = "600",
},
{
// MCE_GCONF_BRIGHTNESS_FADE_BLANK @ modules/display.h
.key = "/system/osso/dsm/display/brightness_fade_blank",
.type = "i",
.def = "100",
},
{
// MCE_GCONF_BRIGHTNESS_FADE_UNBLANK @ modules/display.h
.key = "/system/osso/dsm/display/brightness_fade_unblank",
.type = "i",
.def = "90",
},
{
// MCE_GCONF_TK_AUTO_BLANK_DISABLE_PATH @ tklock.h
.key = "/system/osso/dsm/locks/tklock_blank_disable",
Expand Down
46 changes: 0 additions & 46 deletions inifiles/mce.ini
Expand Up @@ -191,52 +191,6 @@ BacklightFadeInTime=250
# 625, 750, 875, 1000
BacklightFadeOutTime=1000

[Display]

# Policy for display brightness increase
# Note: for displays that use hardware-driven fading this setting
# does not have any effect
#
# direct - Instantly switch to the new brightness level
# steptime - Fade to the new value with fixed step-time
# (larger difference in brightness == longer fadetime)
# constanttime - Fade to the new value with constant time
BrightnessIncreasePolicy=constanttime

# Step-time for brightness increase
#
# Steptime in milliseconds, default 5;
# valid values: 5, 10, 20, 30, 40, 50
StepTimeIncrease=5

# Constant time for brightness increase
#
# Constant time in milliseconds, default: 2000
# valid values: 2000-5000
ConstantTimeIncrease=2000

# Policy for display brightness decrease
# Note: for displays that use hardware-driven fading this setting
# does not have any effect
#
# direct - Instantly switch to the new brightness level
# steptime - Fade to the new value with fixed step-time
# (larger difference in brightness == longer fadetime)
# constanttime - Fade to the new value with constant time
BrightnessDecreasePolicy=constanttime

# Step-time for brightness decrease
#
# Steptime in milliseconds, default 10;
# valid values: 5, 10, 20, 30, 40, 50
StepTimeDecrease=10

# Constant time for brightness decrease
#
# Constant time in milliseconds, default: 3000
# valid values: 2000-5000
ConstantTimeDecrease=3000

[LED]

# A list of all pattern names that should be configured
Expand Down

0 comments on commit 642fd01

Please sign in to comment.