backlight.c: avoid unnecessarily calling backlight_update_status()
Subsystems (2)
Helge Deller
maintainerPATCH 1/1 backlight.c: avoid unnecessarily calling backlight_update_status()
Every write to the backlight control sysfs entries like (on a Sharp Zaurus Poodle):
- /sys/class/backlight/locomo-bl/power
- /sys/class/backlight/locomo-bl/brightness
triggers a call of backlight_update_status(), even if the same value is written multiple times in row into those entries.
In principle this is not critical, but e.g. on the SHARP Poodle everytime backlight_update_status() is called, a lot of registers are reset and this leads to screen distortions of a ~ 0.4 seconds time frame. Esp. tools like some light control programs with controlling sliders for the light intensity happen to set those values more often which is really annoying and makes it nearly impossible to use them because the reaction time is really slow and you see lots of screen distortions.
The trivial patch below avoids this problem by comparing the new value with the already set value. In case they are the same, it just avoids to call backlight_update_status() again.
It would be great if this patch could be applied to the fbdev git tree for inclusion in later linux kernels.
drivers/video/backlight/backlight.c +8 -4
@@ -94,8 +94,10 @@ static ssize_t backlight_store_power(struct device *dev,mutex_lock (&bd->ops_lock);if (bd->ops) {pr_debug ("backlight: set power to %d\n" , power); - bd->props.power = power; -backlight_update_status (bd); +if (bd->props.power != power) { + bd->props.power = power; +backlight_update_status (bd); + } rc = count; }mutex_unlock (&bd->ops_lock);
@@ -132,8 +134,10 @@ static ssize_t backlight_store_brightness(struct device *dev,else {pr_debug ("backlight: set brightness to %d\n" , brightness); - bd->props.brightness = brightness; -backlight_update_status (bd); +if (bd->props.brightness != brightness) { + bd->props.brightness = brightness; +backlight_update_status (bd); + } rc = count; } }
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
Richard Purdie
AppliedQuoted 16 lines · Helge Deller
Every write to the backlight control sysfs entries like (on a Sharp Zaurus Poodle):
-/sys/class/backlight/locomo-bl/power
-/sys/class/backlight/locomo-bl/brightness
triggers a call ofbacklight_update_status(), even if the same value is written multiple times in row into those entries.In principle this is not critical, but e.g. on the SHARP Poodle everytime
backlight_update_status()is called, a lot of registers are reset and this leads to screen distortions of a ~ 0.4 seconds time frame. Esp. tools like some light control programs with controlling sliders for the light intensity happen to set those values more often which is really annoying and makes it nearly impossible to use them because the reaction time is really slow and you see lots of screen distortions.
Quoted 6 lines
The trivial patch below avoids this problem by comparing the new value with the already set value. In case they are the same, it just avoids to call
backlight_update_status()again.It would be great if this patch could be applied to the fbdev git tree for inclusion in later linux kernels.
I've queued this in the backlight tree, thanks.
Note that ideally userspace shouldn't be making all these calls mind ;-).
Richard
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace