[Intel-gfx] Prepare for 2.3.2

Zhenyu Wang zhenyu.z.wang at intel.com
Fri Jun 13 09:20:27 CEST 2008


On 2008.06.13 08:22:48 +0200, Lukas Hejtmanek wrote:
> 
> with the current head I have problems with backlight again. The Xserver starts
> with maximum backlight.
> 
> The following patch helps:

Looks ok to me, have you also tested in VT switch that backlight also
comes back to X with reasonable level? I think I met some issues when
tested with last your patch. And what's your backlight control method in use?  
On my t61, backlight seems just work sanely.

However, I'd like to convert several dev_priv->dpmsoff == 0 to !dev_priv->dpmsoff
for easy reading. If Jesse could review this, it'll be greate too.

> 
> diff --git a/src/i830_lvds.c b/src/i830_lvds.c
> index 899c6cb..77ecb21 100644
> --- a/src/i830_lvds.c
> +++ b/src/i830_lvds.c
> @@ -63,6 +63,9 @@ struct i830_lvds_priv {
>      /* The panel needs dithering enabled */
>      Bool           panel_wants_dither;
>  
> +    /* The panel is in DPMS off */
> +    Bool           dpmsoff;
> +
>      /* restore backlight to this value */
>      int                    backlight_duty_cycle;
>  
> @@ -334,6 +337,7 @@ i830_lvds_get_backlight_kernel(xf86OutputPtr output)
>         return 0;
>      }
>  
> +    memset(val, 0, sizeof(val));
>      if (read(fd, val, BACKLIGHT_VALUE_LEN) == -1)
>         goto out_err;
>  
> @@ -388,6 +392,8 @@ i830SetLVDSPanelPower(xf86OutputPtr output, Bool on)
>      uint32_t               pp_status;
>  
>      if (on) {
> +       if ((INREG(PP_CONTROL)&POWER_TARGET_ON) && dev_priv->dpmsoff == 0) 
> +          dev_priv->backlight_duty_cycle = dev_priv->get_backlight(output);
>         /*
>          * If we're going from off->on we may need to turn on the backlight.
>          * We should use the saved value whenever possible, but on some
> @@ -405,12 +411,13 @@ i830SetLVDSPanelPower(xf86OutputPtr output, Bool on)
>         } while ((pp_status & PP_ON) == 0);
>  
>         dev_priv->set_backlight(output, dev_priv->backlight_duty_cycle);
> +       dev_priv->dpmsoff = 0;
>      } else {
>         /*
>          * Only save the current backlight value if we're going from
>          * on to off.
>          */
> -       if (INREG(PP_CONTROL) & POWER_TARGET_ON)
> +       if (INREG(PP_CONTROL) & POWER_TARGET_ON && !dev_priv->dpmsoff) 
>             dev_priv->backlight_duty_cycle = dev_priv->get_backlight(output);
>         dev_priv->set_backlight(output, 0);
>  
> @@ -418,6 +425,7 @@ i830SetLVDSPanelPower(xf86OutputPtr output, Bool on)
>         do {
>             pp_status = INREG(PP_STATUS);
>         } while (pp_status & PP_ON);
> +       dev_priv->dpmsoff = 1;
>      }
>  }
>  
> @@ -447,7 +455,8 @@ i830_lvds_save (xf86OutputPtr output)
>      pI830->savePP_CONTROL = INREG(PP_CONTROL);
>      pI830->savePP_CYCLE = INREG(PP_CYCLE);
>      pI830->saveBLC_PWM_CTL = INREG(BLC_PWM_CTL);
> -    dev_priv->backlight_duty_cycle = dev_priv->get_backlight(output);
> +    if ((INREG(PP_CONTROL)&POWER_TARGET_ON) && dev_priv->dpmsoff == 0) 
> +       dev_priv->backlight_duty_cycle = dev_priv->get_backlight(output);
>  }
>  
>  static void
> @@ -1081,7 +1090,10 @@ i830_lvds_set_property(xf86OutputPtr output, Atom property,
>                        "RRConfigureOutputProperty error, %d\n", ret);
>         }
>         /* Set the current value of the backlight property */
> -       data = dev_priv->get_backlight(output);
> +       if ((INREG(PP_CONTROL)&POWER_TARGET_ON) && dev_priv->dpmsoff == 0) 
> +          data = dev_priv->get_backlight(output);
> +       else
> +          data = dev_priv->backlight_duty_cycle;
>         ret = RRChangeOutputProperty(output->randr_output, backlight_atom,
>                                      XA_INTEGER, 32, PropModeReplace, 1, &data,
>                                      FALSE, TRUE);
> @@ -1140,8 +1152,12 @@ i830_lvds_get_property(xf86OutputPtr output, Atom property)
>       */
>      if (property == backlight_atom) {
>         int val;
> -       val = dev_priv->get_backlight(output);
> -       dev_priv->backlight_duty_cycle = val;
> +       if ((INREG(PP_CONTROL)&POWER_TARGET_ON) && dev_priv->dpmsoff == 0) 
> +               val = dev_priv->get_backlight(output);
> +               dev_priv->backlight_duty_cycle = val;
> +       } else {
> +               val = dev_priv->backlight_duty_cycle;
> +       }
>         ret = RRChangeOutputProperty(output->randr_output, backlight_atom,
>                                      XA_INTEGER, 32, PropModeReplace, 1, &val,
>                                      FALSE, TRUE);
> 
> 
> -- 
> Lukáš Hejtmánek

-- 
Open Source Technology Center, Intel ltd.

$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://lists.freedesktop.org/archives/intel-gfx/attachments/20080613/04d676fa/attachment.sig>


More information about the Intel-gfx mailing list