[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

xserver-xorg-video-intel: Changes to 'upstream-unstable'



 configure.ac                  |    4 
 src/bios_reader/bios_dumper.c |    4 
 src/i810_reg.h                |    8 +
 src/i830.h                    |   22 ++++-
 src/i830_accel.c              |    2 
 src/i830_debug.c              |    4 
 src/i830_display.c            |   18 ++--
 src/i830_driver.c             |  143 +++++++++++++++++++---------------
 src/i830_lvds.c               |   32 ++++++-
 src/i830_memory.c             |   20 ++++
 src/i830_quirks.c             |    4 
 src/i830_ring.h               |   17 ----
 src/i830_sdvo.c               |    4 
 src/i830_tv.c                 |    4 
 src/i830_video.c              |   20 ++++
 src/i915_hwmc.c               |   36 ++++++--
 src/i915_hwmc.h               |    2 
 src/xvmc/Makefile.am          |    5 -
 src/xvmc/driDrawable.c        |  174 ------------------------------------------
 src/xvmc/driDrawable.h        |   64 ---------------
 src/xvmc/i915_xvmc.c          |   14 ---
 src/xvmc/intel_xvmc.c         |    2 
 src/xvmc/intel_xvmc.h         |    1 
 23 files changed, 230 insertions(+), 374 deletions(-)

New commits:
commit b80bf50f8ebfe70044e66c7e8558e3031ba3cfca
Author: Zhenyu Wang <zhenyu.z.wang@intel.com>
Date:   Wed Jun 18 10:46:11 2008 +0800

    Bump version 2.3.2

diff --git a/configure.ac b/configure.ac
index 94562dd..af589de 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,7 +22,7 @@
 
 AC_PREREQ(2.57)
 AC_INIT([xf86-video-intel],
-        2.3.1,
+        2.3.2,
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
         xf86-video-intel)
 

commit 42a16bd38a0d09e3e6f33b2319b195aeacfa5084
Author: Zhenyu Wang <zhenyu.z.wang@intel.com>
Date:   Tue Jun 17 09:46:12 2008 +0800

    Fix compiling with server master in LVDS backlight patch
    (cherry picked from commit 289790c0467d27e96b537598a6589fc6a36da8b8)

diff --git a/src/i830_lvds.c b/src/i830_lvds.c
index ecb41c9..4f62a2b 100644
--- a/src/i830_lvds.c
+++ b/src/i830_lvds.c
@@ -1145,6 +1145,8 @@ i830_lvds_set_property(xf86OutputPtr output, Atom property,
 static Bool
 i830_lvds_get_property(xf86OutputPtr output, Atom property)
 {
+    ScrnInfoPtr		    pScrn = output->scrn;
+    I830Ptr		    pI830 = I830PTR(pScrn);
     I830OutputPrivatePtr    intel_output = output->driver_private;
     struct i830_lvds_priv   *dev_priv = intel_output->dev_priv;
     int ret;

commit 9036c94b28d4f1d65333bc318079f31bf56b3f99
Author: Lukas Hejtmanek <xhejtman@ics.muni.cz>
Date:   Mon Jun 16 02:49:41 2008 +0800

    Fix maximum backlight issue
    (cherry picked from commit 4c4ef27779aebf4df90b6233de05be2bb972de4c)

diff --git a/src/i830_lvds.c b/src/i830_lvds.c
index 899c6cb..ecb41c9 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,10 @@ i830SetLVDSPanelPower(xf86OutputPtr output, Bool on)
     uint32_t		    pp_status;
 
     if (on) {
+	/* if we're going from on->on, be aware to current level. */
+	if ((INREG(PP_CONTROL) & POWER_TARGET_ON) && !dev_priv->dpmsoff) 
+	    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 +413,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 = FALSE;
     } 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 +427,8 @@ i830SetLVDSPanelPower(xf86OutputPtr output, Bool on)
 	do {
 	    pp_status = INREG(PP_STATUS);
 	} while (pp_status & PP_ON);
+
+	dev_priv->dpmsoff = TRUE;
     }
 }
 
@@ -447,7 +458,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) 
+	dev_priv->backlight_duty_cycle = dev_priv->get_backlight(output);
 }
 
 static void
@@ -1081,7 +1093,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) 
+	    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 +1155,11 @@ 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) {
+	    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);

commit df0bbdc7cbb6ff357a81ed28d12e56c9c7d643f7
Author: Zhenyu Wang <zhenyu.z.wang@intel.com>
Date:   Thu Jun 12 14:04:41 2008 +0800

    Fix compiler warning when disable xvmc config

diff --git a/src/i830_memory.c b/src/i830_memory.c
index 9ceb254..ccbe7bd 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -2020,6 +2020,7 @@ I830CheckAvailableMemory(ScrnInfoPtr pScrn)
     return maxPages * 4;
 }
 
+#ifdef INTEL_XVMC
 /*
  * Allocate memory for MC compensation
  */
