[Intel-gfx] Backlight testing
Jesse Barnes
jbarnes at virtuousgeek.org
Wed May 14 19:43:58 CEST 2008
On Wednesday, May 14, 2008 12:30 am Zhenyu Wang wrote:
> > > I think it happens if I set backlight level and then call DPMS from On
> > > to On. The current code does not reread the current value. The
> > > following patch works for me:
> >
> > Good catch, I think we can ignore backlight setting if current target
> > power has already been on, or get/set current level as in your patch.
>
> After relook into this, I think this patch should be sufficient.
>
> diff --git a/src/i830_lvds.c b/src/i830_lvds.c
> index 899c6cb..8fb0bc7 100644
> --- a/src/i830_lvds.c
> +++ b/src/i830_lvds.c
> @@ -398,6 +398,8 @@ i830SetLVDSPanelPower(xf86OutputPtr output, Bool on)
> if (!(INREG(PP_CONTROL) & POWER_TARGET_ON) &&
> dev_priv->backlight_duty_cycle == 0)
> dev_priv->backlight_duty_cycle = dev_priv->backlight_max;
> + else
> + dev_priv->backlight_duty_cycle = dev_priv->get_backlight(output);
>
> OUTREG(PP_CONTROL, INREG(PP_CONTROL) | POWER_TARGET_ON);
> do {
So the basic problem is that when we call into the DPMS routine, the panel
could be either on or off, but sometimes we'll see multiple calls (on->on or
off->off, in addition to on->off and off->on). Going from off->on we try to
set the backlight to a non-zero value since presumably the user wants to see
things (though on some machines this does the wrong thing, since 0 is a
visible value).
But we do the "0->max" check under the off->on check, and then unconditionally
set the backlight later on. I think another fix for this problem would be to
move the set_backlight() call under the off->on check? Likewise with the
on->off side, we could move the set_backlight(0) call under the on->off check
and not touch it in subsequent calls.
Either way we should update the comments. :)
Thanks,
Jesse
More information about the Intel-gfx
mailing list