xf86-video-intel: 2 commits - src/i810_reg.h src/i830_dvo.c src/i830_lvds.c src/i830_video.c

Keith Packard keithp at kemper.freedesktop.org
Thu Jun 21 16:01:44 PDT 2007


 src/i810_reg.h   |    8 ++++++++
 src/i830_dvo.c   |    1 +
 src/i830_lvds.c  |   34 ++++++++++++++++++++++++++++------
 src/i830_video.c |    4 ++++
 4 files changed, 41 insertions(+), 6 deletions(-)

New commits:
diff-tree a67c2965385001bcb8987265f698ff0f5809cd11 (from d6e46f67ab3af1ad3bfa72acb0efd9fe79dbf1dc)
Author: Keith Packard <keithp at neko.keithp.com>
Date:   Thu Jun 21 23:59:38 2007 +0100

    Follow BIOS configuration for Legacy Backlight Brightness.
    
    The backlight control in the LVDS controller can either operate in 'normal'
    mode or 'legacy' mode. In legacy mode, it uses the PCI config space register
    0xf4 which can range from 0 to 0xff. In normal mode, it reads the range and
    current value from the BLC_PWM_CTL register.

diff --git a/src/i810_reg.h b/src/i810_reg.h
index 6001297..248df04 100644
--- a/src/i810_reg.h
+++ b/src/i810_reg.h
@@ -1056,6 +1056,14 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN
 #define RENCLK_GATE_D2		0x6208
 #define RAMCLK_GATE_D		0x6210		/* CRL only */
 
+/*
+ * This is a PCI config space register to manipulate backlight brightness
+ * It is used when the BLM_LEGACY_MODE is turned on. When enabled, the first
+ * byte of this config register sets brightness within the range from
+ * 0 to 0xff
+ */
+#define LEGACY_BACKLIGHT_BRIGHTNESS 0xf4
+
 #define BLC_PWM_CTL		0x61254
 #define BACKLIGHT_MODULATION_FREQ_SHIFT		(17)
 /**
diff --git a/src/i830_lvds.c b/src/i830_lvds.c
index ee278aa..d469815 100644
--- a/src/i830_lvds.c
+++ b/src/i830_lvds.c
@@ -59,8 +59,18 @@ i830_lvds_set_backlight(xf86OutputPtr ou
     I830Ptr pI830 = I830PTR(pScrn);
     CARD32 blc_pwm_ctl;
 
-    blc_pwm_ctl = INREG(BLC_PWM_CTL) & ~BACKLIGHT_DUTY_CYCLE_MASK;
-    OUTREG(BLC_PWM_CTL, blc_pwm_ctl | (level << BACKLIGHT_DUTY_CYCLE_SHIFT));
+    blc_pwm_ctl = INREG(BLC_PWM_CTL);
+    if (blc_pwm_ctl & BLM_LEGACY_MODE)
+    {
+	pciWriteByte (pI830->PciTag, 
+		      LEGACY_BACKLIGHT_BRIGHTNESS,
+		      level & 0xff);
+    }
+    else
+    {
+	blc_pwm_ctl &= ~BACKLIGHT_DUTY_CYCLE_MASK;
+	OUTREG(BLC_PWM_CTL, blc_pwm_ctl | (level << BACKLIGHT_DUTY_CYCLE_SHIFT));
+    }
 }
 
 /**
@@ -71,9 +81,13 @@ i830_lvds_get_max_backlight(xf86OutputPt
 {
     ScrnInfoPtr pScrn = output->scrn;
     I830Ptr	pI830 = I830PTR(pScrn);
+    CARD32	pwm_ctl = INREG(BLC_PWM_CTL);
     
-    return ((INREG(BLC_PWM_CTL) & BACKLIGHT_MODULATION_FREQ_MASK) >>
-	BACKLIGHT_MODULATION_FREQ_SHIFT) * 2;
+    if (pwm_ctl & BLM_LEGACY_MODE)
+	return 0xff;
+    else
+	return ((pwm_ctl & BACKLIGHT_MODULATION_FREQ_MASK) >>
+		BACKLIGHT_MODULATION_FREQ_SHIFT) * 2;
 }
 
 /**
@@ -129,8 +143,16 @@ 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 = (pI830->saveBLC_PWM_CTL &
-				      BACKLIGHT_DUTY_CYCLE_MASK);
+    if (pI830->saveBLC_PWM_CTL & BLM_LEGACY_MODE)
+    {
+	dev_priv->backlight_duty_cycle = pciReadByte (pI830->PciTag,
+						      LEGACY_BACKLIGHT_BRIGHTNESS);
+    }
+    else
+    {
+	dev_priv->backlight_duty_cycle = (pI830->saveBLC_PWM_CTL &
+					  BACKLIGHT_DUTY_CYCLE_MASK);
+    }
 
     /*
      * If the light is off at server startup, just make it full brightness
diff-tree d6e46f67ab3af1ad3bfa72acb0efd9fe79dbf1dc (from 9d104634cf03bea82d1467f01e577cb8d2e4b554)
Author: Keith Packard <keithp at neko.keithp.com>
Date:   Thu Jun 21 20:16:36 2007 +0100

    Eliminate some uninitialized variable warnings

diff --git a/src/i830_dvo.c b/src/i830_dvo.c
index d81e5dd..dfd39ff 100644
--- a/src/i830_dvo.c
+++ b/src/i830_dvo.c
@@ -179,6 +179,7 @@ i830_dvo_mode_set(xf86OutputPtr output, 
 
     switch (dvo_reg) {
     case DVOA:
+    default:
 	dvo_srcdim_reg = DVOA_SRCDIM;
 	break;
     case DVOB:
diff --git a/src/i830_video.c b/src/i830_video.c
index 43e25bb..b4f9e74 100644
--- a/src/i830_video.c
+++ b/src/i830_video.c
@@ -1702,6 +1702,10 @@ i830_covering_crtc (ScrnInfoPtr pScrn,
 
     best_crtc = NULL;
     best_coverage = 0;
+    crtc_box_ret->x1 = 0;
+    crtc_box_ret->x2 = 0;
+    crtc_box_ret->y1 = 0;
+    crtc_box_ret->y2 = 0;
     for (c = 0; c < xf86_config->num_crtc; c++)
     {
 	crtc = xf86_config->crtc[c];


More information about the xorg-commit mailing list