@@ -2041,3 +2042,4 @@ Bool i830_allocate_xvmc_buffer(ScrnInfoPtr pScrn, const char *name,
 
     return TRUE;
 }
+#endif

commit d3df74ebb0b61cda347e5e4754f2fc8a4c3110b0
Author: Eric Anholt <eric@anholt.net>
Date:   Tue Jun 10 11:31:22 2008 -0700

    Set up/restore PWRCTXA from enter/leavevt not server start/exit.
    
    This should improve behavior in the presence of VT switching, but also avoids
    a crash on X exit from writing the register after unmapping mmio.

diff --git a/src/i830.h b/src/i830.h
index a96fa5b..def693f 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -649,6 +649,7 @@ typedef struct _I830Rec {
    uint32_t saveRENCLK_GATE_D2;
    uint32_t saveDSPCLK_GATE_D;
    uint32_t saveRAMCLK_GATE_D;
+   uint32_t savePWRCTXA;
 
    enum last_3d *last_3d;
 
diff --git a/src/i830_driver.c b/src/i830_driver.c
index cff1fe8..563d167 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -2069,6 +2069,9 @@ SaveHWState(ScrnInfoPtr pScrn)
       pI830->saveRAMCLK_GATE_D = INREG(RAMCLK_GATE_D);
    }
 
+   if (IS_I965GM(pI830) || IS_IGD_GM(pI830))
+      pI830->savePWRCTXA = INREG(PWRCTXA);
+
    if (IS_MOBILE(pI830) && !IS_I830(pI830))
       pI830->saveLVDS = INREG(LVDS);
    pI830->savePFIT_CONTROL = INREG(PFIT_CONTROL);
@@ -2134,6 +2137,9 @@ RestoreHWState(ScrnInfoPtr pScrn)
       OUTREG(RAMCLK_GATE_D, pI830->saveRAMCLK_GATE_D);
    }
 
+   if (IS_I965GM(pI830) || IS_IGD_GM(pI830))
+      OUTREG(PWRCTXA, pI830->savePWRCTXA);
+
    /*
     * Pipe regs
     * To restore the saved state, we first need to program the PLL regs,
@@ -2846,9 +2852,6 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
        return FALSE;
    }
 
-   if (pI830->power_context)
-       OUTREG(PWRCTXA, pI830->power_context->offset | PWRCTX_EN);
-
    I830UnmapMMIO(pScrn);
 
    i830_fixup_mtrrs(pScrn);
@@ -3304,6 +3307,9 @@ I830EnterVT(int scrnIndex, int flags)
 
    i830_init_clock_gating(pScrn);
 
+   if (pI830->power_context)
+       OUTREG(PWRCTXA, pI830->power_context->offset | PWRCTX_EN);
+
    /* Clear the framebuffer */
    memset(pI830->FbBase + pScrn->fbOffset, 0,
 	  pScrn->virtualY * pScrn->displayWidth * pI830->cpp);
@@ -3459,9 +3465,6 @@ I830CloseScreen(int scrnIndex, ScreenPtr pScreen)
    }
 #endif
 
-   if (IS_I965GM(pI830) || IS_IGD_GM(pI830))
-       OUTREG(PWRCTXA, 0);
-
    if (I830IsPrimary(pScrn)) {
       xf86GARTCloseScreen(scrnIndex);
 

commit 9d767d62fec724079178844915cd3feb9df93c7e
Author: Bryce Harrington <bryce@bryceharrington.org>
Date:   Tue Jun 10 14:10:39 2008 +0800

    Two more Dell quirks
    
    fd.o #16160
    (cherry picked from commit 231a302013981cc597ba09ee89b367c8ab56e8ba)

diff --git a/src/i830_quirks.c b/src/i830_quirks.c
index b1c1423..1bd8885 100644
--- a/src/i830_quirks.c
+++ b/src/i830_quirks.c
@@ -237,6 +237,8 @@ static i830_quirk i830_quirk_list[] = {
     { PCI_CHIP_I965_GM, 0x1028, 0x0256, quirk_ignore_tv },
     /* Dell Inspiron 1318 */
     { PCI_CHIP_I965_GM, 0x1028, 0x0286, quirk_ignore_tv },
+    /* Dell Vostro A840 (LP: #235155) */
+    { PCI_CHIP_I965_GM, 0x1028, 0x0298, quirk_ignore_tv },
 
     /* Lenovo Napa TV (use dmi)*/
     { PCI_CHIP_I945_GM, 0x17aa, SUBSYS_ANY, quirk_lenovo_tv_dmi },
@@ -272,6 +274,8 @@ static i830_quirk i830_quirk_list[] = {
     { PCI_CHIP_I855_GM, 0x1028, 0x0139, quirk_pipea_force },
     /* Dell Latitude D500 needs pipe A force quirk */
     { PCI_CHIP_I855_GM, 0x1028, 0x0152, quirk_pipea_force },
+    /* Dell Latitude D505 needs pipe A force quirk (LP: #235643) */
+    { PCI_CHIP_I855_GM, 0x1028, 0x0163, quirk_pipea_force },
     /* Dell Latitude X300 needs pipe A force quirk */
     { PCI_CHIP_I855_GM, 0x1028, 0x014f, quirk_pipea_force },
     /* Dell Inspiron 510m needs pipe A force quirk */

commit 9a8d70fe3d1db2e2d34c79b7d0b271127a63e415
Author: Jesse Barnes <jbarnes@hobbes.lan>
Date:   Mon Jun 9 08:52:59 2008 -0700

    Fix TV programming:  add vblank wait after TV_CTL writes
    
    Fxies FDO bug #14000; we need to wait for vblank after writing TV_CTL or followi
    ng "DPMS on" calls may not actually enable the output.
    (cherry picked from commit 1142be53eb8d2ee8a9b60ace5d49f0ba27332275)

diff --git a/src/i830_tv.c b/src/i830_tv.c
index 2fc6199..cde929a 100644
--- a/src/i830_tv.c
+++ b/src/i830_tv.c
@@ -788,6 +788,7 @@ i830_tv_dpms(xf86OutputPtr output, int mode)
 	    OUTREG(TV_CTL, INREG(TV_CTL) & ~TV_ENC_ENABLE);
 	    break;
     }
+    i830WaitForVblank(pScrn);
 }
 
 static void
@@ -920,6 +921,7 @@ i830_tv_restore(xf86OutputPtr output)
 
     OUTREG(TV_DAC, dev_priv->save_TV_DAC);
     OUTREG(TV_CTL, dev_priv->save_TV_CTL);
+    i830WaitForVblank(pScrn);
 }
 
 static const tv_mode_t *
