xf86-video-intel: Branch 'modesetting-gem' - 20 commits - src/bios_reader/Makefile.am src/bios_reader/swf_dumper.c src/i810_driver.c src/i810_reg.h src/i830_bios.h src/i830_display.c src/i830_driver.c src/i830_exa.c src/i830_hdmi.c src/i830_lvds.c src/i830_memory.c src/i830_quirks.c src/reg_dumper/idle.c src/xvmc/intel_xvmc.c

Jesse Barnes jbarnes at kemper.freedesktop.org
Tue Aug 19 15:53:30 PDT 2008


 src/bios_reader/Makefile.am  |    8 ++
 src/bios_reader/swf_dumper.c |  108 ++++++++++++++++++++++++++++++++
 src/i810_driver.c            |    2 
 src/i810_reg.h               |    2 
 src/i830_bios.h              |  145 +++++++++++++++++++++++++++++++++++++------
 src/i830_display.c           |   57 ++++++++--------
 src/i830_driver.c            |   12 ++-
 src/i830_exa.c               |    2 
 src/i830_hdmi.c              |    9 ++
 src/i830_lvds.c              |   13 ++-
 src/i830_memory.c            |    2 
 src/i830_quirks.c            |    1 
 src/reg_dumper/idle.c        |   28 ++++----
 src/xvmc/intel_xvmc.c        |    4 -
 14 files changed, 318 insertions(+), 75 deletions(-)

New commits:
commit f26bcb9cb879e2e9ee2b26c95438cf46286c0208
Merge: 67ab546... 7a1cc48...
Author: Jesse Barnes <jbarnes at virtuousgeek.org>
Date:   Tue Aug 19 15:53:18 2008 -0700

    Merge branch 'master' into modesetting-gem
    
    Conflicts:
    
    	src/i830_driver.c

