[Intel-gfx] Prepare for 2.3.2

Lukas Hejtmanek xhejtman at ics.muni.cz
Fri Jun 13 08:22:48 CEST 2008


On Fri, Jun 13, 2008 at 10:19:18AM +0800, Zhenyu Wang wrote:
> I've pushed fixes from master I'd want to include in final 2.3.2
> release, which targets Xorg 7.4.
> 
> I'll run another test cycle mostly on new mobile chipset, and
> testing help is needed for all previous chips. 
> 
> Please help to try current xf86-video-intel-2.3-branch and report
> any regression you can find.

with the current head I have problems with backlight again. The Xserver starts
with maximum backlight.

The following patch helps:

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



More information about the Intel-gfx mailing list