@@ -1237,6 +1239,7 @@ i830_tv_mode_set(xf86OutputPtr output, DisplayModePtr mode,
 	OUTREG(TV_V_CHROMA_0 + (i<<2), tv_mode->filter_table[j++]);
     OUTREG(TV_DAC, 0);
     OUTREG(TV_CTL, tv_ctl);
+    i830WaitForVblank(pScrn);
 }
 
 static const DisplayModeRec reported_modes[] = {

commit 7d9676c8cc309d42c49f82274f7dc43ab327bea3
Author: Robert Lowery <rglowery@exemail.com.au>
Date:   Tue May 20 21:09:23 2008 +1000

    Fix TV out connection type detection
    
    Make sure we wait for vblank when using the TV DAC to detect the connection
    type.
    
    Fixes FDO bug #14000.
    (cherry picked from commit 64a8f2433d7774d06119793b57cec6d3be6389c1)
    (cherry picked from commit e4e61e8c97c585993b4b69b86350b3987178a47e)

diff --git a/src/i830_tv.c b/src/i830_tv.c
index 6adb9f2..2fc6199 100644
--- a/src/i830_tv.c
+++ b/src/i830_tv.c
@@ -1303,6 +1303,7 @@ i830_tv_detect_type (xf86CrtcPtr    crtc,
 	tv_dac = INREG(TV_DAC);
 	OUTREG(TV_DAC, save_tv_dac);
 	OUTREG(TV_CTL, save_tv_ctl);
+	i830WaitForVblank(pScrn);
     }
     /*
      *  A B C

commit 4054725c3cf0956cc1717ad8acc558203a7af40d
Author: Eric Anholt <eric@anholt.net>
Date:   Thu Jun 5 14:55:23 2008 -0700

    Move debug clock printout from ErrorF to X_INFO.
    (cherry picked from commit bff180e6cac4452ef491c81855eb12bfa03d0bf3)

diff --git a/src/i830_display.c b/src/i830_display.c
index 4910d96..df2f1a2 100644
--- a/src/i830_display.c
+++ b/src/i830_display.c
@@ -241,13 +241,15 @@ static void intel_clock(I830Ptr pI830, int refclk, intel_clock_t *clock)
 }
 
 static void
-i830PrintPll(char *prefix, intel_clock_t *clock)
+i830PrintPll(ScrnInfoPtr pScrn, char *prefix, intel_clock_t *clock)
 {
-    ErrorF("%s: dotclock %d vco %d ((m %d, m1 %d, m2 %d), n %d, (p %d, p1 %d, p2 %d))\n",
-	   prefix, clock->dot, clock->vco,
-	   clock->m, clock->m1, clock->m2,
-	   clock->n, 
-	   clock->p, clock->p1, clock->p2);
+    xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+	       "%s: dotclock %d vco %d ((m %d, m1 %d, m2 %d), n %d, "
+	       "(p %d, p1 %d, p2 %d))\n",
+	       prefix, clock->dot, clock->vco,
+	       clock->m, clock->m1, clock->m2,
+	       clock->n,
+	       clock->p, clock->p1, clock->p2);
 }
 
 /**
@@ -1262,7 +1264,7 @@ i830_crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode,
 		       "Adjusted mode for pipe %c:\n", pipe == 0 ? 'A' : 'B');
 	    xf86PrintModeline(pScrn->scrnIndex, adjusted_mode);
 	}
-	i830PrintPll("chosen", &clock);
+	i830PrintPll(pScrn, "chosen", &clock);
     }
 
     if (dpll & DPLL_VCO_ENABLE)
@@ -1755,7 +1757,7 @@ i830_crtc_clock_get(ScrnInfoPtr pScrn, xf86CrtcPtr crtc)
      * configuration being accurate, which it isn't necessarily.
      */
     if (0)
-	i830PrintPll("probed", &clock);
+	i830PrintPll(pScrn, "probed", &clock);
 
     return clock.dot;
 }