diff --cc src/i830_driver.c
index 561351c,79c2078..2ce8942
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@@ -1399,354 -1347,6 +1399,354 @@@ static const char *accel_name[] 
     "UXA",
  };
  
 +static Bool
 +I830LoadSyms(ScrnInfoPtr pScrn)
 +{
 +    I830Ptr pI830 = I830PTR(pScrn);
 +
 +    if (pI830->use_drm_mode)
 +	return TRUE;
 +
 +    /* Load int10 module */
 +    if (!xf86LoadSubModule(pScrn, "int10"))
 +	return FALSE;
 +    xf86LoaderReqSymLists(I810int10Symbols, NULL);
 +
 +    /* The vgahw module should be loaded here when needed */
 +    if (!xf86LoadSubModule(pScrn, "vgahw"))
 +	return FALSE;
 +    xf86LoaderReqSymLists(I810vgahwSymbols, NULL);
 +
 +    return TRUE;
 +}
 +
 +static Bool
 +I830GetEarlyOptions(ScrnInfoPtr pScrn)
 +{
 +    I830Ptr pI830 = I830PTR(pScrn);
 +
 +    /* Process the options */
 +    xf86CollectOptions(pScrn, NULL);
 +    if (!(pI830->Options = xalloc(sizeof(I830Options))))
 +	return FALSE;
 +    memcpy(pI830->Options, I830Options, sizeof(I830Options));
 +    xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pI830->Options);
 +
 +    if (xf86ReturnOptValBool(pI830->Options, OPTION_MODEDEBUG, FALSE)) {
 +	pI830->debug_modes = TRUE;
 +    } else {
 +	pI830->debug_modes = FALSE;
 +    }
 +
 +    if (xf86ReturnOptValBool(pI830->Options, OPTION_LVDS24BITMODE, FALSE)) {
 +	pI830->lvds_24_bit_mode = TRUE;
 +    } else {
 +	pI830->lvds_24_bit_mode = FALSE;
 +    }
 +
 +    if (xf86ReturnOptValBool(pI830->Options, OPTION_LVDSFIXEDMODE, TRUE)) {
- 	pI830->skip_panel_detect = TRUE;
-     } else {
 +	pI830->skip_panel_detect = FALSE;
++    } else {
++	pI830->skip_panel_detect = TRUE;
 +    }
 +
 +    if (xf86ReturnOptValBool(pI830->Options, OPTION_FORCEENABLEPIPEA, FALSE))
 +	pI830->quirk_flag |= QUIRK_PIPEA_FORCE;
 +
 +    return TRUE;
 +}
 +
 +static void
 +I830PreInitCrtcConfig(ScrnInfoPtr pScrn)
 +{
 +    xf86CrtcConfigPtr   xf86_config;
 +    I830Ptr pI830 = I830PTR(pScrn);
 +    int max_width, max_height;
 +
 +    if (pI830->use_drm_mode)
 +	return;
 +
 +    /* check quirks */
 +    i830_fixup_devices(pScrn);
 +
 +    /* Allocate an xf86CrtcConfig */
 +    xf86CrtcConfigInit (pScrn, &i830_xf86crtc_config_funcs);
 +    xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
 +
 +    /* See i830_exa.c comments for why we limit the framebuffer size like this.
 +     */
 +    if (IS_I965G(pI830)) {
 +	max_width = 8192;
 +	max_height = 8192;
 +    } else {
 +	max_width = 2048;
 +	max_height = 2048;
 +    }
 +    xf86CrtcSetSizeRange (pScrn, 320, 200, max_width, max_height);
 +}
 +
 +static Bool
 +I830AccelMethodInit(ScrnInfoPtr pScrn)
 +{
 +    I830Ptr pI830 = I830PTR(pScrn);
 +    MessageType from = X_PROBED;
 +    char *s;
 +    int i, num_pipe;
 +
 +    if (xf86ReturnOptValBool(pI830->Options, OPTION_NOACCEL, FALSE)) {
 +	pI830->accel = ACCEL_NONE;
 +    }
 +
 +    /*
 +     * The ugliness below:
 +     * If either XAA or EXA (exclusive) is compiled in, default to it.
 +     *
 +     * If both are compiled in, and the user didn't specify noAccel, use the
 +     * config option AccelMethod to determine which to use, defaulting to EXA
 +     * if none is specified, or if the string was unrecognized.
 +     *
 +     * All this *could* go away if we removed XAA support from this driver,
 +     * for example. :)
 +     */
 +    if (!(pI830->accel == ACCEL_NONE)) {
 +#ifdef I830_USE_UXA
 +	pI830->accel = ACCEL_UXA;
 +#endif
 +#ifdef I830_USE_EXA
 +	pI830->accel = ACCEL_EXA;
 +#endif
 +#if I830_USE_XAA + I830_USE_EXA + I830_USE_UXA >= 2
 +	from = X_DEFAULT;
 +	if ((s = (char *)xf86GetOptValString(pI830->Options,
 +					     OPTION_ACCELMETHOD))) {
 +	    if (!xf86NameCmp(s, "EXA")) {
 +		from = X_CONFIG;
 +		pI830->accel = ACCEL_EXA;
 +	    }
 +	    else if (!xf86NameCmp(s, "XAA")) {
 +		from = X_CONFIG;
 +		pI830->accel = ACCEL_XAA;
 +	    }
 +	    else if (!xf86NameCmp(s, "UXA")) {
 +		from = X_CONFIG;
 +	       pI830->accel = ACCEL_UXA;
 +	    }
 +	}
 +#endif
 +	xf86DrvMsg(pScrn->scrnIndex, from, "Using %s for acceleration\n",
 +		   accel_name[pI830->accel]);
 +    }
 +
 +    if (xf86ReturnOptValBool(pI830->Options, OPTION_SW_CURSOR, FALSE)) {
 +	pI830->SWCursor = TRUE;
 +    }
 +
 +    pI830->directRenderingDisabled =
 +	!xf86ReturnOptValBool(pI830->Options, OPTION_DRI, TRUE);
 +
 +#ifdef XF86DRI
 +    if (!pI830->directRenderingDisabled) {
 +	if ((pI830->accel == ACCEL_NONE) || pI830->SWCursor) {
 +	    xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "DRI is disabled because it "
 +		       "needs HW cursor and 2D acceleration.\n");
 +	    pI830->directRenderingDisabled = TRUE;
 +	} else if (pScrn->depth != 16 && pScrn->depth != 24) {
 +	    xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "DRI is disabled because it "
 +		       "runs only at depths 16 and 24.\n");
 +	    pI830->directRenderingDisabled = TRUE;
 +	}
 +
 +	if (!pI830->directRenderingDisabled) {
 +	    pI830->allocate_classic_textures = TRUE;
 +
 +	    from = X_PROBED;
 +
 +#ifdef XF86DRI_MM
 +	    if (!IS_I965G(pI830)) {
 +		Bool tmp;
 +
 +		if (xf86GetOptValBool(pI830->Options,
 +				      OPTION_INTELTEXPOOL, &tmp)) {
 +		    from = X_CONFIG;
 +		    if (!tmp)
 +			pI830->allocate_classic_textures = FALSE;
 +		}
 +	    }
 +#endif /* XF86DRI_MM */
 +	}
 +    }
 +#endif /* XF86DRI */
 +
 +    I830MapMMIO(pScrn);
 +
 +    if (pI830->debug_modes) {
 +	xf86DrvMsg(pScrn->scrnIndex, X_INFO,
 +		   "Hardware state on X startup:\n");
 +	i830DumpRegs (pScrn);
 +    }
 +
 +    i830TakeRegSnapshot(pScrn);
 +
 +    if (DEVICE_ID(pI830->PciInfo) == PCI_CHIP_E7221_G)
 +	num_pipe = 1;
 +    else
 +	if (IS_MOBILE(pI830) || IS_I9XX(pI830))
 +	    num_pipe = 2;
 +	else
 +	    num_pipe = 1;
 +    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%d display pipe%s available.\n",
 +	       num_pipe, num_pipe > 1 ? "s" : "");
 +
 +    I830PreInitDDC(pScrn);
 +    for (i = 0; i < num_pipe; i++) {
 +	i830_crtc_init(pScrn, i);
 +    }
 +    I830SetupOutputs(pScrn);
 +
 +    SaveHWState(pScrn);
 +    if (!xf86InitialConfiguration (pScrn, FALSE))
 +    {
 +	xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes.\n");
 +	RestoreHWState(pScrn);
 +	PreInitCleanup(pScrn);
 +	return FALSE;
 +    }
 +    RestoreHWState(pScrn);
 +
 +    /* XXX This should go away, replaced by xf86Crtc.c support for it */
 +    pI830->rotation = RR_Rotate_0;
 +
 +    /*
 +     * Let's setup the mobile systems to check the lid status
 +     */
 +    if (IS_MOBILE(pI830)) {
 +	pI830->checkDevices = TRUE;
 +
 +	if (!xf86ReturnOptValBool(pI830->Options, OPTION_CHECKDEVICES, TRUE)) {
 +	    pI830->checkDevices = FALSE;
 +	    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Monitoring connected displays disabled\n");
 +	} else
 +	    if (pI830->entityPrivate && !I830IsPrimary(pScrn) &&
 +		!I830PTR(pI830->entityPrivate->pScrn_1)->checkDevices) {
 +		/* If checklid is off, on the primary head, then
 +		 * turn it off on the secondary*/
 +		xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Monitoring connected displays disabled\n");
 +		pI830->checkDevices = FALSE;
 +	    } else
 +		xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Monitoring connected displays enabled\n");
 +    } else
 +	pI830->checkDevices = FALSE;
 +
 +    pI830->stolen_size = I830DetectMemory(pScrn);
 +
 +    return TRUE;
 +}
 +
 +static Bool
 +I830DrmModeInit(ScrnInfoPtr pScrn)
 +{
 +#ifdef XF86DRM_MODE
 +    I830Ptr pI830 = I830PTR(pScrn);
 +    char *bus_id;
 +    char *s;
 +
 +    /* Default to EXA but allow override */
 +    pI830->accel = ACCEL_EXA;
 +
 +    if ((s = (char *)xf86GetOptValString(pI830->Options, OPTION_ACCELMETHOD))) {
 +	if (!xf86NameCmp(s, "EXA"))
 +	    pI830->accel = ACCEL_EXA;
 +	else if (!xf86NameCmp(s, "UXA"))
 +	    pI830->accel = ACCEL_UXA;
 +	else
 +	    pI830->accel = ACCEL_EXA;
 +    }
 +
 +    bus_id = DRICreatePCIBusID(pI830->PciInfo);
 +    if (drmmode_pre_init(pScrn, &pI830->drmmode, bus_id, "i915",
 +			 pI830->cpp) == FALSE) {
 +	xfree(bus_id);
 +	xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
 +		   "Kernel modesetting setup failed\n");
 +	PreInitCleanup(pScrn);
 +	return FALSE;
 +    }
 +
 +    pI830->drmmode.create_new_fb = i830_create_new_fb;
 +
 +    pI830->drmSubFD = pI830->drmmode.fd;
 +    xfree(bus_id);
 +
 +    pI830->directRenderingDisabled = FALSE;
 +    pI830->allocate_classic_textures = FALSE;
 +
 +    i830_init_bufmgr(pScrn);
 +#endif
 +
 +    return TRUE;
 +}
 +
 +static void
 +I830XvInit(ScrnInfoPtr pScrn)
 +{
 +    I830Ptr pI830 = I830PTR(pScrn);
 +    MessageType from = X_PROBED;
 +
 +    pI830->XvDisabled =
 +	!xf86ReturnOptValBool(pI830->Options, OPTION_XVIDEO, TRUE);
 +
 +#ifdef I830_XV
 +    if (xf86GetOptValInteger(pI830->Options, OPTION_VIDEO_KEY,
 +			     &(pI830->colorKey))) {
 +	from = X_CONFIG;
 +    } else if (xf86GetOptValInteger(pI830->Options, OPTION_COLOR_KEY,
 +				    &(pI830->colorKey))) {
 +	from = X_CONFIG;
 +    } else {
 +	pI830->colorKey =
 +	    (1 << pScrn->offset.red) | (1 << pScrn->offset.green) |
 +	    (((pScrn->mask.blue >> pScrn->offset.blue) - 1) <<
 +	     pScrn->offset.blue);
 +	from = X_DEFAULT;
 +    }
 +    xf86DrvMsg(pScrn->scrnIndex, from, "video overlay key set to 0x%x\n",
 +	       pI830->colorKey);
 +#endif
 +#ifdef INTEL_XVMC
 +    pI830->XvMCEnabled = FALSE;
 +    from =  (!pI830->directRenderingDisabled &&
 +	     xf86GetOptValBool(pI830->Options, OPTION_XVMC,
 +			       &pI830->XvMCEnabled)) ? X_CONFIG : X_DEFAULT;
 +    xf86DrvMsg(pScrn->scrnIndex, from, "Intel XvMC decoder %sabled\n",
 +	       pI830->XvMCEnabled ? "en" : "dis");
 +#endif
 +}
 +
 +static void
 +I830DriOptsInit(ScrnInfoPtr pScrn)
 +{
 +#ifdef XF86DRI
 +    I830Ptr pI830 = I830PTR(pScrn);
 +    MessageType from = X_PROBED;
 +
 +    pI830->allowPageFlip = FALSE;
 +    from = (!pI830->directRenderingDisabled &&
 +	    xf86GetOptValBool(pI830->Options, OPTION_PAGEFLIP,
 +			      &pI830->allowPageFlip)) ? X_CONFIG : X_DEFAULT;
 +
 +    xf86DrvMsg(pScrn->scrnIndex, from, "Will%s try to enable page flipping\n",
 +	       pI830->allowPageFlip ? "" : " not");
 +
 +    pI830->TripleBuffer = FALSE;
 +    from =  (!pI830->directRenderingDisabled &&
 +	     xf86GetOptValBool(pI830->Options, OPTION_TRIPLEBUFFER,
 +			       &pI830->TripleBuffer)) ? X_CONFIG : X_DEFAULT;
 +
 +    xf86DrvMsg(pScrn->scrnIndex, from, "Triple buffering %sabled\n",
 +	       pI830->TripleBuffer ? "en" : "dis");
 +#endif /* XF86DRI */
 +}
 +
  /**
   * This is called per zaphod head (so usually just once) to do initialization
   * before the Screen is created.
commit 67ab5462527c5ed94ed073421b60e85a213ea267
Author: Jesse Barnes <jbarnes at virtuousgeek.org>
Date:   Tue Aug 19 15:46:52 2008 -0700

    Use GTT mapping for EXA PrepareAccess function
    
    Makes software fallbacks *much* faster.

diff --git a/src/i830_exa.c b/src/i830_exa.c
index e59ceaa..9ba8df9 100644
--- a/src/i830_exa.c
+++ b/src/i830_exa.c
@@ -535,7 +535,7 @@ static Bool I830EXAPrepareAccess(PixmapPtr pPix, int index)
 	I830Sync(scrn);
 	i830->need_sync = FALSE;
     }
-    if (dri_bo_map(driver_priv->bo, 1)) {
+    if (dri_gem_bo_map_gtt(driver_priv->bo)) {
 	xf86DrvMsg(scrn->scrnIndex, X_WARNING, "%s: bo map failed\n",
 		   __FUNCTION__);
 	return FALSE;
commit 547cf774801bea2177d1224204f7de0dbf6baf3c
Author: Jesse Barnes <jbarnes at virtuousgeek.org>
Date:   Tue Aug 19 15:45:26 2008 -0700

    Don't allocate EXA offscreen space if kernel mode setting is active
    
    We'll use GEM alloc & free routines in that case.

diff --git a/src/i830_memory.c b/src/i830_memory.c
index 4128494..443cc4e 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -1447,7 +1447,7 @@ i830_allocate_2d_memory(ScrnInfoPtr pScrn)
 	return FALSE;
 
 #ifdef I830_USE_EXA
-    if (pI830->accel == ACCEL_EXA) {
+    if (pI830->accel == ACCEL_EXA && !pI830->use_drm_mode) {
 	if (pI830->exa_offscreen == NULL) {
 	    /* Default EXA to having 3 screens worth of offscreen memory space
 	     * (for pixmaps).
commit 2ddd85f8aef5da1aebbfe9fab510858e7a41860d
Author: Jesse Barnes <jbarnes at virtuousgeek.org>
Date:   Tue Aug 19 15:41:41 2008 -0700

    Bail out if kernel mode setting is active but DRI fails

diff --git a/src/i830_driver.c b/src/i830_driver.c
index 289f8b8..561351c 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -3448,11 +3448,15 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
    if (pI830->directRenderingEnabled) {
       pI830->directRenderingOpen = TRUE;
       xf86DrvMsg(pScrn->scrnIndex, X_INFO, "direct rendering: Enabled\n");
-   } else {
+   } else if (!pI830->use_drm_mode) {
       if (pI830->directRenderingDisabled)
 	 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "direct rendering: Disabled\n");
       else
 	 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "direct rendering: Failed\n");
+   } else {
+       xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+		  "failed to enable direct rendering, aborting\n");
+       return FALSE;
    }
 #else
    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "direct rendering: Not available\n");
commit 7a1cc48276f974d04e1c5ef7c92d98fe5ae9d4fa
Author: Jesse Barnes <jbarnes at virtuousgeek.org>
Date:   Tue Aug 19 10:44:04 2008 -0700

    Add VBIOS software flags dumper program
    
    Still need to actually print all the flags & test on various platforms, but at
    least the bits are documented now.

diff --git a/src/bios_reader/Makefile.am b/src/bios_reader/Makefile.am
index c4da957..c85081e 100644
--- a/src/bios_reader/Makefile.am
+++ b/src/bios_reader/Makefile.am
@@ -1,6 +1,6 @@
 AM_CFLAGS = @WARN_CFLAGS@ @XORG_CFLAGS@ @XMODES_CFLAGS@ @PCIACCESS_CFLAGS@
 
-noinst_PROGRAMS = bios_reader  $(BIOS_DUMPER)
+noinst_PROGRAMS = bios_reader  $(BIOS_DUMPER) $(SWF_DUMPER)
 
 if LIBPCIACCESS
 BIOS_DUMPER = bios_dumper
@@ -9,4 +9,10 @@ bios_dumper_SOURCES = bios_dumper.c
 
 bios_dumper_LDADD = $(PCIACCESS_LIBS)
 
+SWF_DUMPER = swf_dumper
+
+swf_dumper_SOURCES = swf_dumper.c
+
+swf_dumper_LDADD = $(PCIACCESS_LIBS)
+
 endif
diff --git a/src/bios_reader/swf_dumper.c b/src/bios_reader/swf_dumper.c
new file mode 100644
index 0000000..5d48634
--- /dev/null
+++ b/src/bios_reader/swf_dumper.c
@@ -0,0 +1,108 @@
+/*
+ * Copyright © 2008 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ *    Eric Anholt <eric at anholt.net>
+ *    Jesse Barnes <jesse.barnes at intel.com>
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <errno.h>
+#include <pciaccess.h>
+#include <err.h>
+
+#include "../i810_reg.h"
+#include "../i830_bios.h"
+
+#ifndef DEFFILEMODE
+#define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) /* 0666*/
+#endif
+
+static uint32_t read32(void *base, int reg)
+{
+    uint32_t *addr = (uint32_t *)((unsigned char *)(base) + reg);
+
+    return *addr;
+}
+
+static void write32(void *base, int reg, uint32_t val)
+{
+    uint32_t *addr = (uint32_t *)((unsigned char *)(base) + reg);
+    *addr = val;
+}
+
+static void usage(void)
+{
+    fprintf(stderr, "usage: swf_dumper\n");
+    exit(1);
+}
+
+int main(int argc, char **argv)
+{
+    struct pci_device *dev;
+    int err;
+    void *addr;
+
+    if (argc != 1)
+	usage();
+
+    err = pci_system_init();
+    if (err != 0) {
+	fprintf(stderr, "Couldn't initialize PCI system: %s\n", strerror(err));
+	exit(1);
+    }
+
+    /* Grab the graphics card */
+    dev = pci_device_find_by_slot(0, 0, 2, 0);
+    if (dev == NULL)
+	errx(1, "Couldn't find graphics card");
+
+    err = pci_device_probe(dev);
+    if (err != 0) {
+	fprintf(stderr, "Couldn't probe graphics card: %s\n", strerror(err));
+	exit(1);
+    }
+
+    if (dev->vendor_id != 0x8086)
+	errx(1, "Graphics card is non-intel");
+
+    err = pci_device_map_range(dev, dev->regions[0].base_addr,
+			       dev->regions[0].size,
+			       PCI_DEV_MAP_FLAG_WRITABLE, &addr);
+    if (err) {
+	fprintf(stderr, "Couldn't map MMIO space: %s\n", strerror(err));
+	exit(1);
+    }
+
+    printf("SWF14: 0x%08x\n", read32(addr, SWF14));
+
+    pci_system_cleanup();
+
+    return 0;
+}
diff --git a/src/i830_bios.h b/src/i830_bios.h
index 85729f7..6c8bd93 100644
--- a/src/i830_bios.h
+++ b/src/i830_bios.h
@@ -254,4 +254,125 @@ struct vch_bdb_22 {
 
 int i830_bios_init(ScrnInfoPtr pScrn);
 
+/*
+ * Driver<->VBIOS interaction occurs through scratch bits in
+ * GR18 & SWF*.
+ */
+
+/* GR18 bits are set on display switch and hotkey events */
+#define GR18_DRIVER_SWITCH_EN	(1<<7) /* 0: VBIOS control, 1: driver control */
+#define GR18_HOTKEY_MASK	0x78 /* See also SWF4 15:0 */
+#define   GR18_HK_NONE		(0x0<<3)
+#define   GR18_HK_LFP_STRETCH	(0x1<<3)
+#define   GR18_HK_TOGGLE_DISP	(0x2<<3)
+#define   GR18_HK_DISP_SWITCH	(0x4<<3) /* see SWF14 15:0 for what to enable */
+#define   GR18_HK_POPUP_DISABLED (0x6<<3)
+#define   GR18_HK_POPUP_ENABLED	(0x7<<3)
+#define   GR18_HK_PFIT		(0x8<<3)
+#define   GR18_HK_APM_CHANGE	(0xa<<3)
+#define   GR18_HK_MULTIPLE	(0xc<<3)
+#define GR18_USER_INT_EN	(1<<2)
+#define GR18_A0000_FLUSH_EN	(1<<1)
+#define GR18_SMM_EN		(1<<0)
+
+/* Set by driver, cleared by VBIOS */
+#define SWF00_YRES_SHIFT	16
+#define SWF00_XRES_SHIFT	0
+#define SWF00_RES_MASK		0xffff
+
+/* Set by VBIOS at boot time and driver at runtime */
+#define SWF01_TV2_FORMAT_SHIFT	8
+#define SWF01_TV1_FORMAT_SHIFT	0
+#define SWF01_TV_FORMAT_MASK	0xffff
+
+#define SWF10_VBIOS_BLC_I2C_EN	(1<<29)
+#define SWF10_GTT_OVERRIDE_EN	(1<<28)
+#define SWF10_LFP_DPMS_OVR	(1<<27) /* override DPMS on display switch */
+#define SWF10_ACTIVE_TOGGLE_LIST_MASK (7<<24)
+#define   SWF10_OLD_TOGGLE	0x0
+#define   SWF10_TOGGLE_LIST_1	0x1
+#define   SWF10_TOGGLE_LIST_2	0x2
+#define   SWF10_TOGGLE_LIST_3	0x3
+#define   SWF10_TOGGLE_LIST_4	0x4
+#define SWF10_PANNING_EN	(1<<23)
+#define SWF10_DRIVER_LOADED	(1<<22)
+#define SWF10_EXTENDED_DESKTOP	(1<<21)
+#define SWF10_EXCLUSIVE_MODE	(1<<20)
+#define SWF10_OVERLAY_EN	(1<<19)
+#define SWF10_PLANEB_HOLDOFF	(1<<18)
+#define SWF10_PLANEA_HOLDOFF	(1<<17)
+#define SWF10_VGA_HOLDOFF	(1<<16)
+#define SWF10_ACTIVE_DISP_MASK	0xffff
+#define   SWF10_PIPEB_LFP2	(1<<15)
+#define   SWF10_PIPEB_EFP2	(1<<14)
+#define   SWF10_PIPEB_TV2	(1<<13)
+#define   SWF10_PIPEB_CRT2	(1<<12)
+#define   SWF10_PIPEB_LFP	(1<<11)
+#define   SWF10_PIPEB_EFP	(1<<10)
+#define   SWF10_PIPEB_TV	(1<<9)
+#define   SWF10_PIPEB_CRT	(1<<8)
+#define   SWF10_PIPEA_LFP2	(1<<7)
+#define   SWF10_PIPEA_EFP2	(1<<6)
+#define   SWF10_PIPEA_TV2	(1<<5)
+#define   SWF10_PIPEA_CRT2	(1<<4)
+#define   SWF10_PIPEA_LFP	(1<<3)
+#define   SWF10_PIPEA_EFP	(1<<2)
+#define   SWF10_PIPEA_TV	(1<<1)
+#define   SWF10_PIPEA_CRT	(1<<0)
+
+#define SWF11_MEMORY_SIZE_SHIFT	16
+#define SWF11_SV_TEST_EN	(1<<15)
+#define SWF11_IS_AGP		(1<<14)
+#define SWF11_DISPLAY_HOLDOFF	(1<<13)
+#define SWF11_DPMS_REDUCED	(1<<12)
+#define SWF11_IS_VBE_MODE	(1<<11)
+#define SWF11_PIPEB_ACCESS	(1<<10) /* 0 here means pipe a */
+#define SWF11_DPMS_MASK		0x07
+#define   SWF11_DPMS_OFF	(1<<2)
+#define   SWF11_DPMS_SUSPEND	(1<<1)
+#define   SWF11_DPMS_STANDBY	(1<<0)
+#define   SWF11_DPMS_ON		0
+
+#define SWF14_GFX_PFIT_EN	(1<<31)
+#define SWF14_TEXT_PFIT_EN	(1<<30)
+#define SWF14_LID_STATUS_CLOSED	(1<<29) /* 0 here means open */
+#define SWF14_POPUP_EN		(1<<28)
+#define SWF14_DISPLAY_HOLDOFF	(1<<27)
+#define SWF14_DISP_DETECT_EN	(1<<26)
+#define SWF14_DOCKING_STATUS_DOCKED (1<<25) /* 0 here means undocked */
+#define SWF14_DRIVER_STATUS	(1<<24)
+#define SWF14_OS_TYPE_WIN9X	(1<<23)
+#define SWF14_OS_TYPE_WINNT	(1<<22)
+/* 21:19 rsvd */
+#define SWF14_PM_TYPE_MASK	0x00070000
+#define   SWF14_PM_ACPI_VIDEO	(0x4 << 16)
+#define   SWF14_PM_ACPI		(0x3 << 16)
+#define   SWF14_PM_APM_12	(0x2 << 16)
+#define   SWF14_PM_APM_11	(0x1 << 16)
+#define SWF14_HK_REQUEST_MASK	0x0000ffff /* see GR18 6:3 for event type */
+          /* if GR18 indicates a display switch */
+#define   SWF14_DS_PIPEB_LFP2_EN (1<<15)
+#define   SWF14_DS_PIPEB_EFP2_EN (1<<14)
+#define   SWF14_DS_PIPEB_TV2_EN  (1<<13)
+#define   SWF14_DS_PIPEB_CRT2_EN (1<<12)
+#define   SWF14_DS_PIPEB_LFP_EN  (1<<11)
+#define   SWF14_DS_PIPEB_EFP_EN  (1<<10)
+#define   SWF14_DS_PIPEB_TV_EN   (1<<9)
+#define   SWF14_DS_PIPEB_CRT_EN  (1<<8)
+#define   SWF14_DS_PIPEA_LFP2_EN (1<<7)
+#define   SWF14_DS_PIPEA_EFP2_EN (1<<6)
+#define   SWF14_DS_PIPEA_TV2_EN  (1<<5)
+#define   SWF14_DS_PIPEA_CRT2_EN (1<<4)
+#define   SWF14_DS_PIPEA_LFP_EN  (1<<3)
+#define   SWF14_DS_PIPEA_EFP_EN  (1<<2)
+#define   SWF14_DS_PIPEA_TV_EN   (1<<1)
+#define   SWF14_DS_PIPEA_CRT_EN  (1<<0)
+          /* if GR18 indicates a panel fitting request */
+#define   SWF14_PFIT_EN		(1<<0) /* 0 means disable */
+          /* if GR18 indicates an APM change request */
+#define   SWF14_APM_HIBERNATE	0x4
+#define   SWF14_APM_SUSPEND	0x3
+#define   SWF14_APM_STANDBY	0x1
+#define   SWF14_APM_RESTORE	0x0
+
 #endif /* _I830_BIOS_H_ */
commit 385dc85881c56e218e7d17d7e1d022568aa29cfb
Author: Zou Nan hai <nanhai.zou at intel.com>
Date:   Tue Aug 19 16:27:12 2008 +0800

      Fix from He Shuang(shuang.he at intel.com),
      XvMCDestroyContext to check pointer valid

diff --git a/src/xvmc/intel_xvmc.c b/src/xvmc/intel_xvmc.c
index 8fabb35..ea39069 100644
--- a/src/xvmc/intel_xvmc.c
+++ b/src/xvmc/intel_xvmc.c
@@ -458,11 +458,11 @@ Status XvMCCreateContext(Display *display, XvPortID port,
 Status XvMCDestroyContext(Display *display, XvMCContext *context)
 {
     Status ret;
-    int screen = DefaultScreen(display);
+    int screen;
 
     if (!display || !context)
         return XvMCBadContext;
-
+    screen = DefaultScreen(display);
     ret = (xvmc_driver->destroy_context)(display, context);
     if (ret) {
 	XVMC_ERR("destroy context fail\n");
commit 078a59dd48ed00a6512d155883956c18752da9ce
Author: Jesse Barnes <jbarnes at virtuousgeek.org>
Date:   Mon Aug 18 12:53:33 2008 -0700

    Remove unused VBIOS flag defines
    
    We just use the structure definitions now.

diff --git a/src/i830_bios.h b/src/i830_bios.h
index 817ac2d..85729f7 100644
--- a/src/i830_bios.h
+++ b/src/i830_bios.h
@@ -140,14 +140,6 @@ struct bdb_general_definitions {
 	/* may be another device block here on some platforms */
 } __attribute__((packed));
 
-#define LVDS_CAP_EDID			(1 << 6)
-#define LVDS_CAP_DITHER			(1 << 5)
-#define LVDS_CAP_PFIT_AUTO_RATIO	(1 << 4)
-#define LVDS_CAP_PFIT_GRAPHICS_MODE	(1 << 3)
-#define LVDS_CAP_PFIT_TEXT_MODE		(1 << 2)
-#define LVDS_CAP_PFIT_GRAPHICS		(1 << 1)
-#define LVDS_CAP_PFIT_TEXT		(1 << 0)
-
 struct bdb_lvds_options {
     uint8_t panel_type;
     uint8_t rsvd1;
@@ -196,8 +188,6 @@ struct lvds_dvo_timing {
     uint8_t h_border;
     uint8_t v_border;
     uint8_t flags;
-#define FP_EDID_FLAG_VSYNC_POSITIVE	(1 << 2)
-#define FP_EDID_FLAG_HSYNC_POSITIVE	(1 << 1)
 } __attribute__((packed));
 
 struct lvds_pnp_id {
commit 7048141254b7c1948fe77b1742b463f8723610d8
Author: Jesse Barnes <jbarnes at virtuousgeek.org>
Date:   Mon Aug 18 12:51:31 2008 -0700

    Pack bdb_general_definitions block
    
    More correct & consistent with other definitions.

diff --git a/src/i830_bios.h b/src/i830_bios.h
index 2b073f3..817ac2d 100644
--- a/src/i830_bios.h
+++ b/src/i830_bios.h
@@ -138,7 +138,7 @@ struct bdb_general_definitions {
 	unsigned char dev3[33];
 	unsigned char dev4[33];
 	/* may be another device block here on some platforms */
-};
+} __attribute__((packed));
 
 #define LVDS_CAP_EDID			(1 << 6)
 #define LVDS_CAP_DITHER			(1 << 5)
commit 0e6759bb6ad7293b6447bd20e3d7d8fdee46aba7
Author: Zhenyu Wang <zhenyu.z.wang at intel.com>
Date:   Tue Aug 19 07:30:01 2008 +0800

    Fix reverted LVDS bios capability dword definition
    
    Issue found by Peter Clifton.

diff --git a/src/i830_bios.h b/src/i830_bios.h
index a8d9add..2b073f3 100644
--- a/src/i830_bios.h
+++ b/src/i830_bios.h
@@ -152,13 +152,13 @@ struct bdb_lvds_options {
     uint8_t panel_type;
     uint8_t rsvd1;
     /* LVDS capabilities, stored in a dword */
-    uint8_t rsvd2:1;
-    uint8_t lvds_edid:1;
-    uint8_t pixel_dither:1;
-    uint8_t pfit_ratio_auto:1;
-    uint8_t pfit_gfx_mode_enhanced:1;
-    uint8_t pfit_text_mode_enhanced:1;
     uint8_t pfit_mode:2;
+    uint8_t pfit_text_mode_enhanced:1;
+    uint8_t pfit_gfx_mode_enhanced:1;
+    uint8_t pfit_ratio_auto:1;
+    uint8_t pixel_dither:1;
+    uint8_t lvds_edid:1;
+    uint8_t rsvd2:1;
     uint8_t rsvd4;
 } __attribute__((packed));
 
commit 76b5a7ff5c943cfaa254d2fd94b6397c91d1f8e6
Author: Shaohua Li <shaohua.li at intel.com>
Date:   Mon Aug 18 11:13:20 2008 +0800

    [PATCH] avoid duplicate mode set in lvds
    
    xf86SetDesiredModes() already sets lvds to full mode. later when
    xf86CrtcScreenInit() initialized randr12, i830_lvds_set_property will
    recall xf86CrtcSetMode and set mode to full. This patch is to remove the
    duplication. In my test, this can save about 0.2 - 0.4s x startup time.

diff --git a/src/i830_lvds.c b/src/i830_lvds.c
index 96e9f00..e5feab0 100644
--- a/src/i830_lvds.c
+++ b/src/i830_lvds.c
@@ -1115,6 +1115,9 @@ i830_lvds_set_property(xf86OutputPtr output, Atom property,
 	if (ret < 0)
 	    return FALSE;
 
+	if (dev_priv->fitting_mode == ret)
+	    return TRUE;
+
 	dev_priv->fitting_mode = ret;
 
 	if (output->crtc) {
commit 6eb3e0f2f4e43e436029fc82e458ac8de1f94745
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Aug 15 15:47:35 2008 -0400

    Don't touch pScrn->monitor->DDC directly.

diff --git a/src/i810_driver.c b/src/i810_driver.c
index 8540646..856f5ec 100644
--- a/src/i810_driver.c
+++ b/src/i810_driver.c
@@ -1064,7 +1064,7 @@ I810PreInit(ScrnInfoPtr pScrn, int flags)
    /* after xf86ProcessOptions,
     * because it is controlled by options [no]vbe and [no]ddc
     */
-   pScrn->monitor->DDC = I810DoDDC(pScrn, pI810->pEnt->index);
+   I810DoDDC(pScrn, pI810->pEnt->index);
 
    /* We have to use PIO to probe, because we haven't mapped yet */
    I810SetPIOAccess(pI810);
commit ed7269e0a377b3135b06cacecc59119f06958feb
Author: Zhenyu Wang <zhenyu.z.wang at intel.com>
Date:   Fri Aug 15 10:10:43 2008 +0800

    Always check and free driver private in LVDS destroy

diff --git a/src/i830_lvds.c b/src/i830_lvds.c
index 78fd2d8..96e9f00 100644
--- a/src/i830_lvds.c
+++ b/src/i830_lvds.c
@@ -824,11 +824,9 @@ i830_lvds_destroy (xf86OutputPtr output)
     I830Ptr	pI830 = I830PTR(pScrn);
     I830OutputPrivatePtr    intel_output = output->driver_private;
 
-    if (pI830->lvds_fixed_mode)
-    {
-        xf86DeleteMode (&pI830->lvds_fixed_mode, pI830->lvds_fixed_mode);
+    xf86DeleteMode (&pI830->lvds_fixed_mode, pI830->lvds_fixed_mode);
+    if (intel_output)
 	xfree (intel_output);
-    }
 }
 
 #ifdef RANDR_12_INTERFACE
commit f4cb9a135dca9279af8186a9b18bf62ef7351019
Author: Zhenyu Wang <zhenyu.z.wang at intel.com>
Date:   Fri Aug 15 10:02:44 2008 +0800

    Make skip_panel_detect clear for its meaning

diff --git a/src/i830_driver.c b/src/i830_driver.c
index 35f7242..79c2078 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -1510,9 +1510,9 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
    }
 
    if (xf86ReturnOptValBool(pI830->Options, OPTION_LVDSFIXEDMODE, TRUE)) {
-      pI830->skip_panel_detect = TRUE;
-   } else {
       pI830->skip_panel_detect = FALSE;
+   } else {
+      pI830->skip_panel_detect = TRUE;
    }
 
    if (xf86ReturnOptValBool(pI830->Options, OPTION_FORCEENABLEPIPEA, FALSE))
diff --git a/src/i830_lvds.c b/src/i830_lvds.c
index a885627..78fd2d8 100644
--- a/src/i830_lvds.c
+++ b/src/i830_lvds.c
@@ -1255,7 +1255,7 @@ i830_lvds_init(ScrnInfoPtr pScrn)
      */
     I830I2CInit(pScrn, &intel_output->pDDCBus, GPIOC, "LVDSDDC_C");
 
-    if (!pI830->skip_panel_detect) {
+    if (pI830->skip_panel_detect) {
 	xf86DrvMsg(pScrn->scrnIndex, X_INFO,
 		   "Skipping any attempt to determine panel fixed mode.\n");
 	goto found_mode;
commit 22918f62c89a4314fb5d01c58f22fee5b9a15a27
Author: Jesse Barnes <jbarnes at virtuousgeek.org>
Date:   Thu Aug 14 16:02:37 2008 -0700

    Fix pipe A force quirk
    
    Last commit introduced a logic buglet, we went from (foo & BLAH) -> (!foo &
    BLAH) rather than !(foo & BLAH), so fix it up to make my laptop work again.

diff --git a/src/i830_display.c b/src/i830_display.c
index 622209b..2f1e7ab 100644
--- a/src/i830_display.c
+++ b/src/i830_display.c
@@ -858,7 +858,7 @@ i830_crtc_dpms(xf86CrtcPtr crtc, int mode)
 	OUTREG(VGACNTRL, VGA_DISP_DISABLE);
 
 	/* May need to leave pipe A on */
-	if ((pipe != 0) || (!pI830->quirk_flag & QUIRK_PIPEA_FORCE))
+	if ((pipe != 0) || !(pI830->quirk_flag & QUIRK_PIPEA_FORCE))
 	{
 		/* Disable display plane */
 		temp = INREG(dspcntr_reg);
commit 9ec36e0c8bd8a4bd7c40569412fc1a21219b5af9
Author: Olivier Fourdan <ofourdan at redhat.com>
Date:   Mon Aug 11 12:07:32 2008 -0400

    Fix DPMS off in the presence of the pipe A quirk.
    
    Still turn off the VGA plane, and also handle the DRI path at the end.

diff --git a/src/i830_display.c b/src/i830_display.c
index e1dad03..622209b 100644
--- a/src/i830_display.c
+++ b/src/i830_display.c
@@ -854,44 +854,43 @@ i830_crtc_dpms(xf86CrtcPtr crtc, int mode)
 	/* Give the overlay scaler a chance to disable if it's on this pipe */
 	i830_crtc_dpms_video(crtc, FALSE);
 
-	/* May need to leave pipe A on */
-	if ((pipe == 0) && (pI830->quirk_flag & QUIRK_PIPEA_FORCE))
-	    return;
-
 	/* Disable the VGA plane that we never use */
 	OUTREG(VGACNTRL, VGA_DISP_DISABLE);
 
-	/* Disable display plane */
-	temp = INREG(dspcntr_reg);
-	if ((temp & DISPLAY_PLANE_ENABLE) != 0)
+	/* May need to leave pipe A on */
+	if ((pipe != 0) || (!pI830->quirk_flag & QUIRK_PIPEA_FORCE))
 	{
-	    OUTREG(dspcntr_reg, temp & ~DISPLAY_PLANE_ENABLE);
-	    /* Flush the plane changes */
-	    OUTREG(dspbase_reg, INREG(dspbase_reg));
-	    POSTING_READ(dspbase_reg);
-	}
+		/* Disable display plane */
+		temp = INREG(dspcntr_reg);
+		if ((temp & DISPLAY_PLANE_ENABLE) != 0)
+		{
+		    OUTREG(dspcntr_reg, temp & ~DISPLAY_PLANE_ENABLE);
+		    /* Flush the plane changes */
+		    OUTREG(dspbase_reg, INREG(dspbase_reg));
+		    POSTING_READ(dspbase_reg);
+		}
 
-	if (!IS_I9XX(pI830)) {
-	    /* Wait for vblank for the disable to take effect */
-	    i830WaitForVblank(pScrn);
-	}
+		if (!IS_I9XX(pI830)) {
+		    /* Wait for vblank for the disable to take effect */
+		    i830WaitForVblank(pScrn);
+		}
 
-	/* Next, disable display pipes */
-	temp = INREG(pipeconf_reg);
-	if ((temp & PIPEACONF_ENABLE) != 0) {
-	    OUTREG(pipeconf_reg, temp & ~PIPEACONF_ENABLE);
-	    POSTING_READ(pipeconf_reg);
-	}
+		/* Next, disable display pipes */
+		temp = INREG(pipeconf_reg);
+		if ((temp & PIPEACONF_ENABLE) != 0) {
+		    OUTREG(pipeconf_reg, temp & ~PIPEACONF_ENABLE);
+		    POSTING_READ(pipeconf_reg);
+		}
 
-	/* Wait for vblank for the disable to take effect. */
-	i830WaitForVblank(pScrn);
+		/* Wait for vblank for the disable to take effect. */
+		i830WaitForVblank(pScrn);
 
-	temp = INREG(dpll_reg);
-	if ((temp & DPLL_VCO_ENABLE) != 0) {
-	    OUTREG(dpll_reg, temp & ~DPLL_VCO_ENABLE);
-	    POSTING_READ(dpll_reg);
+		temp = INREG(dpll_reg);
+		if ((temp & DPLL_VCO_ENABLE) != 0) {
+		    OUTREG(dpll_reg, temp & ~DPLL_VCO_ENABLE);
+		    POSTING_READ(dpll_reg);
+		}
 	}
-
 	/* Wait for the clocks to turn off. */
 	usleep(150);
 	break;
commit 445c2e9ef8fc1d49bbb03e07bf36e0339be16a80
Author: Olivier Fourdan <ofourdan at redhat.com>
Date:   Mon Aug 11 11:30:51 2008 -0400

    Apply pipe A quirk to 845 as well.

diff --git a/src/i830_quirks.c b/src/i830_quirks.c
index 6fc8e53..a3ed044 100644
--- a/src/i830_quirks.c
+++ b/src/i830_quirks.c
@@ -315,6 +315,7 @@ static i830_quirk i830_quirk_list[] = {
 
     /* 855 & before need to leave pipe A & dpll A up */
     { PCI_CHIP_I855_GM, SUBSYS_ANY, SUBSYS_ANY, quirk_pipea_force },
+    { PCI_CHIP_845_G, SUBSYS_ANY, SUBSYS_ANY, quirk_pipea_force },
 
     { 0, 0, 0, NULL },
 };
commit d592eabc806b752053ade3c18e9dd8e0f39b45a3
Author: Zhenyu Wang <zhenyu.z.wang at intel.com>
Date:   Mon Aug 11 15:16:44 2008 +0800

    Fix possible spurious interrupts in hotplug detect on 4 series chip

diff --git a/src/i810_reg.h b/src/i810_reg.h
index 4b9ce9b..7739a1c 100644
--- a/src/i810_reg.h
+++ b/src/i810_reg.h
@@ -2822,4 +2822,6 @@ typedef enum {
 #define DPFC_STATUS2		0x3214
 #define DPFC_FENCE_YOFF		0x3218
 
+#define PEG_BAND_GAP_DATA	0x14d68
+
 #endif /* _I810_REG_H */
diff --git a/src/i830_hdmi.c b/src/i830_hdmi.c
index 58d1c49..d56eec9 100644
--- a/src/i830_hdmi.c
+++ b/src/i830_hdmi.c
@@ -140,6 +140,15 @@ i830_hdmi_detect(xf86OutputPtr output)
     I830Ptr pI830 = I830PTR(pScrn);
     uint32_t temp, bit;
 
+    /* For G4X, PEG_BAND_GAP_DATA 3:0 must first be written 0xd.
+     * Failure to do so will result in spurious interrupts being
+     * generated on the port when a cable is not attached.
+     */
+    if (IS_G4X(pI830)) {
+	temp = INREG(PEG_BAND_GAP_DATA);
+	OUTREG(PEG_BAND_GAP_DATA, (temp & ~0xf) | 0xd);
+    }
+
     temp = INREG(PORT_HOTPLUG_EN);
 
     OUTREG(PORT_HOTPLUG_EN,
commit d0018a96064ee0adfe87c2d50c341bf7d2e45eb0
Author: Zhenyu Wang <zhenyu.z.wang at intel.com>
Date:   Mon Aug 11 15:16:09 2008 +0800

    Disable display clock gating for 4 series chips

diff --git a/src/i830_driver.c b/src/i830_driver.c
index 8ea05af..35f7242 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -971,7 +971,7 @@ i830_init_clock_gating(ScrnInfoPtr pScrn)
 
     /* Disable clock gating reported to work incorrectly according to the specs.
      */
-    if (IS_GM45(pI830)) {
+    if (IS_GM45(pI830) || IS_G4X(pI830)) {
 	OUTREG(RENCLK_GATE_D1, 0);
 	OUTREG(RENCLK_GATE_D2, 0);
 	OUTREG(RAMCLK_GATE_D, 0);
commit fe90c0522f65f60c4c431787c889b7fb639ab61b
Author: Eric Anholt <eric at anholt.net>
Date:   Fri Aug 8 16:35:25 2008 -0700

    Set lvds_ddc_mode before use to avoid a segfault on mac mini.

diff --git a/src/i830_lvds.c b/src/i830_lvds.c
index 9f20579..a885627 100644
--- a/src/i830_lvds.c
+++ b/src/i830_lvds.c
@@ -1213,7 +1213,7 @@ i830_lvds_init(ScrnInfoPtr pScrn)
     xf86OutputPtr	    output;
     I830OutputPrivatePtr    intel_output;
     DisplayModePtr	    modes, scan;
-    DisplayModePtr	    lvds_ddc_mode;
+    DisplayModePtr	    lvds_ddc_mode = NULL;
     struct i830_lvds_priv   *dev_priv;
 
     if (pI830->quirk_flag & QUIRK_IGNORE_LVDS)
commit 91e7b93c12f612e41b04a2d6106ff29b53b22a43
Author: Eric Anholt <eric at anholt.net>
Date:   Thu Aug 7 11:02:19 2008 -0700

    intel_idle: Instead if #if 0, add an ignore flag for unreliable INSTDONE bits.
    
    This lets us produce a decent total value, and still show the unreliable bits
    in case they aren't on your platform.

diff --git a/src/reg_dumper/idle.c b/src/reg_dumper/idle.c
index dbfa58e..8d60c0c 100644
--- a/src/reg_dumper/idle.c
+++ b/src/reg_dumper/idle.c
@@ -39,17 +39,16 @@
 struct idle_flags {
     uint32_t instdone_flag;
     char *name;
+    int ignore;
     unsigned int count;
 };
 
 struct idle_flags i915_idle_flags[] = {
-#if 0
-    {IDCT_DONE, "IDCT"},
-    {IQ_DONE, "IQ"},
-    {PR_DONE, "PR"},
-    {VLD_DONE, "VLD"},
-    {IP_DONE, "IP"},
-#endif
+    {IDCT_DONE, "IDCT", 1},
+    {IQ_DONE, "IQ", 1},
+    {PR_DONE, "PR", 1},
+    {VLD_DONE, "VLD", 1},
+    {IP_DONE, "IP", 1},
     {FBC_DONE, "FBC"},
     {BINNER_DONE, "BINNER"},
     {SF_DONE, "SF"},
@@ -68,10 +67,8 @@ struct idle_flags i915_idle_flags[] = {
     {PS_DONE, "PS"},
     {CC_DONE, "CC"},
     {MAP_FILTER_DONE, "map filter"},
-#if 0
-    {MAP_L2_IDLE, "map L2"},
-#endif
-
+    {MAP_L2_IDLE, "map L2", 1},
+    {0x80000038, "reserved bits", 1},
     {0, "total"},
     {0, "other"},
 };
@@ -107,7 +104,8 @@ setup_other_flags(I830Ptr pI830,
 
     for (i = 0; i < idle_flag_count - 2; i++) {
 	other_idle_flags &= ~idle_flags[i].instdone_flag;
-	total_idle_flags |= idle_flags[i].instdone_flag;
+	if (!idle_flags[i].ignore)
+	    total_idle_flags |= idle_flags[i].instdone_flag;
     }
     idle_flags[idle_flag_count - 2].instdone_flag = total_idle_flags;
     idle_flags[idle_flag_count - 1].instdone_flag = other_idle_flags;
@@ -197,7 +195,11 @@ int main(int argc, char **argv)
 	}
 
 	for (j = 0; j < idle_flag_count; j++) {
-	    printf("%25s: %3d\n", idle_flags[j].name, idle_flags[j].count);
+	    if (!idle_flags[j].ignore)
+		printf("%25s: %3d\n", idle_flags[j].name, idle_flags[j].count);
+	    else
+		printf("%25s: %3d (unreliable)\n",
+		       idle_flags[j].name, idle_flags[j].count);
 	    idle_flags[j].count = 0;
 	}
 	printf("\n");


More information about the xorg-commit mailing list