commit e520316dd5f7bfdffadfa19b3046ba40ca367219
Author: Eric Anholt <eric@anholt.net>
Date:   Thu Jun 5 14:37:59 2008 -0700

    Remove SVG_WORK_CONTROL init.
    
    The bit set is now reserved -- used to be a workaround for early revisions.
    (cherry picked from commit ad459b21b7de4a79552ac155803d5930432fb84b)

diff --git a/src/i830_driver.c b/src/i830_driver.c
index 33c49e3..cff1fe8 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -3126,13 +3126,6 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
    if (serverGeneration == 1)
       xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options);
 
-   if (IS_I965G(pI830)) {
-      /* Enable DAP stateless accesses.  
-       * Required for all i965 steppings.
-       */
-      OUTREG(SVG_WORK_CTL, 0x00000010);
-   }
-
    pI830->starting = FALSE;
    pI830->closing = FALSE;
    pI830->suspended = FALSE;

commit 34ce546153ce9dd0571ce0a5cec7a481641fbbdd
Author: Eric Anholt <eric@anholt.net>
Date:   Thu Jun 5 14:37:26 2008 -0700

    Initialize clock gating from EnterVT and save/restore it appropriately.

diff --git a/src/i830.h b/src/i830.h
index ca7acc9..a96fa5b 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -645,6 +645,10 @@ typedef struct _I830Rec {
    uint32_t saveFBC_CONTROL2;
    uint32_t saveFBC_CONTROL;
    uint32_t saveFBC_FENCE_OFF;
+   uint32_t saveRENCLK_GATE_D1;
+   uint32_t saveRENCLK_GATE_D2;
+   uint32_t saveDSPCLK_GATE_D;
+   uint32_t saveRAMCLK_GATE_D;
 
    enum last_3d *last_3d;
 
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 862ddde..33c49e3 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -1499,8 +1499,6 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
 
    i830TakeRegSnapshot(pScrn);
 
-   i830_init_clock_gating(pScrn);
-
    if (DEVICE_ID(pI830->PciInfo) == PCI_CHIP_E7221_G)
       num_pipe = 1;
    else
@@ -2063,6 +2061,14 @@ SaveHWState(ScrnInfoPtr pScrn)
    pI830->saveSWF[15] = INREG(SWF31);
    pI830->saveSWF[16] = INREG(SWF32);
 
+   pI830->saveDSPCLK_GATE_D = INREG(DSPCLK_GATE_D);
+   pI830->saveRENCLK_GATE_D1 = INREG(RENCLK_GATE_D1);
+
+   if (IS_I965G(pI830)) {
+      pI830->saveRENCLK_GATE_D2 = INREG(RENCLK_GATE_D2);
+      pI830->saveRAMCLK_GATE_D = INREG(RAMCLK_GATE_D);
+   }
+
    if (IS_MOBILE(pI830) && !IS_I830(pI830))
       pI830->saveLVDS = INREG(LVDS);
    pI830->savePFIT_CONTROL = INREG(PFIT_CONTROL);
@@ -2120,6 +2126,14 @@ RestoreHWState(ScrnInfoPtr pScrn)
    if (!IS_I830(pI830) && !IS_845G(pI830))
      OUTREG(PFIT_CONTROL, pI830->savePFIT_CONTROL);
 
+   OUTREG(DSPCLK_GATE_D, pI830->saveDSPCLK_GATE_D);
+   OUTREG(RENCLK_GATE_D1, pI830->saveRENCLK_GATE_D1);
+
+   if (IS_I965G(pI830)) {
+      OUTREG(RENCLK_GATE_D2, pI830->saveRENCLK_GATE_D2);
+      OUTREG(RAMCLK_GATE_D, pI830->saveRAMCLK_GATE_D);
+   }
+
    /*
     * Pipe regs
     * To restore the saved state, we first need to program the PLL regs,
@@ -3113,13 +3127,6 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
       xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options);
 
    if (IS_I965G(pI830)) {
-      /* turn off clock gating */
-#if 0
-      OUTREG(0x6204, 0x70804000);
-      OUTREG(0x6208, 0x00000001);
-#else
-      OUTREG(0x6204, 0x70000000);
-#endif
       /* Enable DAP stateless accesses.  
        * Required for all i965 steppings.
        */
@@ -3302,6 +3309,8 @@ I830EnterVT(int scrnIndex, int flags)
    /* Tell the BIOS that we're in control of mode setting now. */
    i830_init_bios_control(pScrn);
 
+   i830_init_clock_gating(pScrn);
+
    /* Clear the framebuffer */
    memset(pI830->FbBase + pScrn->fbOffset, 0,
 	  pScrn->virtualY * pScrn->displayWidth * pI830->cpp);

commit 71befe0581bcc7d75ed982b543bbf575c2f48c37
Author: Eric Anholt <eric@anholt.net>
Date:   Thu Jun 5 14:09:45 2008 -0700

    Move BIOS scratch register setup to EnterVT instead of PreInit.
    
    We want these to always be set when our driver's in control.  They are
    already appropriately save/restored at leave/entervt.
    (cherry picked from commit 8061e5ac27a5f61f940bccc940be922999cc1d3f)

diff --git a/src/i830.h b/src/i830.h
index a7cdb8c..ca7acc9 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -554,10 +554,6 @@ typedef struct _I830Rec {
 
    Bool StolenOnly;
 
-   Bool swfSaved;
-   uint32_t saveSWF0;
-   uint32_t saveSWF4;
-
    Bool checkDevices;
 
    /* Driver phase/state information */
diff --git a/src/i830_driver.c b/src/i830_driver.c
index c53d2c3..862ddde 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -963,6 +963,19 @@ i830_init_clock_gating(ScrnInfoPtr pScrn)
     }
 }
 
+static void
+i830_init_bios_control(ScrnInfoPtr pScrn)
+{
+   I830Ptr pI830 = I830PTR(pScrn);
+
+   /* Set "extended desktop" */
+   OUTREG(SWF0, INREG(SWF0) | (1 << 21));
+
+   /* Set "driver loaded",  "OS unknown", "APM 1.2" */
+   OUTREG(SWF4, (INREG(SWF4) & ~((3 << 19) | (7 << 16))) |
+		(1 << 23) | (2 << 16));
+}
+
 static int
 I830LVDSPresent(ScrnInfoPtr pScrn)
 {
@@ -1021,10 +1034,6 @@ PreInitCleanup(ScrnInfoPtr pScrn)
       if (pI830->entityPrivate)
          pI830->entityPrivate->pScrn_2 = NULL;
    }
-   if (pI830->swfSaved) {
-      OUTREG(SWF0, pI830->saveSWF0);
-      OUTREG(SWF4, pI830->saveSWF4);
-   }
    if (pI830->MMIOBase)
       I830UnmapMMIO(pScrn);
    I830FreeRec(pScrn);
@@ -1492,19 +1501,6 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
 
    i830_init_clock_gating(pScrn);
 
-#if 1
-   pI830->saveSWF0 = INREG(SWF0);
-   pI830->saveSWF4 = INREG(SWF4);
-   pI830->swfSaved = TRUE;
-
-   /* Set "extended desktop" */
-   OUTREG(SWF0, pI830->saveSWF0 | (1 << 21));
-
-   /* Set "driver loaded",  "OS unknown", "APM 1.2" */
-   OUTREG(SWF4, (pI830->saveSWF4 & ~((3 << 19) | (7 << 16))) |
-		(1 << 23) | (2 << 16));
-#endif
-
    if (DEVICE_ID(pI830->PciInfo) == PCI_CHIP_E7221_G)
       num_pipe = 1;
    else
@@ -1739,12 +1735,6 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
       pI830->noAccel = TRUE;
    }
 
-   /* Don't need MMIO access anymore. */
-   if (pI830->swfSaved) {
-      OUTREG(SWF0, pI830->saveSWF0);
-      OUTREG(SWF4, pI830->saveSWF4);
-   }
-
    /* Set display resolution */
    xf86SetDpi(pScrn, 0, 0);
 
@@ -3309,6 +3299,9 @@ I830EnterVT(int scrnIndex, int flags)
    i830_stop_ring(pScrn, FALSE);
    SetHWOperatingState(pScrn);
 
+   /* Tell the BIOS that we're in control of mode setting now. */
+   i830_init_bios_control(pScrn);
+
    /* Clear the framebuffer */
    memset(pI830->FbBase + pScrn->fbOffset, 0,
 	  pScrn->virtualY * pScrn->displayWidth * pI830->cpp);

commit ae65ddbbc8064c33febc7608122828998ee15a2e
Author: Eric Anholt <eric@anholt.net>
Date:   Thu Jun 5 13:57:54 2008 -0700

    Remove gratuitous wait_ring_idle after I830Sync.  Syncing implies that.
    (cherry picked from commit b61cb9283185eb5211e84eb7d8e68beea607c2eb)

diff --git a/src/i830_driver.c b/src/i830_driver.c
index cf4586b..c53d2c3 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -1851,7 +1851,6 @@ i830_stop_ring(ScrnInfoPtr pScrn, Bool flush)
       if (temp & RING_VALID) {
 	 i830_refresh_ring(pScrn);
 	 I830Sync(pScrn);
-	 i830_wait_ring_idle(pScrn);
       }
 
       OUTREG(LP_RING + RING_LEN, 0);
@@ -3358,7 +3357,6 @@ I830EnterVT(int scrnIndex, int flags)
 
 	 i830_refresh_ring(pScrn);
 	 I830Sync(pScrn);
-	 i830_wait_ring_idle(pScrn);
 
 	 sarea->texAge++;
 	 for(i = 0; i < I830_NR_TEX_REGIONS+1 ; i++)

commit e0a2b1008f751ee8cddb0d7587514ea574821af6
Author: Eric Anholt <eric@anholt.net>
Date:   Thu Jun 5 13:39:08 2008 -0700

    Remove duplicated i830_stop_ring()/SetHWOperatingState() in EnterVT().
    (cherry picked from commit adb4f5a5e826e584ab212d23fc8d474c3e7bb8e8)

diff --git a/src/i830_driver.c b/src/i830_driver.c
index 16092dd..cf4586b 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -3323,9 +3323,6 @@ I830EnterVT(int scrnIndex, int flags)
    }
    i830DescribeOutputConfiguration(pScrn);
 
-   i830_stop_ring(pScrn, TRUE);
-   SetHWOperatingState(pScrn);
-
 #ifdef XF86DRI
    if (pI830->directRenderingEnabled) {
        /* HW status is fixed, we need to set it up before any drm

commit a4e8b188d469c8092d4314be96a697fb4f780276
Author: Eric Anholt <eric@anholt.net>
Date:   Thu Jun 5 11:56:42 2008 -0700

    Replace a couple of wait-for-ring-idles with a single function to do so.
    (cherry picked from commit 7e51384c973a96366b02ea646392c43574674111)

diff --git a/src/i830.h b/src/i830.h
index db930a0..a7cdb8c 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -853,6 +853,14 @@ i830_get_transformed_coordinates_3d(int x, int y, PictTransformPtr transform,
 
 void i830_enter_render(ScrnInfoPtr);
 
+static inline void
+i830_wait_ring_idle(ScrnInfoPtr pScrn)
+{
+   I830Ptr pI830 = I830PTR(pScrn);
+
+   I830WaitLpRing(pScrn, pI830->LpRing->mem->size - 8, 0);
+}
+
 static inline int i830_fb_compression_supported(I830Ptr pI830)
 {
     if (!IS_MOBILE(pI830))
diff --git a/src/i830_accel.c b/src/i830_accel.c
index 953a73b..7784c62 100644
--- a/src/i830_accel.c
+++ b/src/i830_accel.c
@@ -201,7 +201,7 @@ I830Sync(ScrnInfoPtr pScrn)
       ADVANCE_BATCH();
    }
 
-   I830WaitLpRing(pScrn, pI830->LpRing->mem->size - 8, 0);
+   i830_wait_ring_idle(pScrn);
 
    pI830->LpRing->space = pI830->LpRing->mem->size - 8;
    pI830->nextColorExpandBuf = 0;
diff --git a/src/i830_driver.c b/src/i830_driver.c
index a237374..16092dd 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -1851,7 +1851,7 @@ i830_stop_ring(ScrnInfoPtr pScrn, Bool flush)
       if (temp & RING_VALID) {
 	 i830_refresh_ring(pScrn);
 	 I830Sync(pScrn);
-	 DO_RING_IDLE();
+	 i830_wait_ring_idle(pScrn);
       }
 
       OUTREG(LP_RING + RING_LEN, 0);
@@ -3358,10 +3358,10 @@ I830EnterVT(int scrnIndex, int flags)
          int i;
 
 	 I830DRIResume(screenInfo.screens[scrnIndex]);
-      
+
 	 i830_refresh_ring(pScrn);
 	 I830Sync(pScrn);
-	 DO_RING_IDLE();
+	 i830_wait_ring_idle(pScrn);
 
 	 sarea->texAge++;
 	 for(i = 0; i < I830_NR_TEX_REGIONS+1 ; i++)
diff --git a/src/i830_ring.h b/src/i830_ring.h
index cf789eb..c2078fb 100644
--- a/src/i830_ring.h
+++ b/src/i830_ring.h
@@ -75,28 +75,13 @@ union intfloat {
     pI830->ring_emitting = 0;						\
 } while (0)
 
-/*
- * XXX Note: the head/tail masks are different for 810 and i830.
- * If the i810 always sets the higher bits to 0, then this shouldn't be
- * a problem.  Check this!
- */
-#define DO_RING_IDLE() do {						\
-    int _head;								\
-    int _tail;								\
-    do {								\
-	_head = INREG(LP_RING + RING_HEAD) & I830_HEAD_MASK;		\
-	_tail = INREG(LP_RING + RING_TAIL) & I830_TAIL_MASK;		\
-	DELAY(10);							\
-    } while (_head != _tail);						\
-} while (0)
-
 #define BEGIN_LP_RING(n)						\
 do {									\
     if (pI830->ring_emitting != 0)					\
 	FatalError("%s: BEGIN_LP_RING called without closing "		\
 		   "ADVANCE_LP_RING\n", __FUNCTION__);			\
     if ((n) > 2 && (I810_DEBUG&DEBUG_ALWAYS_SYNC))			\
-	DO_RING_IDLE();							\
+	i830_wait_ring_idle(pScrn);					\
     pI830->ring_emitting = (n) * 4;					\
     if ((n) & 1)							\
 	pI830->ring_emitting += 4;					\

commit 7d267e27c152a4935ec5301d9fbbfd6eff8816d4
Author: Eric Anholt <eric@anholt.net>
Date:   Thu Jun 5 11:26:02 2008 -0700

    Just remove the mprotect kludge.
    
    Besides not being #ifdef __linux__ed as requested, some linux kernels break
    in exciting new ways when you try to mprotect from PROT_NONE back to
    PROT_READ|PROT_WRITE.  Yes, there are bugs in the code we're calling in a
    bug-exploiting bug workaround.
    
    If you want this workaround for the original bug exposed when moving to
    libpciaccess, it's already in libpciaccess.
    (cherry picked from commit 65306cdd71dad71e4ca7229764f81a0880dd70bf)

diff --git a/src/i830_driver.c b/src/i830_driver.c
index f1efa7b..a237374 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -692,11 +692,6 @@ I830MapMem(ScrnInfoPtr pScrn)
 			       (void **) &pI830->FbBase);
     if (err)
 	return FALSE;
-    /* KLUDGE ALERT -- rewrite the PTEs to turn off the CD and WT bits */
-#if HAVE_MPROTECT
-    mprotect (pI830->FbBase, pI830->FbMapSize, PROT_NONE);
-    mprotect (pI830->FbBase, pI830->FbMapSize, PROT_READ|PROT_WRITE);
-#endif
 #else
    pI830->FbBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER,
 				 pI830->PciTag,

commit 85308ab8aaf58b6620a41621128eba0b7e1ffb44
Author: Hong Liu <hong.liu@intel.com>
Date:   Wed Jun 4 16:58:05 2008 +0800

    Set SDVO sync polarity to default on 965
    
    Fix fd.o bug 15766
    (cherry picked from commit beb72ae5aa053303f5cc419e9c9d7c6db964f160)

diff --git a/src/i810_reg.h b/src/i810_reg.h
index 5ca8ca9..79a5b1e 100644
--- a/src/i810_reg.h
+++ b/src/i810_reg.h
@@ -1222,6 +1222,10 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define SDVO_CLOCK_OUTPUT_INVERT		(1 << 18)
 #define SDVOC_GANG_MODE				(1 << 16)
 #define SDVO_BORDER_ENABLE			(1 << 7)
+/** new with 965, default is to be set */
+#define SDVO_VSYNC_ACTIVE_HIGH			(1 << 4)
+#define SDVO_HSYNC_ACTIVE_HIGH			(1 << 3)
+/** 915/945 only, read-only bit */
 #define SDVOB_PCIE_CONCURRENCY			(1 << 3)
 #define SDVO_DETECTED				(1 << 2)
 /* Bits to be preserved when writing */
diff --git a/src/i830_sdvo.c b/src/i830_sdvo.c
index f60e38c..0dc6dca 100644
--- a/src/i830_sdvo.c
+++ b/src/i830_sdvo.c
@@ -730,7 +730,9 @@ i830_sdvo_mode_set(xf86OutputPtr output, DisplayModePtr mode,
 
     /* Set the SDVO control regs. */
     if (IS_I965G(pI830)) {
-	sdvox = SDVO_BORDER_ENABLE;
+	sdvox = SDVO_BORDER_ENABLE |
+		SDVO_VSYNC_ACTIVE_HIGH |
+		SDVO_HSYNC_ACTIVE_HIGH;
     } else {
 	sdvox = INREG(dev_priv->output_device);
 	switch (dev_priv->output_device) {

commit 14dc93cb4dabdd83ee62a2a497c210aeb52f6c30
Author: Zhenyu Wang <zhenyu.z.wang@intel.com>
Date:   Thu Jun 12 13:47:04 2008 +0800

    xvmc: a little cleanup
    
    Also safe check context size to not exceed surface max.

diff --git a/src/i830.h b/src/i830.h
index 755c773..db930a0 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -660,6 +660,8 @@ typedef struct _I830Rec {
 
 #define I830PTR(p) ((I830Ptr)((p)->driverPrivate))
 
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
+
 #define I830_SELECT_FRONT	0
 #define I830_SELECT_BACK	1
 #define I830_SELECT_DEPTH	2
diff --git a/src/i915_hwmc.c b/src/i915_hwmc.c
index c3d3c75..50e1106 100644
--- a/src/i915_hwmc.c
+++ b/src/i915_hwmc.c
@@ -95,8 +95,6 @@ typedef struct _I915XvMC
     PutImageFuncPtr savePutImage;
 } I915XvMC, *I915XvMCPtr;
 
-#define ARRARY_SIZE(a) (sizeof(a) / sizeof(a[0]))
-
 /*
 static int yv12_subpicture_index_list[2] =
 {
@@ -161,6 +159,22 @@ static XF86ImagePtr i915_subpicture_list[2] =
 };
 #endif
 
+/* Check context size not exceed surface type max */
+static void
+i915_check_context_size(XvMCContextPtr ctx)
+{
+    int i;
+
+    for (i = 0; i < ARRAY_SIZE(ppSI); i++) {
+	if (ctx->surface_type_id == ppSI[i]->surface_type_id) {
+	    if (ctx->width > ppSI[i]->max_width)
+		ctx->width = ppSI[i]->max_width;
+	    if (ctx->height > ppSI[i]->max_height)
+		ctx->height = ppSI[i]->max_height;
+	}
+    }
+}
+
 /*
  * Init and clean up the screen private parts of XvMC.
  */
@@ -430,6 +444,8 @@ static int i915_xvmc_create_context (ScrnInfoPtr pScrn, XvMCContextPtr pContext,
         return BadAlloc;
     }
 
+    i915_check_context_size(pContext);
+
     *priv = xcalloc(1, sizeof(I915XvMCCreateContextRec));
     contextRec = (I915XvMCCreateContextRec *)*priv;
 
@@ -776,10 +792,9 @@ static int i915_xvmc_put_image(ScrnInfoPtr pScrn,
     struct intel_xvmc_command *xvmc_cmd = (struct intel_xvmc_command *)buf;
     int ret;
 
-    if (pI830->XvMCEnabled) {
-        if (FOURCC_XVMC == id) {
-            switch (xvmc_cmd->command) {
-            case INTEL_XVMC_COMMAND_DISPLAY:
+    if (FOURCC_XVMC == id) {
+	switch (xvmc_cmd->command) {
+	    case INTEL_XVMC_COMMAND_DISPLAY:
 		if ((xvmc_cmd->srfNo >= I915_XVMC_MAX_SURFACES) ||
 			!pXvMC->surfaces[xvmc_cmd->srfNo] ||
 			!pXvMC->sfprivs[xvmc_cmd->srfNo]) {
@@ -793,10 +808,9 @@ static int i915_xvmc_put_image(ScrnInfoPtr pScrn,
 		id = xvmc_cmd->real_id;
 		pI830->IsXvMCSurface = 1;
 		break;
-            default:
-                return 0;
-            }
-        }
+	    default:
+		return 0;
+	}
     }
 
     ret = pXvMC->savePutImage(pScrn, src_x, src_y, drw_x, drw_y, src_w, src_h,
@@ -850,7 +864,7 @@ static void i915_xvmc_fini(ScrnInfoPtr pScrn)
 static XF86MCAdaptorRec pAdapt =
 {
     .name		= "Intel(R) Textured Video",
-    .num_surfaces	= ARRARY_SIZE(ppSI),
+    .num_surfaces	= ARRAY_SIZE(ppSI),
     .surfaces		= ppSI,
 #if 0
     .num_subpictures	= ARRARY_SIZE(i915_subpicture_list),
diff --git a/src/i915_hwmc.h b/src/i915_hwmc.h
index 0141fb2..7d90afc 100644
--- a/src/i915_hwmc.h
+++ b/src/i915_hwmc.h
@@ -32,7 +32,7 @@
 #define STRIDE(w)               (((w) + 0x3ff) & ~0x3ff)
 #define SIZE_Y420(w, h)         (h * STRIDE(w))
 #define SIZE_UV420(w, h)        ((h >> 1) * STRIDE(w >> 1))
-#define SIZE_YUV420(w, h)       (h * (STRIDE(w) + STRIDE(w >> 1)))
+#define SIZE_YUV420(w, h)       (SIZE_Y420(w,h) + SIZE_UV420(w,h) * 2)
 #define SIZE_XX44(w, h)         (h * STRIDE(w))
 
 #define I915_NUM_XVMC_ATTRIBUTES       0x02
diff --git a/src/xvmc/i915_xvmc.c b/src/xvmc/i915_xvmc.c
index f2d8ded..b1a17b4 100644
--- a/src/xvmc/i915_xvmc.c
+++ b/src/xvmc/i915_xvmc.c
@@ -1987,7 +1987,7 @@ static int i915_xvmc_mc_render_surface(Display *display, XvMCContext *context,
 		XVMC_ERR("Invalid Macroblock Parameters found.");
                 break;
             }
-        } else {        /* Frame Picture */
+        } else {        /* Field Picture */
             switch (mb->motion_type & 3) {
             case XVMC_PREDICTION_FIELD: /* Field Based */
                 i915_mc_mpeg_macroblock_1fbmv(context, mb);
@@ -2005,7 +2005,7 @@ static int i915_xvmc_mc_render_surface(Display *display, XvMCContext *context,
 		XVMC_ERR("Invalid Macroblock Parameters found.");
                 break;
             }
-        }       /* Field Picture */
+        }
     }
 
     intelFlushBatch(TRUE);

commit ce674bd39c2fe2844b449fad6cfe83b4d18adad6
Author: Zhenyu Wang <zhenyu.z.wang@intel.com>


Reply to: