xf86-video-intel: Branch 'xvmc-vld' - 108 commits - AUTHORS configure.ac Makefile.am man/intel.man NEWS README RELEASING src/bios_reader/bios_reader.c src/bios_reader/Makefile.am src/ch7017/Makefile.am src/ch7xxx/Makefile.am src/common.h src/drmmode_display.c src/i2c_vid.h src/i810_accel.c src/i810_common.h src/i810_cursor.c src/i810_dga.c src/i810_dri.c src/i810_dri.h src/i810_driver.c src/i810.h src/i810_hwmc.c src/i810_io.c src/i810_memory.c src/i810_reg.h src/i810_video.c src/i810_wmark.c src/i830_accel.c src/i830_batchbuffer.c src/i830_batchbuffer.h src/i830_bios.c src/i830_common.h src/i830_cursor.c src/i830_debug.c src/i830_display.c src/i830_display.h src/i830_dri.c src/i830_dri.h src/i830_driver.c src/i830_dvo.c src/i830_exa.c src/i830.h src/i830_hdmi.c src/i830_hwmc.c src/i830_hwmc.h src/i830_lvds.c src/i830_memory.c src/i830_quirks.c src/i830_render.c src/i830_sdvo.c src/i830_sdvo.h src/i830_video.c src/i830_xaa.c src/i915_hwmc.c src/i915_hwmc.h src/i915_render.c src/i915_video.c src/i965_hwmc.c src/i965_render.c src/i965_video.c src/ivch/Makefile.am src/local_xf86Rename.h src/Makefile.am src/reg_dumper/.gitignore src/reg_dumper/gtt.c src/reg_dumper/hotplug.c src/reg_dumper/idle.c src/reg_dumper/main.c src/reg_dumper/reg_dumper.h src/reg_dumper/util.c src/sil164/Makefile.am src/tfp410/Makefile.am src/xvmc/dri2.c src/xvmc/dri2.h src/xvmc/I810XvMC.c src/xvmc/I810XvMC.h src/xvmc/i915_xvmc.c src/xvmc/i915_xvmc.h src/xvmc/intel_xvmc.c src/xvmc/intel_xvmc.h src/xvmc/Makefile.am src/xvmc/xf86dri.c src/xvmc/xf86dri.h src/xvmc/xf86dristr.h uxa/uxa-accel.c uxa/uxa.c uxa/uxa-glyphs.c uxa/uxa-priv.h uxa/uxa-render.c uxa/uxa-unaccel.c

Nan hai Zou znh at kemper.freedesktop.org
Mon May 18 02:12:48 PDT 2009


 AUTHORS                       |   63 +
 Makefile.am                   |    4 
 NEWS                          |  156 ++++
 README                        |  125 ---
 RELEASING                     |   51 +
 configure.ac                  |  114 --
 man/intel.man                 |   27 
 src/Makefile.am               |   34 
 src/bios_reader/Makefile.am   |    5 
 src/bios_reader/bios_reader.c |    4 
 src/ch7017/Makefile.am        |    2 
 src/ch7xxx/Makefile.am        |    2 
 src/common.h                  |   26 
 src/drmmode_display.c         |   61 -
 src/i2c_vid.h                 |    4 
 src/i810.h                    |    8 
 src/i810_accel.c              |   14 
 src/i810_common.h             |    1 
 src/i810_cursor.c             |   14 
 src/i810_dga.c                |   14 
 src/i810_dri.c                |   29 
 src/i810_dri.h                |    1 
 src/i810_driver.c             |  259 ------
 src/i810_hwmc.c               |    1 
 src/i810_io.c                 |   14 
 src/i810_memory.c             |   14 
 src/i810_reg.h                |   63 +
 src/i810_video.c              |    1 
 src/i810_wmark.c              |   15 
 src/i830.h                    |  189 ----
 src/i830_accel.c              |  154 ---
 src/i830_batchbuffer.c        |   33 
 src/i830_batchbuffer.h        |   16 
 src/i830_bios.c               |   23 
 src/i830_common.h             |    1 
 src/i830_cursor.c             |   35 
 src/i830_debug.c              |   10 
 src/i830_display.c            |   98 --
 src/i830_display.h            |    2 
 src/i830_dri.c                | 1633 ++++--------------------------------------
 src/i830_dri.h                |    1 
 src/i830_driver.c             |  905 ++---------------------
 src/i830_dvo.c                |    4 
 src/i830_exa.c                |  499 +-----------
 src/i830_hdmi.c               |   90 ++
 src/i830_hwmc.c               |   34 
 src/i830_hwmc.h               |    2 
 src/i830_lvds.c               |   23 
 src/i830_memory.c             |  458 -----------
 src/i830_quirks.c             |   17 
 src/i830_render.c             |   12 
 src/i830_sdvo.c               |  126 +++
 src/i830_sdvo.h               |    6 
 src/i830_video.c              |  110 +-
 src/i830_xaa.c                |  829 ---------------------
 src/i915_hwmc.c               |    6 
 src/i915_hwmc.h               |    1 
 src/i915_render.c             |    2 
 src/i915_video.c              |   43 -
 src/i965_hwmc.c               |    2 
 src/i965_render.c             |   72 -
 src/i965_video.c              |   25 
 src/ivch/Makefile.am          |    2 
 src/local_xf86Rename.h        |   23 
 src/reg_dumper/.gitignore     |    1 
 src/reg_dumper/gtt.c          |    8 
 src/reg_dumper/hotplug.c      |    5 
 src/reg_dumper/idle.c         |    5 
 src/reg_dumper/main.c         |    6 
 src/reg_dumper/reg_dumper.h   |    9 
 src/reg_dumper/util.c         |    5 
 src/sil164/Makefile.am        |    2 
 src/tfp410/Makefile.am        |    2 
 src/xvmc/I810XvMC.c           |    1 
 src/xvmc/I810XvMC.h           |    1 
 src/xvmc/Makefile.am          |    5 
 src/xvmc/dri2.c               |  301 +++++++
 src/xvmc/dri2.h               |   70 +
 src/xvmc/i915_xvmc.c          |   17 
 src/xvmc/i915_xvmc.h          |    2 
 src/xvmc/intel_xvmc.c         |  146 +--
 src/xvmc/intel_xvmc.h         |    7 
 src/xvmc/xf86dri.c            |  566 --------------
 src/xvmc/xf86dri.h            |  118 ---
 src/xvmc/xf86dristr.h         |  390 ----------
 uxa/uxa-accel.c               |   63 -
 uxa/uxa-glyphs.c              |    4 
 uxa/uxa-priv.h                |   18 
 uxa/uxa-render.c              |    5 
 uxa/uxa-unaccel.c             |   18 
 uxa/uxa.c                     |   29 
 91 files changed, 1716 insertions(+), 6700 deletions(-)

New commits:
commit b622860429e00d6ab4407980232659c283a8fe8d
Author: Xiang Hai hao <haihao.xiang at intel.com>
Date:   Mon May 18 17:12:30 2009 +0800

     DRI2 for XvMC

diff --git a/configure.ac b/configure.ac
index 2b45787..d1629d1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -78,10 +78,10 @@ else
 	DEBUGFLAGS=""
 fi
 
-dnl AC_ARG_ENABLE(xvmc, AC_HELP_STRING([--disable-xvmc],
-dnl                                   [Disable XvMC support [[default=auto]]]),
-dnl               [XVMC="$enableval"],
-dnl               [XVMC=auto])
+AC_ARG_ENABLE(xvmc, AC_HELP_STRING([--disable-xvmc],
+                                  [Disable XvMC support [[default=yes]]]),
+              [XVMC="$enableval"],
+              [XVMC=yes])
 
 # Checks for extensions
 XORG_DRIVER_CHECK_EXT(XINERAMA, xineramaproto)
@@ -151,12 +151,6 @@ if test "$VIDEO_DEBUG" = yes; then
 	AC_DEFINE(VIDEO_DEBUG,1,[Enable debug support])
 fi
 
-if test "$XVMC" = auto; then
-	XVMC="$DRI"
-fi
-if test "$XVMC" = yes && test "$DRI" = no; then
-	AC_MSG_ERROR([XvMC can't be enabled without DRI])
-fi
 if test "$XVMC" = yes; then
 	PKG_CHECK_MODULES(XVMCLIB, [xvmc], [XVMC=yes], [XVMC=no])
 	PKG_CHECK_MODULES(XEXT, [xext])
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 854ad0f..1061d44 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -2767,8 +2767,9 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
 
 #ifdef INTEL_XVMC
     pI830->XvMCEnabled = FALSE;
-    from =  xf86GetOptValBool(pI830->Options, OPTION_XVMC,
-			      &pI830->XvMCEnabled) ? X_CONFIG : X_DEFAULT;
+    from = ((pI830->directRenderingType == DRI_DRI2) &&
+            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
diff --git a/src/i830_hwmc.c b/src/i830_hwmc.c
index fc3faaa..75bf2e6 100644
--- a/src/i830_hwmc.c
+++ b/src/i830_hwmc.c
@@ -52,12 +52,6 @@ Bool intel_xvmc_probe(ScrnInfoPtr pScrn)
     I830Ptr pI830 = I830PTR(pScrn);
     Bool ret = FALSE;
 
-    /* Disable XvMC on DRI2 for now */
-    if (pI830->directRenderingType == DRI_DRI2) {
-	pI830->XvMCEnabled = FALSE;
-	return FALSE;
-    }
-
     if (!pI830->XvMCEnabled)
 	return FALSE;
 
@@ -85,6 +79,9 @@ void intel_xvmc_finish(ScrnInfoPtr pScrn)
 Bool intel_xvmc_driver_init(ScreenPtr pScreen, XF86VideoAdaptorPtr xv_adaptor)
 {
     ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+    I830Ptr pI830 = I830PTR(pScrn);
+    struct drm_i915_setparam sp;
+    int ret;
 
     if (!xvmc_driver) {
 	ErrorF("Failed to probe XvMC driver.\n");
@@ -95,14 +92,23 @@ Bool intel_xvmc_driver_init(ScreenPtr pScreen, XF86VideoAdaptorPtr xv_adaptor)
 	ErrorF("XvMC driver initialize failed.\n");
 	return FALSE;
     }
-    return TRUE;
+
+    /* Currently XvMC uses batchbuffer */
+    sp.param = I915_SETPARAM_ALLOW_BATCHBUFFER;
+    sp.value = 1; 
+    ret = drmCommandWrite(pI830->drmSubFD, DRM_I915_SETPARAM,
+                          &sp, sizeof(sp));
+    if (ret == 0)
+        return TRUE;
+    
+    return FALSE;
 }
 
 Bool intel_xvmc_screen_init(ScreenPtr pScreen)
 {
     ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
     I830Ptr pI830 = I830PTR(pScrn);
-    DRIInfoPtr pDRIInfo = pI830->pDRIInfo;
+    char buf[64];
 
     if (!xvmc_driver)
 	return FALSE;
@@ -119,9 +125,15 @@ Bool intel_xvmc_screen_init(ScreenPtr pScreen)
 	return FALSE;
     }
 
+    sprintf(buf, "pci:%04x:%02x:%02x.%d",
+            pI830->PciInfo->domain,
+            pI830->PciInfo->bus,
+            pI830->PciInfo->dev,
+            pI830->PciInfo->func);
+
     xf86XvMCRegisterDRInfo(pScreen, INTEL_XVMC_LIBNAME,
-		    pDRIInfo->busIdString,
-		    INTEL_XVMC_MAJOR, INTEL_XVMC_MINOR, INTEL_XVMC_PATCHLEVEL);
+                           buf,
+                           INTEL_XVMC_MAJOR, INTEL_XVMC_MINOR, INTEL_XVMC_PATCHLEVEL);
     return TRUE;
 }
 
diff --git a/src/i830_hwmc.h b/src/i830_hwmc.h
index 062234c..ad95e1e 100644
--- a/src/i830_hwmc.h
+++ b/src/i830_hwmc.h
@@ -65,7 +65,6 @@ struct hwmc_buffer
 
 struct _intel_xvmc_common {
     unsigned int type;
-    unsigned int sarea_size;
     struct hwmc_buffer batchbuffer;
 };
 
diff --git a/src/i915_hwmc.c b/src/i915_hwmc.c
index 659638e..0723c80 100644
--- a/src/i915_hwmc.c
+++ b/src/i915_hwmc.c
@@ -416,8 +416,6 @@ static int i915_xvmc_create_context (ScrnInfoPtr pScrn, XvMCContextPtr pContext,
                                   int *num_priv, long **priv )
 {
     I830Ptr pI830 = I830PTR(pScrn);
-    DRIInfoPtr pDRIInfo = pI830->pDRIInfo;
-    I830DRIPtr pI830DRI = pDRIInfo->devPrivate;
     I915XvMCCreateContextRec *contextRec = NULL;
     I915XvMCPtr pXvMC = (I915XvMCPtr)xvmc_driver->devPrivate;
     I915XvMCContextPriv *ctxpriv = NULL;
@@ -490,7 +488,6 @@ static int i915_xvmc_create_context (ScrnInfoPtr pScrn, XvMCContextPtr pContext,
 
     /* common context items */
     contextRec->comm.type = xvmc_driver->flag;
-    contextRec->comm.sarea_size = pDRIInfo->SAREASize;
     contextRec->comm.batchbuffer.offset = xvmc_driver->batch->offset;
     contextRec->comm.batchbuffer.size = xvmc_driver->batch->size;
     contextRec->comm.batchbuffer.handle = xvmc_driver->batch_handle;
@@ -515,8 +512,7 @@ static int i915_xvmc_create_context (ScrnInfoPtr pScrn, XvMCContextPtr pContext,
     contextRec->corrdata.handle = ctxpriv->corrdata_handle;
     contextRec->corrdata.offset = ctxpriv->mcCorrdata->offset;
     contextRec->corrdata.size = ctxpriv->mcCorrdata->size;
-    contextRec->sarea_priv_offset = sizeof(XF86DRISAREARec);
-    contextRec->deviceID = pI830DRI->deviceID;
+    contextRec->deviceID = DEVICE_ID(pI830->PciInfo);
 
     if (IS_I915G(pI830) || IS_I915GM(pI830)) {
 	contextRec->sis.bus_addr = ctxpriv->mcStaticIndirectState->bus_addr;
diff --git a/src/i915_hwmc.h b/src/i915_hwmc.h
index 8f6557d..abd3171 100644
--- a/src/i915_hwmc.h
+++ b/src/i915_hwmc.h
@@ -49,7 +49,6 @@ typedef struct
     struct hwmc_buffer psp;
     struct hwmc_buffer psc;
     struct hwmc_buffer corrdata;/* Correction Data Buffer */
-    unsigned int sarea_priv_offset;
     int deviceID;
 } I915XvMCCreateContextRec;
 
diff --git a/src/i915_video.c b/src/i915_video.c
index 150cf04..1ef58ac 100644
--- a/src/i915_video.c
+++ b/src/i915_video.c
@@ -172,7 +172,10 @@ I915DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id,
 
       OUT_BATCH(_3DSTATE_MAP_STATE | 3);
       OUT_BATCH(0x00000001);	/* texture map #1 */
-      OUT_RELOC(pPriv->buf, I915_GEM_DOMAIN_SAMPLER, 0, pPriv->YBuf0offset);
+      if (pPriv->buf)
+          OUT_RELOC(pPriv->buf, I915_GEM_DOMAIN_SAMPLER, 0, pPriv->YBuf0offset);
+      else
+          OUT_BATCH(pPriv->YBuf0offset);
 
       ms3 = MAPSURF_422 | MS3_USE_FENCE_REGS;
       switch (id) {
@@ -281,7 +284,11 @@ I915DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id,
       OUT_BATCH(_3DSTATE_MAP_STATE | 9);
       OUT_BATCH(0x00000007);
 
-      OUT_RELOC(pPriv->buf, I915_GEM_DOMAIN_SAMPLER, 0, pPriv->YBuf0offset);
+      if (pPriv->buf)
+          OUT_RELOC(pPriv->buf, I915_GEM_DOMAIN_SAMPLER, 0, pPriv->YBuf0offset);
+      else
+          OUT_BATCH(pPriv->YBuf0offset);
+
       ms3 = MAPSURF_8BIT | MT_8BIT_I8 | MS3_USE_FENCE_REGS;
       ms3 |= (height - 1) << MS3_HEIGHT_SHIFT;
       ms3 |= (width - 1) << MS3_WIDTH_SHIFT;
@@ -294,14 +301,22 @@ I915DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id,
       else
 	  OUT_BATCH(((video_pitch * 2 / 4) - 1) << MS4_PITCH_SHIFT);
 
-      OUT_RELOC(pPriv->buf, I915_GEM_DOMAIN_SAMPLER, 0, pPriv->UBuf0offset);
+      if (pPriv->buf)
+          OUT_RELOC(pPriv->buf, I915_GEM_DOMAIN_SAMPLER, 0, pPriv->UBuf0offset);
+      else
+          OUT_BATCH(pPriv->UBuf0offset);
+
       ms3 = MAPSURF_8BIT | MT_8BIT_I8 | MS3_USE_FENCE_REGS;
       ms3 |= (height / 2 - 1) << MS3_HEIGHT_SHIFT;
       ms3 |= (width / 2 - 1) << MS3_WIDTH_SHIFT;
       OUT_BATCH(ms3);
       OUT_BATCH(((video_pitch / 4) - 1) << MS4_PITCH_SHIFT);
 
-      OUT_RELOC(pPriv->buf, I915_GEM_DOMAIN_SAMPLER, 0, pPriv->VBuf0offset);
+      if (pPriv->buf)
+          OUT_RELOC(pPriv->buf, I915_GEM_DOMAIN_SAMPLER, 0, pPriv->VBuf0offset);
+      else
+          OUT_BATCH(pPriv->VBuf0offset);
+
       ms3 = MAPSURF_8BIT | MT_8BIT_I8 | MS3_USE_FENCE_REGS;
       ms3 |= (height / 2 - 1) << MS3_HEIGHT_SHIFT;
       ms3 |= (width / 2 - 1) << MS3_WIDTH_SHIFT;
diff --git a/src/i965_hwmc.c b/src/i965_hwmc.c
index 68d908d..efcdf12 100644
--- a/src/i965_hwmc.c
+++ b/src/i965_hwmc.c
@@ -89,7 +89,6 @@ static int create_context(ScrnInfoPtr pScrn,
 {
     struct i965_xvmc_context *private_context, *context_dup;
     I830Ptr I830 = I830PTR(pScrn);
-    DRIInfoPtr driinfo = I830->pDRIInfo;
 
     unsigned int blocknum = 
 	(((context->width + 15)/16)*((context->height+15)/16));
@@ -108,7 +107,6 @@ static int create_context(ScrnInfoPtr pScrn,
     private_context->is_g4x = IS_G4X(I830);
     private_context->is_965_q = IS_965_Q(I830);
     private_context->comm.type = xvmc_driver->flag;
-    private_context->comm.sarea_size = driinfo->SAREASize;
     private_context->comm.batchbuffer.offset = xvmc_driver->batch->offset;
     private_context->comm.batchbuffer.size = xvmc_driver->batch->size;
     private_context->comm.batchbuffer.handle = xvmc_driver->batch_handle;
diff --git a/src/xvmc/Makefile.am b/src/xvmc/Makefile.am
index f4587d1..4567060 100644
--- a/src/xvmc/Makefile.am
+++ b/src/xvmc/Makefile.am
@@ -25,9 +25,8 @@ libIntelXvMC_la_SOURCES = intel_xvmc.c \
         xvmc_vld.h                     \
         intel_batchbuffer.c            \
         intel_batchbuffer.h            \
-        xf86dri.c                      \
-        xf86dri.h                      \
-        xf86dristr.h
+        dri2.c                         \
+        dri2.h	
 
 libIntelXvMC_la_CFLAGS = @XORG_CFLAGS@ @DRM_CFLAGS@ @DRI_CFLAGS@ \
 	@XVMCLIB_CFLAGS@ -I$(top_srcdir)/src -DTRUE=1 -DFALSE=0
diff --git a/src/xvmc/dri2.c b/src/xvmc/dri2.c
new file mode 100644
index 0000000..f967432
--- /dev/null
+++ b/src/xvmc/dri2.c
@@ -0,0 +1,301 @@
+/*
+ * Copyright © 2008 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Soft-
+ * ware"), to deal in the Software without restriction, including without
+ * limitation the rights to use, copy, modify, merge, publish, distribute,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, provided that the above copyright
+ * notice(s) and this permission notice appear in all copies of the Soft-
+ * ware and that both the above copyright notice(s) and this permission
+ * notice appear in supporting documentation.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
+ * ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY
+ * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
+ * THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE-
+ * QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR-
+ * MANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder shall
+ * not be used in advertising or otherwise to promote the sale, use or
+ * other dealings in this Software without prior written authorization of
+ * the copyright holder.
+ *
+ * Authors:
+ *   Kristian Høgsberg (krh at redhat.com)
+ */
+
+
+#define NEED_REPLIES
+#include <X11/Xlibint.h>
+#include <X11/extensions/Xext.h>
+#include <X11/extensions/extutil.h>
+#include <X11/extensions/dri2proto.h>
+#include "xf86drm.h"
+#include "dri2.h"
+
+static char dri2ExtensionName[] = DRI2_NAME;
+static XExtensionInfo *dri2Info;
+static XEXT_GENERATE_CLOSE_DISPLAY (DRI2CloseDisplay, dri2Info)
+static /* const */ XExtensionHooks dri2ExtensionHooks = {
+    NULL,				/* create_gc */
+    NULL,				/* copy_gc */
+    NULL,				/* flush_gc */
+    NULL,				/* free_gc */
+    NULL,				/* create_font */
+    NULL,				/* free_font */
+    DRI2CloseDisplay,			/* close_display */
+    NULL,				/* wire_to_event */
+    NULL,				/* event_to_wire */
+    NULL,				/* error */
+    NULL,				/* error_string */
+};
+
+static XEXT_GENERATE_FIND_DISPLAY (DRI2FindDisplay, dri2Info, 
+				   dri2ExtensionName, 
+				   &dri2ExtensionHooks, 
+				   0, NULL)
+
+Bool DRI2QueryExtension(Display *dpy, int *eventBase, int *errorBase)
+{
+    XExtDisplayInfo *info = DRI2FindDisplay(dpy);
+
+    if (XextHasExtension(info)) {
+	*eventBase = info->codes->first_event;
+	*errorBase = info->codes->first_error;
+	return True;
+    }
+
+    return False;
+}
+
+Bool DRI2QueryVersion(Display *dpy, int *major, int *minor)
+{
+    XExtDisplayInfo *info = DRI2FindDisplay (dpy);
+    xDRI2QueryVersionReply rep;
+    xDRI2QueryVersionReq *req;
+
+    XextCheckExtension (dpy, info, dri2ExtensionName, False);
+
+    LockDisplay(dpy);
+    GetReq(DRI2QueryVersion, req);
+    req->reqType = info->codes->major_opcode;
+    req->dri2ReqType = X_DRI2QueryVersion;
+    req->majorVersion = DRI2_MAJOR;
+    req->minorVersion = DRI2_MINOR;
+    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+	UnlockDisplay(dpy);
+	SyncHandle();
+	return False;
+    }
+    *major = rep.majorVersion;
+    *minor = rep.minorVersion;
+    UnlockDisplay(dpy);
+    SyncHandle();
+
+    return True;
+}
+
+Bool DRI2Connect(Display *dpy, XID window,
+		 char **driverName, char **deviceName)
+{
+    XExtDisplayInfo *info = DRI2FindDisplay(dpy);
+    xDRI2ConnectReply rep;
+    xDRI2ConnectReq *req;
+
+    XextCheckExtension (dpy, info, dri2ExtensionName, False);
+
+    LockDisplay(dpy);
+    GetReq(DRI2Connect, req);
+    req->reqType = info->codes->major_opcode;
+    req->dri2ReqType = X_DRI2Connect;
+    req->window = window;
+    req->driverType = DRI2DriverDRI;
+    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+	UnlockDisplay(dpy);
+	SyncHandle();
+	return False;
+    }
+
+    if (rep.driverNameLength == 0 && rep.deviceNameLength == 0) {
+	UnlockDisplay(dpy);
+	SyncHandle();
+	return False;
+    }
+
+    *driverName = Xmalloc(rep.driverNameLength + 1);
+    if (*driverName == NULL) {
+	_XEatData(dpy, 
+		  ((rep.driverNameLength + 3) & ~3) +
+		  ((rep.deviceNameLength + 3) & ~3));
+	UnlockDisplay(dpy);
+	SyncHandle();
+	return False;
+    }
+    _XReadPad(dpy, *driverName, rep.driverNameLength);
+    (*driverName)[rep.driverNameLength] = '\0';
+
+    *deviceName = Xmalloc(rep.deviceNameLength + 1);
+    if (*deviceName == NULL) {
+	Xfree(*driverName);
+	_XEatData(dpy, ((rep.deviceNameLength + 3) & ~3));
+	UnlockDisplay(dpy);
+	SyncHandle();
+	return False;
+    }
+    _XReadPad(dpy, *deviceName, rep.deviceNameLength);
+    (*deviceName)[rep.deviceNameLength] = '\0';
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+
+    return True;
+}
+
+Bool DRI2Authenticate(Display *dpy, XID window, drm_magic_t magic)
+{
+    XExtDisplayInfo *info = DRI2FindDisplay(dpy);
+    xDRI2AuthenticateReq *req;
+    xDRI2AuthenticateReply rep;
+
+    XextCheckExtension (dpy, info, dri2ExtensionName, False);
+
+    LockDisplay(dpy);
+    GetReq(DRI2Authenticate, req);
+    req->reqType = info->codes->major_opcode;
+    req->dri2ReqType = X_DRI2Authenticate;
+    req->window = window;
+    req->magic = magic;
+
+    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+	UnlockDisplay(dpy);
+	SyncHandle();
+	return False;
+    }
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+
+    return rep.authenticated;
+}
+
+void DRI2CreateDrawable(Display *dpy, XID drawable)
+{
+    XExtDisplayInfo *info = DRI2FindDisplay(dpy);
+    xDRI2CreateDrawableReq *req;
+
+    XextSimpleCheckExtension (dpy, info, dri2ExtensionName);
+
+    LockDisplay(dpy);
+    GetReq(DRI2CreateDrawable, req);
+    req->reqType = info->codes->major_opcode;
+    req->dri2ReqType = X_DRI2CreateDrawable;
+    req->drawable = drawable;
+    UnlockDisplay(dpy);
+    SyncHandle();
+}
+
+void DRI2DestroyDrawable(Display *dpy, XID drawable)
+{
+    XExtDisplayInfo *info = DRI2FindDisplay(dpy);
+    xDRI2DestroyDrawableReq *req;
+
+    XextSimpleCheckExtension (dpy, info, dri2ExtensionName);
+
+    XSync(dpy, False);
+
+    LockDisplay(dpy);
+    GetReq(DRI2DestroyDrawable, req);
+    req->reqType = info->codes->major_opcode;
+    req->dri2ReqType = X_DRI2DestroyDrawable;
+    req->drawable = drawable;
+    UnlockDisplay(dpy);
+    SyncHandle();
+}
+
+DRI2Buffer *DRI2GetBuffers(Display *dpy, XID drawable,
+			   int *width, int *height,
+			   unsigned int *attachments, int count,
+			   int *outCount)
+{
+    XExtDisplayInfo *info = DRI2FindDisplay(dpy);
+    xDRI2GetBuffersReply rep;
+    xDRI2GetBuffersReq *req;
+    DRI2Buffer *buffers;
+    xDRI2Buffer repBuffer;
+    CARD32 *p;
+    int i;
+
+    XextCheckExtension (dpy, info, dri2ExtensionName, False);
+
+    LockDisplay(dpy);
+    GetReqExtra(DRI2GetBuffers, count * 4, req);
+    req->reqType = info->codes->major_opcode;
+    req->dri2ReqType = X_DRI2GetBuffers;
+    req->drawable = drawable;
+    req->count = count;
+    p = (CARD32 *) &req[1];
+    for (i = 0; i < count; i++)
+	p[i] = attachments[i];
+
+    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+	UnlockDisplay(dpy);
+	SyncHandle();
+	return NULL;
+    }
+
+    *width = rep.width;
+    *height = rep.height;
+    *outCount = rep.count;
+
+    buffers = Xmalloc(rep.count * sizeof buffers[0]);
+    if (buffers == NULL) {
+	_XEatData(dpy, rep.count * sizeof repBuffer);
+	UnlockDisplay(dpy);
+	SyncHandle();
+	return NULL;
+    }
+
+    for (i = 0; i < rep.count; i++) {
+	_XReadPad(dpy, (char *) &repBuffer, sizeof repBuffer);
+	buffers[i].attachment = repBuffer.attachment;
+	buffers[i].name = repBuffer.name;
+	buffers[i].pitch = repBuffer.pitch;
+	buffers[i].cpp = repBuffer.cpp;
+	buffers[i].flags = repBuffer.flags;
+    }
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+
+    return buffers;
+}
+
+void DRI2CopyRegion(Display *dpy, XID drawable, XserverRegion region,
+		    CARD32 dest, CARD32 src)
+{
+    XExtDisplayInfo *info = DRI2FindDisplay(dpy);
+    xDRI2CopyRegionReq *req;
+    xDRI2CopyRegionReply rep;
+
+    XextSimpleCheckExtension (dpy, info, dri2ExtensionName);
+
+    LockDisplay(dpy);
+    GetReq(DRI2CopyRegion, req);
+    req->reqType = info->codes->major_opcode;
+    req->dri2ReqType = X_DRI2CopyRegion;
+    req->drawable = drawable;
+    req->region = region;
+    req->dest = dest;
+    req->src = src;
+
+    _XReply(dpy, (xReply *)&rep, 0, xFalse);
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+}
diff --git a/src/xvmc/dri2.h b/src/xvmc/dri2.h
new file mode 100644
index 0000000..356c6bc
--- /dev/null
+++ b/src/xvmc/dri2.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright © 2007,2008 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Soft-
+ * ware"), to deal in the Software without restriction, including without
+ * limitation the rights to use, copy, modify, merge, publish, distribute,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, provided that the above copyright
+ * notice(s) and this permission notice appear in all copies of the Soft-
+ * ware and that both the above copyright notice(s) and this permission
+ * notice appear in supporting documentation.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
+ * ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY
+ * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
+ * THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE-
+ * QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR-
+ * MANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder shall
+ * not be used in advertising or otherwise to promote the sale, use or
+ * other dealings in this Software without prior written authorization of
+ * the copyright holder.
+ *
+ * Authors:
+ *   Kristian Høgsberg (krh at redhat.com)
+ */
+
+#ifndef _DRI2_H_
+#define _DRI2_H_
+
+#include <X11/extensions/Xfixes.h>
+#include <X11/extensions/dri2tokens.h>
+
+typedef struct {
+    unsigned int attachment;
+    unsigned int name;
+    unsigned int pitch;
+    unsigned int cpp;
+    unsigned int flags;
+} DRI2Buffer;
+
+extern Bool
+DRI2QueryExtension(Display *display, int *eventBase, int *errorBase);
+extern Bool
+DRI2QueryVersion(Display *display, int *major, int *minor);
+extern Bool
+DRI2Connect(Display *display, XID window,
+	    char **driverName, char **deviceName);
+extern Bool
+DRI2Authenticate(Display *display, XID window, drm_magic_t magic);
+extern void
+DRI2CreateDrawable(Display *display, XID drawable);
+extern void
+DRI2DestroyDrawable(Display *display, XID handle);
+extern DRI2Buffer *
+DRI2GetBuffers(Display *dpy, XID drawable,
+	       int *width, int *height,
+	       unsigned int *attachments, int count,
+	       int *outCount);
+
+extern void
+DRI2CopyRegion(Display *dpy, XID drawable, XserverRegion region,
+	       CARD32 dest, CARD32 src);
+
+#endif
diff --git a/src/xvmc/i915_xvmc.c b/src/xvmc/i915_xvmc.c
index c32073a..d6f7f01 100644
--- a/src/xvmc/i915_xvmc.c
+++ b/src/xvmc/i915_xvmc.c
@@ -1560,7 +1560,6 @@ static Status i915_xvmc_mc_create_context(Display *display, XvMCContext *context
 {
     i915XvMCContext *pI915XvMC = NULL;
     I915XvMCCreateContextRec *tmpComm = NULL;
-    drm_sarea_t *pSAREA;
 
     XVMC_DBG("%s\n", __FUNCTION__);
 
@@ -1612,15 +1611,11 @@ static Status i915_xvmc_mc_create_context(Display *display, XvMCContext *context
     pI915XvMC->corrdata.handle = tmpComm->corrdata.handle;
     pI915XvMC->corrdata.offset = tmpComm->corrdata.offset;
     pI915XvMC->corrdata.size = tmpComm->corrdata.size;
-    pI915XvMC->sarea_priv_offset = tmpComm->sarea_priv_offset;
 
     /* Must free the private data we were passed from X */
     XFree(priv_data);
     priv_data = NULL;
 
-    pSAREA = (drm_sarea_t *)xvmc_driver->sarea_address;
-    pI915XvMC->sarea = (drmI830Sarea*)((char*)pSAREA + pI915XvMC->sarea_priv_offset);
-
     if (i915_xvmc_map_buffers(pI915XvMC)) {
         i915_xvmc_unmap_buffers(pI915XvMC);
         free(pI915XvMC);
@@ -2042,11 +2037,6 @@ static int i915_xvmc_mc_get_surface_status(Display *display,
         }
     }
 
-    if (pI915Surface->last_render &&
-        (pI915Surface->last_render > pI915XvMC->sarea->last_dispatch)) {
-        *stat |= XVMC_RENDERING;
-    }
-
     PPTHREAD_MUTEX_UNLOCK();
     return 0;
 }
@@ -2457,12 +2447,7 @@ Status i915_xvmc_get_subpict_status(Display *display, XvMCSubpicture *subpicture
         return XvMCBadSubpicture;
 
     PPTHREAD_MUTEX_LOCK();
-    /* FIXME: */
-    if (pI915Subpicture->last_render &&
-        (pI915Subpicture->last_render > pI915XvMC->sarea->last_dispatch)) {
-        *stat |= XVMC_RENDERING;
-    }
-
+    
     PPTHREAD_MUTEX_UNLOCK();
     return Success;
 }
diff --git a/src/xvmc/i915_xvmc.h b/src/xvmc/i915_xvmc.h
index af0a77d..de9eb78 100644
--- a/src/xvmc/i915_xvmc.h
+++ b/src/xvmc/i915_xvmc.h
@@ -55,8 +55,6 @@ typedef struct _i915XvMCContext {
     unsigned int yStride;
     unsigned int uvStride;
     unsigned short ref;
-    volatile drmI830Sarea *sarea;
-    unsigned int sarea_priv_offset;	        /* Offset in sarea to private part */
     unsigned int depth;
     XvPortID port;		       /* Xv Port ID when displaying */
     int haveXv;                        /* Have I initialized the Xv
diff --git a/src/xvmc/intel_xvmc.c b/src/xvmc/intel_xvmc.c
index 76302d9..71ae77b 100644
--- a/src/xvmc/intel_xvmc.c
+++ b/src/xvmc/intel_xvmc.c
@@ -100,21 +100,12 @@ unsigned int mb_bytes_420[] = {
 
 int DEBUG;
 
-static int error_base;
-static int event_base;
-
 static void intel_xvmc_debug_init(void)
 {
     if (getenv("INTEL_XVMC_DEBUG"))
 	DEBUG = 1;
 }
 
-/* locking */
-static void intel_xvmc_try_heavy_lock(drm_context_t ctx)
-{
-    drmGetLock(xvmc_driver->fd, ctx, 0);
-}
-
 void LOCK_HARDWARE(drm_context_t ctx)
 {
     char __ret = 0;
@@ -122,19 +113,13 @@ void LOCK_HARDWARE(drm_context_t ctx)
     PPTHREAD_MUTEX_LOCK();
     assert(!xvmc_driver->locked);
 
-    DRM_CAS(xvmc_driver->driHwLock, ctx,
-            (DRM_LOCK_HELD | ctx), __ret);
-
-    if (__ret)
-	intel_xvmc_try_heavy_lock(ctx);
-
     xvmc_driver->locked = 1;
 }
 
 void UNLOCK_HARDWARE(drm_context_t ctx)
 {
     xvmc_driver->locked = 0;
-    DRM_UNLOCK(xvmc_driver->fd, xvmc_driver->driHwLock, ctx);
+    
     PPTHREAD_MUTEX_UNLOCK();
 }
 
@@ -269,17 +254,18 @@ _X_EXPORT Status XvMCCreateContext(Display *display, XvPortID port,
                          int flags, XvMCContext *context)
 {
     Status ret;
-    drm_sarea_t *pSAREA;
-    char *curBusID;
     CARD32 *priv_data = NULL;
     struct _intel_xvmc_common *comm;
     drm_magic_t magic;
     int major, minor;
+    int error_base;
+    int event_base;
     int priv_count;
     int isCapable;
     int screen = DefaultScreen(display);
     intel_xvmc_context_ptr intel_ctx;
     int fd;
+    char *driverName = NULL, *deviceName = NULL;
 
     /* Verify Obvious things first */
     if (!display || !context)
@@ -356,7 +342,6 @@ _X_EXPORT Status XvMCCreateContext(Display *display, XvPortID port,
 
     XVMC_INFO("decoder type is %s", intel_xvmc_decoder_string(comm->type));
 
-    xvmc_driver->sarea_size = comm->sarea_size;
     xvmc_driver->batchbuffer.handle = comm->batchbuffer.handle;
     xvmc_driver->batchbuffer.offset = comm->batchbuffer.offset;
     xvmc_driver->batchbuffer.size = comm->batchbuffer.size;
@@ -369,70 +354,60 @@ _X_EXPORT Status XvMCCreateContext(Display *display, XvPortID port,
     }
     intel_ctx->context = context;
 
-    ret = uniDRIQueryDirectRenderingCapable(display, screen,
-                                            &isCapable);
-    if (!ret || !isCapable) {
-	XVMC_ERR("Direct Rendering is not available on this system!");
-	XFree(priv_data);
-        return BadValue;
-    }
+    /* check DRI2 */
+    ret = Success;
+    xvmc_driver->fd = -1;
 
-    if (!uniDRIOpenConnection(display, screen,
-                              &xvmc_driver->hsarea, &curBusID)) {
-        XVMC_ERR("Could not open DRI connection to X server!");
-	XFree(priv_data);
-        return BadValue;
-    }
+    do {
+        if (!DRI2QueryExtension(display, &event_base, &error_base)) {
+            ret = BadValue;
+            break;
+        }
+
+        if (!DRI2QueryVersion(display, &major, &minor)) {
+            ret = BadValue;
+            break;
+        }
+
+        if (!DRI2Connect(display, RootWindow(display, screen),
+                         &driverName, &deviceName)) {
+            ret = BadValue;
+            break;
+        }
+
+        xvmc_driver->fd = open(deviceName, O_RDWR);
+
+        if (xvmc_driver->fd < 0) {
+            XVMC_ERR("Failed to open drm device: %s\n", strerror(errno));
+            ret = BadValue;
+            break;
+        }
+
+        if (drmGetMagic(xvmc_driver->fd, &magic)) {
+            XVMC_ERR("Failed to get magic\n");
+            ret = BadValue;
+            break;
+        }
+
+        if (!DRI2Authenticate(display, RootWindow(display, screen), magic)) {
+            XVMC_ERR("Failed to authenticate magic %d\n", magic);
+            ret = BadValue;
+            break;
+        }
+    } while (0);
+
+    XFree(driverName);
+    XFree(deviceName);
 
-    /* Open DRI Device */
-    if((fd = drmOpen("i915", curBusID)) < 0) {
-        XVMC_ERR("DRM Device could not be opened.");
+    if (ret != Success) {
         XFree(priv_data);
-        XFree(curBusID);
-        return BadValue;
-    }
-
-    xvmc_driver->fd = fd;
-
-    strncpy(xvmc_driver->busID, curBusID, 20);
-    xvmc_driver->busID[20] = '\0';
-    XFree(curBusID);
-
-    /* Get magic number */
-    drmGetMagic(xvmc_driver->fd, &magic);
-    // context->flags = (unsigned long)magic;
-
-    if (!uniDRIAuthConnection(display, screen, magic)) {
-	XVMC_ERR("[XvMC]: X server did not allow DRI. Check permissions.");
-	xvmc_driver = NULL;
-	XFree(priv_data);
-        return BadAlloc;
-    }
+        context->privData = NULL;
 
-    /*
-     * Map DRI Sarea. we always want it right?
-     */
-    if (drmMap(xvmc_driver->fd, xvmc_driver->hsarea,
-               xvmc_driver->sarea_size, &xvmc_driver->sarea_address) < 0) {
-        XVMC_ERR("Unable to map DRI SAREA.\n");
-	xvmc_driver = NULL;
-	XFree(priv_data);
-        return BadAlloc;
-    }
-    pSAREA = (drm_sarea_t *)xvmc_driver->sarea_address;
-    xvmc_driver->driHwLock = (drmLock *)&pSAREA->lock;
-    pthread_mutex_init(&xvmc_driver->ctxmutex, NULL);
+        if (xvmc_driver->fd >= 0)
+            close(xvmc_driver->fd);
 
-    /* context_id is alloc in _xvmc_create_context */
-    if (!uniDRICreateContext(display, screen, DefaultVisual(display, screen),
-			     context->context_id,
-                             &intel_ctx->hw_context)) {
-        XVMC_ERR("Could not create DRI context for xvmc ctx %d.",
-		 (int)context->context_id);
-	XFree(priv_data);
-        context->privData = NULL;
-        drmUnmap(xvmc_driver->sarea_address, xvmc_driver->sarea_size);
-        return BadAlloc;
+        xvmc_driver = NULL;
+        return ret;
     }
 
     /* call driver hook.
@@ -441,12 +416,13 @@ _X_EXPORT Status XvMCCreateContext(Display *display, XvPortID port,
     if (ret) {
 	XVMC_ERR("driver create context failed\n");
 	XFree(priv_data);
-	drmUnmap(xvmc_driver->sarea_address, xvmc_driver->sarea_size);
+	context->privData = NULL;
+	xvmc_driver = NULL;
 	return ret;
     }
 
+    pthread_mutex_init(&xvmc_driver->ctxmutex, NULL);
     intelInitBatchBuffer();
-
     intel_xvmc_dump_open();
 
     return Success;
@@ -475,7 +451,6 @@ _X_EXPORT Status XvMCDestroyContext(Display *display, XvMCContext *context)
 	return ret;
     }
 
-    uniDRIDestroyContext(display, screen, context->context_id);
     intel_xvmc_free_context(context->context_id);
 
     ret = _xvmc_destroy_context(display, context);
@@ -485,18 +460,13 @@ _X_EXPORT Status XvMCDestroyContext(Display *display, XvMCContext *context)
     }
 
     if (xvmc_driver->num_ctx == 0) {
-	uniDRICloseConnection(display, screen);
-
 	pthread_mutex_destroy(&xvmc_driver->ctxmutex);
 
-	drmUnmap(xvmc_driver->sarea_address, xvmc_driver->sarea_size);
-
 	if (xvmc_driver->fd >= 0)
-	    drmClose(xvmc_driver->fd);
+       close(xvmc_driver->fd);
+   
 	xvmc_driver->fd = -1;
-
 	intelFiniBatchBuffer();
-
 	intel_xvmc_dump_close();
     }
     return Success;
diff --git a/src/xvmc/intel_xvmc.h b/src/xvmc/intel_xvmc.h
index 73a37a0..f9c517a 100644
--- a/src/xvmc/intel_xvmc.h
+++ b/src/xvmc/intel_xvmc.h
@@ -130,11 +130,6 @@ typedef struct _intel_xvmc_driver {
     int screen;			/* current screen num*/
 
     int fd;			/* drm file handler */
-    drm_handle_t hsarea;	/* DRI open connect */
-    char busID[32];
-
-    unsigned int sarea_size;
-    drmAddress sarea_address;
 
     struct {
 	unsigned int start_offset;
@@ -156,9 +151,7 @@ typedef struct _intel_xvmc_driver {
 
     sigset_t sa_mask;
     pthread_mutex_t ctxmutex;
-    int lock;   /* Lightweight lock to avoid locking twice */
     int locked;
-    drmLock *driHwLock;
 
     int num_ctx;
     intel_xvmc_context_ptr ctx_list;
diff --git a/src/xvmc/xf86dri.c b/src/xvmc/xf86dri.c
deleted file mode 100644
index 9ea919a..0000000
--- a/src/xvmc/xf86dri.c
+++ /dev/null
@@ -1,565 +0,0 @@
-/**************************************************************************
-
-Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
-Copyright 2000 VA Linux Systems, Inc.
-All Rights Reserved.
-
-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, sub license, 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 NON-INFRINGEMENT.
-IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS 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:
- *   Kevin E. Martin <martin at valinux.com>
- *   Jens Owen <jens at tungstengraphics.com>
- *   Rickard E. (Rik) Faith <faith at valinux.com>
- *
- */
-
-/* THIS IS NOT AN X CONSORTIUM STANDARD */
-
-#define NEED_REPLIES
-#include <X11/Xlibint.h>
-#include <X11/extensions/Xext.h>
-#include <X11/extensions/extutil.h>
-#include "xf86dristr.h"
-
-static XExtensionInfo _xf86dri_info_data;
-static XExtensionInfo *xf86dri_info = &_xf86dri_info_data;
-static char xf86dri_extension_name[] = XF86DRINAME;
-
-#define uniDRICheckExtension(dpy,i,val) \
-  XextCheckExtension (dpy, i, xf86dri_extension_name, val)
-
-/*****************************************************************************
- *                                                                           *
- *			   private utility routines                          *
- *                                                                           *
- *****************************************************************************/
-
-static int close_display(Display * dpy, XExtCodes * extCodes);
-static /* const */ XExtensionHooks xf86dri_extension_hooks = {
-    NULL,			       /* create_gc */
-    NULL,			       /* copy_gc */
-    NULL,			       /* flush_gc */
-    NULL,			       /* free_gc */
-    NULL,			       /* create_font */
-    NULL,			       /* free_font */
-    close_display,		       /* close_display */
-    NULL,			       /* wire_to_event */
-    NULL,			       /* event_to_wire */
-    NULL,			       /* error */
-    NULL,			       /* error_string */
-};
-
-static
-XEXT_GENERATE_FIND_DISPLAY(find_display, xf86dri_info,
-    xf86dri_extension_name, &xf86dri_extension_hooks, 0, NULL)
-
-    static XEXT_GENERATE_CLOSE_DISPLAY(close_display, xf86dri_info)
-
-/*****************************************************************************
- *                                                                           *
- *		    public XFree86-DRI Extension routines                    *
- *                                                                           *
- *****************************************************************************/
-#if 0
-#include <stdio.h>
-#define TRACE(msg, arg...)  fprintf(stderr,"uniDRI" msg "\n", ##arg);
-#else
-#define TRACE(msg, arg...)
-#endif
-Bool
-uniDRIQueryExtension(Display *dpy, int *event_basep, int *error_basep)
-{
-    XExtDisplayInfo *info = find_display(dpy);
-
-    TRACE("QueryExtension...");
-    if (XextHasExtension(info)) {
-	*event_basep = info->codes->first_event;
-	*error_basep = info->codes->first_error;
-	TRACE("QueryExtension... return True");
-	return True;
-    } else {
-	TRACE("QueryExtension... return False");
-	return False;
-    }
-}
-
-Bool
-uniDRIQueryVersion(Display *dpy, int *majorVersion, int *minorVersion,
-		   int *patchVersion)
-{
-    XExtDisplayInfo *info = find_display(dpy);
-    xXF86DRIQueryVersionReply rep;
-    xXF86DRIQueryVersionReq *req;
-
-    TRACE("QueryVersion...");
-    uniDRICheckExtension(dpy, info, False);
-
-    LockDisplay(dpy);
-    GetReq(XF86DRIQueryVersion, req);
-    req->reqType = info->codes->major_opcode;
-    req->driReqType = X_XF86DRIQueryVersion;
-    if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
-	UnlockDisplay(dpy);
-	SyncHandle();
-	TRACE("QueryVersion... return False");
-	return False;
-    }
-    *majorVersion = rep.majorVersion;
-    *minorVersion = rep.minorVersion;
-    *patchVersion = rep.patchVersion;
-    UnlockDisplay(dpy);
-    SyncHandle();
-    TRACE("QueryVersion... %d.%d.%d return True", rep.majorVersion,
-		    rep.minorVersion, rep.patchVersion);
-    return True;
-}
-
-Bool
-uniDRIQueryDirectRenderingCapable(Display *dpy, int screen, Bool *isCapable)
-{
-    XExtDisplayInfo *info = find_display(dpy);
-    xXF86DRIQueryDirectRenderingCapableReply rep;
-    xXF86DRIQueryDirectRenderingCapableReq *req;
-
-    TRACE("QueryDirectRenderingCapable...");
-    uniDRICheckExtension(dpy, info, False);
-
-    LockDisplay(dpy);
-    GetReq(XF86DRIQueryDirectRenderingCapable, req);
-    req->reqType = info->codes->major_opcode;
-    req->driReqType = X_XF86DRIQueryDirectRenderingCapable;
-    req->screen = screen;
-    if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
-	UnlockDisplay(dpy);
-	SyncHandle();
-	TRACE("QueryDirectRenderingCapable... return False");
-	return False;
-    }
-    *isCapable = rep.isCapable;
-    UnlockDisplay(dpy);
-    SyncHandle();
-    TRACE("QueryDirectRenderingCapable... %s return True",
-		    rep.isCapable ? "true" : "false");
-    return True;
-}
-
-Bool
-uniDRIOpenConnection(Display *dpy, int screen,
-		     drm_handle_t *hSAREA, char **busIdString)
-{
-    XExtDisplayInfo *info = find_display(dpy);
-    xXF86DRIOpenConnectionReply rep;
-    xXF86DRIOpenConnectionReq *req;
-
-    TRACE("OpenConnection...");
-    uniDRICheckExtension(dpy, info, False);
-
-    LockDisplay(dpy);
-    GetReq(XF86DRIOpenConnection, req);
-    req->reqType = info->codes->major_opcode;
-    req->driReqType = X_XF86DRIOpenConnection;
-    req->screen = screen;
-    if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
-	UnlockDisplay(dpy);
-	SyncHandle();
-	TRACE("OpenConnection... return False");
-	return False;
-    }
-
-    *hSAREA = rep.hSAREALow;
-#ifdef LONG64
-    if (sizeof(drm_handle_t) == 8) {
-	*hSAREA |= ((unsigned long)rep.hSAREAHigh) << 32;
-    }
-#endif
-    if (rep.length) {
-	if (!(*busIdString = (char *)Xcalloc(rep.busIdStringLength + 1, 1))) {
-	    _XEatData(dpy, ((rep.busIdStringLength + 3) & ~3));
-	    UnlockDisplay(dpy);
-	    SyncHandle();
-	    TRACE("OpenConnection... return False");
-	    return False;
-	}
-	_XReadPad(dpy, *busIdString, rep.busIdStringLength);
-    } else {
-	*busIdString = NULL;
-    }
-    UnlockDisplay(dpy);
-    SyncHandle();
-    TRACE("OpenConnection... busid %s return True",
-		   *busIdString ? *busIdString : "null");
-    return True;
-}
-
-Bool
-uniDRIAuthConnection(Display *dpy, int screen, drm_magic_t magic)
-{
-    XExtDisplayInfo *info = find_display(dpy);
-    xXF86DRIAuthConnectionReq *req;
-    xXF86DRIAuthConnectionReply rep;
-
-    TRACE("AuthConnection...");
-    uniDRICheckExtension(dpy, info, False);
-
-    LockDisplay(dpy);
-    GetReq(XF86DRIAuthConnection, req);
-    req->reqType = info->codes->major_opcode;
-    req->driReqType = X_XF86DRIAuthConnection;
-    req->screen = screen;
-    req->magic = magic;
-    rep.authenticated = 0;
-    if (!_XReply(dpy, (xReply *) & rep, 0, xFalse) || !rep.authenticated) {
-	UnlockDisplay(dpy);
-	SyncHandle();
-	TRACE("AuthConnection... return False");
-	return False;
-    }
-    UnlockDisplay(dpy);
-    SyncHandle();
-    TRACE("AuthConnection... return True");
-    return True;
-}
-
-Bool
-uniDRICloseConnection(Display *dpy, int screen)
-{
-    XExtDisplayInfo *info = find_display(dpy);
-    xXF86DRICloseConnectionReq *req;
-
-    TRACE("CloseConnection...");
-
-    uniDRICheckExtension(dpy, info, False);
-
-    LockDisplay(dpy);
-    GetReq(XF86DRICloseConnection, req);
-    req->reqType = info->codes->major_opcode;
-    req->driReqType = X_XF86DRICloseConnection;
-    req->screen = screen;
-    UnlockDisplay(dpy);
-    SyncHandle();
-    TRACE("CloseConnection... return True");
-    return True;
-}
-
-Bool
-uniDRIGetClientDriverName(Display *dpy, int screen, int *ddxDriverMajorVersion,
-			  int *ddxDriverMinorVersion, int *ddxDriverPatchVersion,
-			  char **clientDriverName)
-{
-    XExtDisplayInfo *info = find_display(dpy);
-    xXF86DRIGetClientDriverNameReply rep;
-    xXF86DRIGetClientDriverNameReq *req;
-
-    TRACE("GetClientDriverName...");
-    uniDRICheckExtension(dpy, info, False);
-
-    LockDisplay(dpy);
-    GetReq(XF86DRIGetClientDriverName, req);
-    req->reqType = info->codes->major_opcode;
-    req->driReqType = X_XF86DRIGetClientDriverName;
-    req->screen = screen;
-    if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
-	UnlockDisplay(dpy);
-	SyncHandle();
-	TRACE("GetClientDriverName... return False");
-	return False;
-    }
-
-    *ddxDriverMajorVersion = rep.ddxDriverMajorVersion;
-    *ddxDriverMinorVersion = rep.ddxDriverMinorVersion;
-    *ddxDriverPatchVersion = rep.ddxDriverPatchVersion;
-
-    if (rep.length) {
-	if (!(*clientDriverName =
-		(char *)Xcalloc(rep.clientDriverNameLength + 1, 1))) {
-	    _XEatData(dpy, ((rep.clientDriverNameLength + 3) & ~3));
-	    UnlockDisplay(dpy);
-	    SyncHandle();
-	    TRACE("GetClientDriverName... return False");
-	    return False;
-	}
-	_XReadPad(dpy, *clientDriverName, rep.clientDriverNameLength);
-    } else {
-	*clientDriverName = NULL;
-    }
-    UnlockDisplay(dpy);
-    SyncHandle();
-    TRACE("GetClientDriverName... return True");
-    return True;
-}
-
-Bool
-uniDRICreateContextWithConfig(Display *dpy, int screen, int configID,
-			      XID context, drm_context_t *hHWContext)
-{
-    XExtDisplayInfo *info = find_display(dpy);
-    xXF86DRICreateContextReply rep;
-    xXF86DRICreateContextReq *req;
-
-    TRACE("CreateContext... id %d", context);
-    uniDRICheckExtension(dpy, info, False);
-
-    LockDisplay(dpy);
-    GetReq(XF86DRICreateContext, req);
-    req->reqType = info->codes->major_opcode;
-    req->driReqType = X_XF86DRICreateContext;
-    req->visual = configID;
-    req->screen = screen;
-    req->context = context;
-    if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
-	UnlockDisplay(dpy);
-	SyncHandle();
-	TRACE("CreateContext... return False");
-	return False;
-    }
-    *hHWContext = rep.hHWContext;
-    UnlockDisplay(dpy);
-    SyncHandle();
-    TRACE("CreateContext... return True");
-    return True;
-}
-
-Bool
-uniDRICreateContext(Display *dpy, int screen, Visual *visual,
-		    XID context, drm_context_t *hHWContext)
-{
-    return uniDRICreateContextWithConfig(dpy, screen,
-	   visual->visualid, context, hHWContext);
-}
-
-Bool
-uniDRIDestroyContext(Display * ndpy, int screen, XID context)
-{
-    Display *const dpy = (Display *) ndpy;
-    XExtDisplayInfo *info = find_display(dpy);
-    xXF86DRIDestroyContextReq *req;
-
-    TRACE("DestroyContext... id %d", context);
-    uniDRICheckExtension(dpy, info, False);
-
-    LockDisplay(dpy);
-    GetReq(XF86DRIDestroyContext, req);
-    req->reqType = info->codes->major_opcode;
-    req->driReqType = X_XF86DRIDestroyContext;
-    req->screen = screen;
-    req->context = context;
-    UnlockDisplay(dpy);
-    SyncHandle();
-    TRACE("DestroyContext... return True");
-    return True;
-}
-
-Bool
-uniDRICreateDrawable(Display * ndpy, int screen,
-    Drawable drawable, drm_drawable_t * hHWDrawable)
-{
-    Display *const dpy = (Display *) ndpy;
-    XExtDisplayInfo *info = find_display(dpy);
-    xXF86DRICreateDrawableReply rep;
-    xXF86DRICreateDrawableReq *req;
-
-    TRACE("CreateDrawable...");
-    uniDRICheckExtension(dpy, info, False);
-
-    LockDisplay(dpy);
-    GetReq(XF86DRICreateDrawable, req);
-    req->reqType = info->codes->major_opcode;
-    req->driReqType = X_XF86DRICreateDrawable;
-    req->screen = screen;
-    req->drawable = drawable;
-    if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
-	UnlockDisplay(dpy);
-	SyncHandle();
-	TRACE("CreateDrawable... return False");
-	return False;
-    }
-    *hHWDrawable = rep.hHWDrawable;
-    UnlockDisplay(dpy);
-    SyncHandle();
-    TRACE("CreateDrawable... return True");
-    return True;
-}
-
-Bool
-uniDRIDestroyDrawable(Display * ndpy, int screen, Drawable drawable)
-{
-    Display *const dpy = (Display *) ndpy;
-    XExtDisplayInfo *info = find_display(dpy);
-    xXF86DRIDestroyDrawableReq *req;
-
-    TRACE("DestroyDrawable...");
-    uniDRICheckExtension(dpy, info, False);
-
-    LockDisplay(dpy);
-    GetReq(XF86DRIDestroyDrawable, req);
-    req->reqType = info->codes->major_opcode;
-    req->driReqType = X_XF86DRIDestroyDrawable;
-    req->screen = screen;
-    req->drawable = drawable;
-    UnlockDisplay(dpy);
-    SyncHandle();
-    TRACE("DestroyDrawable... return True");
-    return True;
-}
-
-Bool
-uniDRIGetDrawableInfo(Display * dpy, int screen, Drawable drawable,
-    unsigned int *index, unsigned int *stamp,
-    int *X, int *Y, int *W, int *H,
-    int *numClipRects, drm_clip_rect_t ** pClipRects,
-    int *backX, int *backY,
-    int *numBackClipRects, drm_clip_rect_t ** pBackClipRects)
-{
-    XExtDisplayInfo *info = find_display(dpy);
-    xXF86DRIGetDrawableInfoReply rep;
-    xXF86DRIGetDrawableInfoReq *req;
-    int total_rects;
-
-    TRACE("GetDrawableInfo...");
-    uniDRICheckExtension(dpy, info, False);
-
-    LockDisplay(dpy);
-    GetReq(XF86DRIGetDrawableInfo, req);
-    req->reqType = info->codes->major_opcode;
-    req->driReqType = X_XF86DRIGetDrawableInfo;
-    req->screen = screen;
-    req->drawable = drawable;
-
-    if (!_XReply(dpy, (xReply *) & rep, 1, xFalse)) {
-	UnlockDisplay(dpy);
-	SyncHandle();
-	TRACE("GetDrawableInfo... return False");
-	return False;
-    }
-    *index = rep.drawableTableIndex;
-    *stamp = rep.drawableTableStamp;
-    *X = (int)rep.drawableX;
-    *Y = (int)rep.drawableY;
-    *W = (int)rep.drawableWidth;
-    *H = (int)rep.drawableHeight;
-    *numClipRects = rep.numClipRects;
-    total_rects = *numClipRects;
-
-    *backX = rep.backX;
-    *backY = rep.backY;
-    *numBackClipRects = rep.numBackClipRects;
-    total_rects += *numBackClipRects;
-
-#if 0
-    /* Because of the fix in Xserver/GL/dri/xf86dri.c, this check breaks
-     * backwards compatibility (Because of the >> 2 shift) but the fix
-     * enables multi-threaded apps to work.
-     */
-    if (rep.length != ((((SIZEOF(xXF86DRIGetDrawableInfoReply) -
-			SIZEOF(xGenericReply) +
-			total_rects * sizeof(drm_clip_rect_t)) +
-		    3) & ~3) >> 2)) {
-	_XEatData(dpy, rep.length);
-	UnlockDisplay(dpy);
-	SyncHandle();
-	TRACE("GetDrawableInfo... return False");
-	return False;
-    }
-#endif
-
-    if (*numClipRects) {
-	int len = sizeof(drm_clip_rect_t) * (*numClipRects);
-
-	*pClipRects = (drm_clip_rect_t *) Xcalloc(len, 1);
-	if (*pClipRects)
-	    _XRead(dpy, (char *)*pClipRects, len);
-    } else {
-	*pClipRects = NULL;
-    }
-
-    if (*numBackClipRects) {
-	int len = sizeof(drm_clip_rect_t) * (*numBackClipRects);
-
-	*pBackClipRects = (drm_clip_rect_t *) Xcalloc(len, 1);
-	if (*pBackClipRects)
-	    _XRead(dpy, (char *)*pBackClipRects, len);
-    } else {
-	*pBackClipRects = NULL;
-    }
-
-    UnlockDisplay(dpy);
-    SyncHandle();
-    TRACE("GetDrawableInfo... return True");
-    return True;
-}
-
-Bool
-uniDRIGetDeviceInfo(Display *dpy, int screen, drm_handle_t *hFrameBuffer,
-		    int *fbOrigin, int *fbSize, int *fbStride,
-		    int *devPrivateSize, void **pDevPrivate)
-{
-    XExtDisplayInfo *info = find_display(dpy);
-    xXF86DRIGetDeviceInfoReply rep;
-    xXF86DRIGetDeviceInfoReq *req;
-
-    TRACE("GetDeviceInfo...");
-    uniDRICheckExtension(dpy, info, False);
-
-    LockDisplay(dpy);
-    GetReq(XF86DRIGetDeviceInfo, req);
-    req->reqType = info->codes->major_opcode;
-    req->driReqType = X_XF86DRIGetDeviceInfo;
-    req->screen = screen;
-    if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
-	UnlockDisplay(dpy);
-	SyncHandle();
-	TRACE("GetDeviceInfo... return False");
-	return False;
-    }
-
-    *hFrameBuffer = rep.hFrameBufferLow;
-#ifdef LONG64
-    if (sizeof(drm_handle_t) == 8) {
-	*hFrameBuffer |= ((unsigned long)rep.hFrameBufferHigh) << 32;
-    }
-#endif
-
-    *fbOrigin = rep.framebufferOrigin;
-    *fbSize = rep.framebufferSize;
-    *fbStride = rep.framebufferStride;
-    *devPrivateSize = rep.devPrivateSize;
-
-    if (rep.length) {
-	if (!(*pDevPrivate = (void *)Xcalloc(rep.devPrivateSize, 1))) {
-	    _XEatData(dpy, ((rep.devPrivateSize + 3) & ~3));
-	    UnlockDisplay(dpy);
-	    SyncHandle();
-	    TRACE("GetDeviceInfo... return False");
-	    return False;
-	}
-	_XRead(dpy, (char *)*pDevPrivate, rep.devPrivateSize);
-    } else {
-	*pDevPrivate = NULL;
-    }
-
-    UnlockDisplay(dpy);
-    SyncHandle();
-    TRACE("GetDeviceInfo... return True");
-    return True;
-}
diff --git a/src/xvmc/xf86dri.h b/src/xvmc/xf86dri.h
deleted file mode 100644
index 5b8655d..0000000
--- a/src/xvmc/xf86dri.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/**************************************************************************
-
-Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
-Copyright 2000 VA Linux Systems, Inc.
-All Rights Reserved.
-
-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, sub license, 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 NON-INFRINGEMENT.
-IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS 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.
-
-**************************************************************************/
-
-/**
- * \file xf86dri.h
- * Protocol numbers and function prototypes for DRI X protocol.
- *
- * \author Kevin E. Martin <martin at valinux.com>
- * \author Jens Owen <jens at tungstengraphics.com>
- * \author Rickard E. (Rik) Faith <faith at valinux.com>
- */
-
-#ifndef _XF86DRI_H_
-#define _XF86DRI_H_
-
-#include <X11/Xfuncproto.h>
-#include <xf86drm.h>
-
-#define X_XF86DRIQueryVersion			0
-#define X_XF86DRIQueryDirectRenderingCapable	1
-#define X_XF86DRIOpenConnection			2
-#define X_XF86DRICloseConnection		3
-#define X_XF86DRIGetClientDriverName		4
-#define X_XF86DRICreateContext			5
-#define X_XF86DRIDestroyContext			6
-#define X_XF86DRICreateDrawable			7
-#define X_XF86DRIDestroyDrawable		8
-#define X_XF86DRIGetDrawableInfo		9
-#define X_XF86DRIGetDeviceInfo			10
-#define X_XF86DRIAuthConnection                 11
-#define X_XF86DRIOpenFullScreen                 12	/* Deprecated */
-#define X_XF86DRICloseFullScreen                13	/* Deprecated */
-
-#define XF86DRINumberEvents		0
-
-#define XF86DRIClientNotLocal		0
-#define XF86DRIOperationNotSupported	1
-#define XF86DRINumberErrors		(XF86DRIOperationNotSupported + 1)
-
-#ifndef _XF86DRI_SERVER_
-
-_XFUNCPROTOBEGIN
-extern Bool uniDRIQueryExtension(Display * dpy, int *event_base,
-    int *error_base);
-
-extern Bool uniDRIQueryVersion(Display * dpy, int *majorVersion,
-    int *minorVersion, int *patchVersion);
-
-extern Bool uniDRIQueryDirectRenderingCapable(Display * dpy, int screen,
-    Bool * isCapable);
-
-extern Bool uniDRIOpenConnection(Display * dpy, int screen, drm_handle_t * hSAREA,
-    char **busIDString);
-
-extern Bool uniDRIAuthConnection(Display * dpy, int screen, drm_magic_t magic);
-
-extern Bool uniDRICloseConnection(Display * dpy, int screen);
-
-extern Bool uniDRIGetClientDriverName(Display * dpy, int screen,
-    int *ddxDriverMajorVersion, int *ddxDriverMinorVersion,
-    int *ddxDriverPatchVersion, char **clientDriverName);
-
-/* XvMC context XID is alloced in _xvmc_create_context, so
- * don't recreate here */
-extern Bool uniDRICreateContext(Display * dpy, int screen, Visual * visual,
-    XID context_id, drm_context_t * hHWContext);
-
-extern Bool uniDRICreateContextWithConfig(Display * dpy, int screen,
-    int configID, XID context_id, drm_context_t * hHWContext);
-
-extern Bool uniDRIDestroyContext(Display * dpy, int screen, XID context_id);
-
-extern Bool uniDRICreateDrawable(Display * dpy, int screen,
-    Drawable drawable, drm_drawable_t * hHWDrawable);
-
-extern Bool uniDRIDestroyDrawable(Display * dpy, int screen,
-    Drawable drawable);
-
-extern Bool uniDRIGetDeviceInfo(Display * dpy, int screen,
-    drm_handle_t * hFrameBuffer, int *fbOrigin, int *fbSize,
-    int *fbStride, int *devPrivateSize, void **pDevPrivate);
-
-extern Bool uniDRIGetDrawableInfo(Display * dpy, int screen,
-    Drawable drawable, unsigned int *index, unsigned int *stamp,
-    int *X, int *Y, int *W, int *H,
-    int *numClipRects, drm_clip_rect_t ** pClipRects,
-    int *backX, int *backY,
-    int *numBackClipRects, drm_clip_rect_t ** pBackClipRects);
-
-_XFUNCPROTOEND
-#endif /* _XF86DRI_SERVER_ */
-#endif /* _XF86DRI_H_ */
diff --git a/src/xvmc/xf86dristr.h b/src/xvmc/xf86dristr.h
deleted file mode 100644
index d898996..0000000
--- a/src/xvmc/xf86dristr.h
+++ /dev/null
@@ -1,389 +0,0 @@
-/**************************************************************************
-
-Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
-Copyright 2000 VA Linux Systems, Inc.
-All Rights Reserved.
-
-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, sub license, 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 NON-INFRINGEMENT.
-IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS 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:
- *   Kevin E. Martin <martin at valinux.com>
- *   Jens Owen <jens at tungstengraphics.com>
- *   Rickard E. (Rik) Fiath <faith at valinux.com>
- *
- */
-
-#ifndef _XF86DRISTR_H_
-#define _XF86DRISTR_H_
-
-#include "xf86dri.h"
-
-#define XF86DRINAME "XFree86-DRI"
-
-/* The DRI version number.  This was originally set to be the same of the
- * XFree86 version number.  However, this version is really indepedent of
- * the XFree86 version.
- *
- * Version History:
- *    4.0.0: Original
- *    4.0.1: Patch to bump clipstamp when windows are destroyed, 28 May 02
- *    4.1.0: Add transition from single to multi in DRMInfo rec, 24 Jun 02
- */
-#define XF86DRI_MAJOR_VERSION	4
-#define XF86DRI_MINOR_VERSION	1
-#define XF86DRI_PATCH_VERSION	0
-
-typedef struct _XF86DRIQueryVersion
-{
-    CARD8 reqType;		       /* always DRIReqCode */
-    CARD8 driReqType;		       /* always X_DRIQueryVersion */
-    CARD16 length B16;
-} xXF86DRIQueryVersionReq;
-
-#define sz_xXF86DRIQueryVersionReq	4
-
-typedef struct
-{
-    BYTE type;			       /* X_Reply */
-    BOOL pad1;
-    CARD16 sequenceNumber B16;
-    CARD32 length B32;
-    CARD16 majorVersion B16;	       /* major version of DRI protocol */
-    CARD16 minorVersion B16;	       /* minor version of DRI protocol */
-    CARD32 patchVersion B32;	       /* patch version of DRI protocol */
-    CARD32 pad3 B32;
-    CARD32 pad4 B32;
-    CARD32 pad5 B32;
-    CARD32 pad6 B32;
-} xXF86DRIQueryVersionReply;
-
-#define sz_xXF86DRIQueryVersionReply	32
-
-typedef struct _XF86DRIQueryDirectRenderingCapable
-{
-    CARD8 reqType;		       /* always DRIReqCode */
-    CARD8 driReqType;		       /* X_DRIQueryDirectRenderingCapable */
-    CARD16 length B16;
-    CARD32 screen B32;
-} xXF86DRIQueryDirectRenderingCapableReq;
-
-#define sz_xXF86DRIQueryDirectRenderingCapableReq	8
-
-typedef struct
-{
-    BYTE type;			       /* X_Reply */
-    BOOL pad1;
-    CARD16 sequenceNumber B16;
-    CARD32 length B32;
-    BOOL isCapable;
-    BOOL pad2;
-    BOOL pad3;
-    BOOL pad4;
-    CARD32 pad5 B32;
-    CARD32 pad6 B32;
-    CARD32 pad7 B32;
-    CARD32 pad8 B32;
-    CARD32 pad9 B32;
-} xXF86DRIQueryDirectRenderingCapableReply;
-
-#define sz_xXF86DRIQueryDirectRenderingCapableReply	32
-
-typedef struct _XF86DRIOpenConnection
-{
-    CARD8 reqType;		       /* always DRIReqCode */
-    CARD8 driReqType;		       /* always X_DRIOpenConnection */
-    CARD16 length B16;
-    CARD32 screen B32;
-} xXF86DRIOpenConnectionReq;
-
-#define sz_xXF86DRIOpenConnectionReq	8
-
-typedef struct
-{
-    BYTE type;			       /* X_Reply */
-    BOOL pad1;
-    CARD16 sequenceNumber B16;
-    CARD32 length B32;
-    CARD32 hSAREALow B32;
-    CARD32 hSAREAHigh B32;
-    CARD32 busIdStringLength B32;
-    CARD32 pad6 B32;
-    CARD32 pad7 B32;
-    CARD32 pad8 B32;
-} xXF86DRIOpenConnectionReply;
-
-#define sz_xXF86DRIOpenConnectionReply	32
-
-typedef struct _XF86DRIAuthConnection
-{
-    CARD8 reqType;		       /* always DRIReqCode */
-    CARD8 driReqType;		       /* always X_DRICloseConnection */
-    CARD16 length B16;
-    CARD32 screen B32;
-    CARD32 magic B32;
-} xXF86DRIAuthConnectionReq;
-
-#define sz_xXF86DRIAuthConnectionReq	12
-
-typedef struct
-{
-    BYTE type;
-    BOOL pad1;
-    CARD16 sequenceNumber B16;
-    CARD32 length B32;
-    CARD32 authenticated B32;
-    CARD32 pad2 B32;
-    CARD32 pad3 B32;
-    CARD32 pad4 B32;
-    CARD32 pad5 B32;
-    CARD32 pad6 B32;
-} xXF86DRIAuthConnectionReply;
-
-#define zx_xXF86DRIAuthConnectionReply  32
-
-typedef struct _XF86DRICloseConnection
-{
-    CARD8 reqType;		       /* always DRIReqCode */
-    CARD8 driReqType;		       /* always X_DRICloseConnection */
-    CARD16 length B16;
-    CARD32 screen B32;
-} xXF86DRICloseConnectionReq;
-
-#define sz_xXF86DRICloseConnectionReq	8
-
-typedef struct _XF86DRIGetClientDriverName
-{
-    CARD8 reqType;		       /* always DRIReqCode */
-    CARD8 driReqType;		       /* always X_DRIGetClientDriverName */
-    CARD16 length B16;
-    CARD32 screen B32;
-} xXF86DRIGetClientDriverNameReq;
-
-#define sz_xXF86DRIGetClientDriverNameReq	8
-
-typedef struct
-{
-    BYTE type;			       /* X_Reply */
-    BOOL pad1;
-    CARD16 sequenceNumber B16;
-    CARD32 length B32;
-    CARD32 ddxDriverMajorVersion B32;
-    CARD32 ddxDriverMinorVersion B32;
-    CARD32 ddxDriverPatchVersion B32;
-    CARD32 clientDriverNameLength B32;
-    CARD32 pad5 B32;
-    CARD32 pad6 B32;
-} xXF86DRIGetClientDriverNameReply;
-
-#define sz_xXF86DRIGetClientDriverNameReply	32
-
-typedef struct _XF86DRICreateContext
-{
-    CARD8 reqType;		       /* always DRIReqCode */
-    CARD8 driReqType;		       /* always X_DRICreateContext */
-    CARD16 length B16;
-    CARD32 screen B32;
-    CARD32 visual B32;
-    CARD32 context B32;
-} xXF86DRICreateContextReq;
-
-#define sz_xXF86DRICreateContextReq	16
-
-typedef struct
-{
-    BYTE type;			       /* X_Reply */
-    BOOL pad1;
-    CARD16 sequenceNumber B16;
-    CARD32 length B32;
-    CARD32 hHWContext B32;
-    CARD32 pad2 B32;
-    CARD32 pad3 B32;
-    CARD32 pad4 B32;
-    CARD32 pad5 B32;
-    CARD32 pad6 B32;
-} xXF86DRICreateContextReply;
-
-#define sz_xXF86DRICreateContextReply	32
-
-typedef struct _XF86DRIDestroyContext
-{
-    CARD8 reqType;		       /* always DRIReqCode */
-    CARD8 driReqType;		       /* always X_DRIDestroyContext */
-    CARD16 length B16;
-    CARD32 screen B32;
-    CARD32 context B32;
-} xXF86DRIDestroyContextReq;
-
-#define sz_xXF86DRIDestroyContextReq	12
-
-typedef struct _XF86DRICreateDrawable
-{
-    CARD8 reqType;		       /* always DRIReqCode */
-    CARD8 driReqType;		       /* always X_DRICreateDrawable */
-    CARD16 length B16;
-    CARD32 screen B32;
-    CARD32 drawable B32;
-} xXF86DRICreateDrawableReq;
-
-#define sz_xXF86DRICreateDrawableReq	12
-
-typedef struct
-{
-    BYTE type;			       /* X_Reply */
-    BOOL pad1;
-    CARD16 sequenceNumber B16;
-    CARD32 length B32;
-    CARD32 hHWDrawable B32;
-    CARD32 pad2 B32;
-    CARD32 pad3 B32;
-    CARD32 pad4 B32;
-    CARD32 pad5 B32;
-    CARD32 pad6 B32;
-} xXF86DRICreateDrawableReply;
-
-#define sz_xXF86DRICreateDrawableReply	32
-
-typedef struct _XF86DRIDestroyDrawable
-{
-    CARD8 reqType;		       /* always DRIReqCode */
-    CARD8 driReqType;		       /* always X_DRIDestroyDrawable */
-    CARD16 length B16;
-    CARD32 screen B32;
-    CARD32 drawable B32;
-} xXF86DRIDestroyDrawableReq;
-
-#define sz_xXF86DRIDestroyDrawableReq	12
-
-typedef struct _XF86DRIGetDrawableInfo
-{
-    CARD8 reqType;		       /* always DRIReqCode */
-    CARD8 driReqType;		       /* always X_DRIGetDrawableInfo */
-    CARD16 length B16;
-    CARD32 screen B32;
-    CARD32 drawable B32;
-} xXF86DRIGetDrawableInfoReq;
-
-#define sz_xXF86DRIGetDrawableInfoReq	12
-
-typedef struct
-{
-    BYTE type;			       /* X_Reply */
-    BOOL pad1;
-    CARD16 sequenceNumber B16;
-    CARD32 length B32;
-    CARD32 drawableTableIndex B32;
-    CARD32 drawableTableStamp B32;
-    INT16 drawableX B16;
-    INT16 drawableY B16;
-    INT16 drawableWidth B16;
-    INT16 drawableHeight B16;
-    CARD32 numClipRects B32;
-    INT16 backX B16;
-    INT16 backY B16;
-    CARD32 numBackClipRects B32;
-} xXF86DRIGetDrawableInfoReply;
-
-#define sz_xXF86DRIGetDrawableInfoReply	36
-
-typedef struct _XF86DRIGetDeviceInfo
-{
-    CARD8 reqType;		       /* always DRIReqCode */
-    CARD8 driReqType;		       /* always X_DRIGetDeviceInfo */
-    CARD16 length B16;
-    CARD32 screen B32;
-} xXF86DRIGetDeviceInfoReq;
-
-#define sz_xXF86DRIGetDeviceInfoReq	8
-
-typedef struct
-{
-    BYTE type;			       /* X_Reply */
-    BOOL pad1;
-    CARD16 sequenceNumber B16;
-    CARD32 length B32;
-    CARD32 hFrameBufferLow B32;
-    CARD32 hFrameBufferHigh B32;
-    CARD32 framebufferOrigin B32;
-    CARD32 framebufferSize B32;
-    CARD32 framebufferStride B32;
-    CARD32 devPrivateSize B32;
-} xXF86DRIGetDeviceInfoReply;
-
-#define sz_xXF86DRIGetDeviceInfoReply	32
-
-typedef struct _XF86DRIOpenFullScreen
-{
-    CARD8 reqType;		       /* always DRIReqCode */
-    CARD8 driReqType;		       /* always X_DRIOpenFullScreen */
-    CARD16 length B16;
-    CARD32 screen B32;
-    CARD32 drawable B32;
-} xXF86DRIOpenFullScreenReq;
-
-#define sz_xXF86DRIOpenFullScreenReq    12
-
-typedef struct
-{
-    BYTE type;
-    BOOL pad1;
-    CARD16 sequenceNumber B16;
-    CARD32 length B32;
-    CARD32 isFullScreen B32;
-    CARD32 pad2 B32;
-    CARD32 pad3 B32;
-    CARD32 pad4 B32;
-    CARD32 pad5 B32;
-    CARD32 pad6 B32;
-} xXF86DRIOpenFullScreenReply;
-
-#define sz_xXF86DRIOpenFullScreenReply  32
-
-typedef struct _XF86DRICloseFullScreen
-{
-    CARD8 reqType;		       /* always DRIReqCode */
-    CARD8 driReqType;		       /* always X_DRICloseFullScreen */
-    CARD16 length B16;
-    CARD32 screen B32;
-    CARD32 drawable B32;
-} xXF86DRICloseFullScreenReq;
-
-#define sz_xXF86DRICloseFullScreenReq   12
-
-typedef struct
-{
-    BYTE type;
-    BOOL pad1;
-    CARD16 sequenceNumber B16;
-    CARD32 length B32;
-    CARD32 pad2 B32;
-    CARD32 pad3 B32;
-    CARD32 pad4 B32;
-    CARD32 pad5 B32;
-    CARD32 pad6 B32;
-    CARD32 pad7 B32;
-} xXF86DRICloseFullScreenReply;
-
-#define sz_xXF86DRICloseFullScreenReply  32
-
-#endif /* _XF86DRISTR_H_ */
commit 50c10ededba15dd0c118f1b65756362061491090
Merge: 13c730e... 87332a7...
Author: Zou Nan hai <nanhai.zou at intel.com>
Date:   Mon May 18 17:11:28 2009 +0800

    Merge branch 'master' into xvmc-vld

diff --cc src/i830_hwmc.h
index d0dc15b,41f6441..062234c
--- a/src/i830_hwmc.h
+++ b/src/i830_hwmc.h
@@@ -100,9 -100,7 +100,8 @@@ struct intel_xvmc_driver 
  extern struct intel_xvmc_driver *xvmc_driver;
  extern struct intel_xvmc_driver i915_xvmc_driver;
  extern struct intel_xvmc_driver i965_xvmc_driver;
 +extern struct intel_xvmc_driver vld_xvmc_driver;
  
- extern Bool intel_xvmc_set_driver(struct intel_xvmc_driver *);
  extern Bool intel_xvmc_probe(ScrnInfoPtr);
  extern Bool intel_xvmc_driver_init(ScreenPtr, XF86VideoAdaptorPtr);
  extern Bool intel_xvmc_screen_init(ScreenPtr);
commit 87332a7cc16af82aa47e07fbf90da3635b071dbf
Author: Keith Packard <keithp at keithp.com>
Date:   Mon May 11 13:52:00 2009 -0700

    Use drm_intel_bo_disable_reuse API to flag scanout and cursor buffers
    
    Buffers referenced by the kernel for scanout or cursor display should not be
    reused by the driver. Use the new drm API to disable reuse of these buffers.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/src/i830.h b/src/i830.h
index 33a92c6..0969c48 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -902,6 +902,7 @@ extern const int I830CopyROP[16];
 #define NEED_NON_STOLEN			0x00000004
 #define NEED_LIFETIME_FIXED		0x00000008
 #define ALLOW_SHARING			0x00000010
+#define DISABLE_REUSE			0x00000020
 
 /* Chipset registers for VIDEO BIOS memory RW access */
 #define _855_DRAM_RW_CONTROL 0x58
diff --git a/src/i830_memory.c b/src/i830_memory.c
index 892c26e..2a697a7 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -799,6 +799,9 @@ i830_allocate_memory_bo(ScrnInfoPtr pScrn, const char *name,
 	}
     }
 
+    if (flags & DISABLE_REUSE)
+	drm_intel_bo_disable_reuse(mem->bo);
+
     /* Insert new allocation into the list */
     mem->prev = NULL;
     mem->next = pI830->bo_list;
@@ -1076,7 +1079,7 @@ i830_allocate_framebuffer(ScrnInfoPtr pScrn)
     i830_memory *front_buffer = NULL;
     enum tile_format tile_format = TILE_NONE;
 
-    flags = ALLOW_SHARING;
+    flags = ALLOW_SHARING|DISABLE_REUSE;
 
     /* We'll allocate the fb such that the root window will fit regardless of
      * rotation.
@@ -1142,6 +1145,8 @@ i830_allocate_cursor_buffers(ScrnInfoPtr pScrn)
 
     flags = pI830->CursorNeedsPhysical ? NEED_PHYSICAL_ADDR : 0;
 
+    flags |= DISABLE_REUSE;
+
     /* Try to allocate one big blob for our cursor memory.  This works
      * around a limitation in the FreeBSD AGP driver that allows only one
      * physical allocation larger than a page, and could allow us
commit ebe05200df381c0e6ee636f0f83440bfedea9bcb
Author: Jesse Barnes <jbarnes at virtuousgeek.org>
Date:   Fri May 15 08:50:17 2009 -0700

    Add --enable-debug flag to configure
    
    Defaults to enabled.

diff --git a/configure.ac b/configure.ac
index 028d17d..bb05d1e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -70,6 +70,14 @@ AC_ARG_ENABLE(video-debug, AC_HELP_STRING([--enable-video-debug],
               [VIDEO_DEBUG="$enableval"],
               [VIDEO_DEBUG=no])
 
+AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],
+				    [Compile with debug support [[default=yes]]]))
+if test "x$enableval" == "xyes" ; then
+	DEBUGFLAGS="-g"
+else
+	DEBUGFLAGS=""
+fi
+
 dnl AC_ARG_ENABLE(xvmc, AC_HELP_STRING([--disable-xvmc],
 dnl                                   [Disable XvMC support [[default=auto]]]),
 dnl               [XVMC="$enableval"],
@@ -116,7 +124,7 @@ if test x$DRI = xauto; then
         fi
 fi
 AC_MSG_RESULT([$DRI])
-CFLAGS="$save_CFLAGS"
+CFLAGS="$save_CFLAGS $DEBUGFLAGS"
 
 PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.10])
 
commit 04772b6c09a88f0483c2a7efc48029967c77b9bc
Author: Keith Packard <keithp at keithp.com>
Date:   Thu May 14 16:57:11 2009 -0700

    If DRM can't figure out which pipe to sync on, then don't sync at all.
    
    Syncing to the wrong pipe can wedge the hardware if the exclusion area is
    larger than the vtotal
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/configure.ac b/configure.ac
index 8aef4cf..028d17d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -130,7 +130,7 @@ if test "x$GCC" = "xyes"; then
 	-Wnested-externs -fno-strict-aliasing"
 fi
 
-PKG_CHECK_MODULES(DRM, [libdrm >= 2.4.6])
+PKG_CHECK_MODULES(DRM, [libdrm >= 2.4.11])
 AM_CONDITIONAL(DRI, test x$DRI = xyes)
 if test "$DRI" = yes; then
         PKG_CHECK_MODULES(DRI, [xf86driproto glproto])
diff --git a/src/i830_video.c b/src/i830_video.c
index 64cea04..1c3a5b7 100644
--- a/src/i830_video.c
+++ b/src/i830_video.c
@@ -2504,27 +2504,29 @@ I830PutImage(ScrnInfoPtr pScrn,
 		pipe = intel_crtc->pipe;
 	    }
 
-	    if (pipe == 0) {
-		event = MI_WAIT_FOR_PIPEA_SCAN_LINE_WINDOW;
-		load_scan_lines_pipe = MI_LOAD_SCAN_LINES_DISPLAY_PIPEA;
-	    } else {
-		event = MI_WAIT_FOR_PIPEB_SCAN_LINE_WINDOW;
-		load_scan_lines_pipe = MI_LOAD_SCAN_LINES_DISPLAY_PIPEB;
-	    }
+	    if (pipe >= 0) {
+		if (pipe == 0) {
+		    event = MI_WAIT_FOR_PIPEA_SCAN_LINE_WINDOW;
+		    load_scan_lines_pipe = MI_LOAD_SCAN_LINES_DISPLAY_PIPEA;
+		} else {
+		    event = MI_WAIT_FOR_PIPEB_SCAN_LINE_WINDOW;
+		    load_scan_lines_pipe = MI_LOAD_SCAN_LINES_DISPLAY_PIPEB;
+		}
 
-	    box = REGION_EXTENTS(unused, clipBoxes);
-	    y1 = box->y1 - crtc->y;
-	    y2 = box->y2 - crtc->y;
-
-            BEGIN_BATCH(5);
-	    /* The documentation says that the LOAD_SCAN_LINES command
-	     * always comes in pairs. Don't ask me why. */
-	    OUT_BATCH(MI_LOAD_SCAN_LINES_INCL | load_scan_lines_pipe);
-	    OUT_BATCH((y1 << 16) | y2);
-	    OUT_BATCH(MI_LOAD_SCAN_LINES_INCL | load_scan_lines_pipe);
-	    OUT_BATCH((y1 << 16) | y2);
-            OUT_BATCH(MI_WAIT_FOR_EVENT | event);
-            ADVANCE_BATCH();
+		box = REGION_EXTENTS(unused, clipBoxes);
+		y1 = box->y1 - crtc->y;
+		y2 = box->y2 - crtc->y;
+
+		BEGIN_BATCH(5);
+		/* The documentation says that the LOAD_SCAN_LINES command
+		 * always comes in pairs. Don't ask me why. */
+		OUT_BATCH(MI_LOAD_SCAN_LINES_INCL | load_scan_lines_pipe);
+		OUT_BATCH((y1 << 16) | y2);
+		OUT_BATCH(MI_LOAD_SCAN_LINES_INCL | load_scan_lines_pipe);
+		OUT_BATCH((y1 << 16) | y2);
+		OUT_BATCH(MI_WAIT_FOR_EVENT | event);
+		ADVANCE_BATCH();
+	    }
         }
 
         if (IS_I965G(pI830)) {
commit 128c1c3b7d57b157604788f82bf9fd389839068f
Author: Carl Worth <cworth at cworth.org>
Date:   Wed Apr 29 14:43:56 2009 -0700

    Use libdrm to lookup pipe for tear-free sync of XV
    
    Previously, the code was trying to examine a driver_private field,
    but those fields are only set by the userland-modesetting code so
    would fail in the case of KMS. This fixes bug #21076:
    
    [945GME] [KMS] XV_SYNC_TO_VBLANK does not prevent tearing of xv video
    https://bugs.freedesktop.org/show_bug.cgi?id=21076

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 15ffc29..7df7b6f 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -920,3 +920,11 @@ Bool drmmode_pre_init(ScrnInfoPtr pScrn, int fd, int cpp)
 
 	return TRUE;
 }
+
+int
+drmmode_get_pipe_from_crtc_id(drm_intel_bufmgr *bufmgr, xf86CrtcPtr crtc)
+{
+	drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+
+	return drm_intel_get_pipe_from_crtc_id (bufmgr, drmmode_crtc->mode_crtc->crtc_id);
+}
diff --git a/src/i830.h b/src/i830.h
index 68bc0a5..33a92c6 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -679,6 +679,7 @@ Bool I830DRI2ScreenInit(ScreenPtr pScreen);
 void I830DRI2CloseScreen(ScreenPtr pScreen);
 
 extern Bool drmmode_pre_init(ScrnInfoPtr pScrn, int fd, int cpp);
+extern int drmmode_get_pipe_from_crtc_id(drm_intel_bufmgr *bufmgr, xf86CrtcPtr crtc);
 
 extern Bool I830AccelInit(ScreenPtr pScreen);
 extern void I830SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir,
diff --git a/src/i830_video.c b/src/i830_video.c
index 1e05e9c..64cea04 100644
--- a/src/i830_video.c
+++ b/src/i830_video.c
@@ -2495,15 +2495,21 @@ I830PutImage(ScrnInfoPtr pScrn,
         if (sync) {
 	    BoxPtr box;
 	    int y1, y2;
-            int event, pipe;
-	    I830CrtcPrivatePtr intel_crtc = crtc->driver_private;
+            int pipe, event, load_scan_lines_pipe;
 
-	    if (intel_crtc->pipe == 0) {
+	    if (pI830->use_drm_mode)
+		pipe = drmmode_get_pipe_from_crtc_id(pI830->bufmgr, crtc);
+	    else {
+		I830CrtcPrivatePtr intel_crtc = crtc->driver_private;
+		pipe = intel_crtc->pipe;
+	    }
+
+	    if (pipe == 0) {
 		event = MI_WAIT_FOR_PIPEA_SCAN_LINE_WINDOW;
-		pipe = MI_LOAD_SCAN_LINES_DISPLAY_PIPEA;
+		load_scan_lines_pipe = MI_LOAD_SCAN_LINES_DISPLAY_PIPEA;
 	    } else {
 		event = MI_WAIT_FOR_PIPEB_SCAN_LINE_WINDOW;
-		pipe = MI_LOAD_SCAN_LINES_DISPLAY_PIPEB;
+		load_scan_lines_pipe = MI_LOAD_SCAN_LINES_DISPLAY_PIPEB;
 	    }
 
 	    box = REGION_EXTENTS(unused, clipBoxes);
@@ -2513,9 +2519,9 @@ I830PutImage(ScrnInfoPtr pScrn,
             BEGIN_BATCH(5);
 	    /* The documentation says that the LOAD_SCAN_LINES command
 	     * always comes in pairs. Don't ask me why. */
-	    OUT_BATCH(MI_LOAD_SCAN_LINES_INCL | pipe);
+	    OUT_BATCH(MI_LOAD_SCAN_LINES_INCL | load_scan_lines_pipe);
 	    OUT_BATCH((y1 << 16) | y2);
-	    OUT_BATCH(MI_LOAD_SCAN_LINES_INCL | pipe);
+	    OUT_BATCH(MI_LOAD_SCAN_LINES_INCL | load_scan_lines_pipe);
 	    OUT_BATCH((y1 << 16) | y2);
             OUT_BATCH(MI_WAIT_FOR_EVENT | event);
             ADVANCE_BATCH();
commit 2572fcc6196aff7a2f1095d211fd85d8668647ca
Author: Wu Fengguang <fengguang.wu at intel.com>
Date:   Thu Apr 30 19:51:26 2009 +0800

    README: kill an evil dot
    
    To make copy and paste a more pleasure.
    
    Signed-off-by: Wu Fengguang <fengguang.wu at intel.com>
    Signed-off-by: Eric Anholt <eric at anholt.net>

diff --git a/README b/README
index 96db084..8b0998f 100644
--- a/README
+++ b/README
@@ -31,7 +31,7 @@ documentation can be read with the following command:
 Mailing list for communication with users and developers of
 xf86-video-intel:
 
-	intel-gfx at lists.freedesktop.org.
+	intel-gfx at lists.freedesktop.org
 
 	Note: Subscription is required before posting, but anyone is
 	free to subscribe. See instructions (and archives) here:
commit b9462516d18bc57be5f33f57adb6c3e8beede5ff
Author: Eric Anholt <eric at anholt.net>
Date:   Tue May 12 18:53:27 2009 -0700

    Remove dead "avail" variable from XAA stuff.

diff --git a/src/i830_memory.c b/src/i830_memory.c
index 14e7f89..892c26e 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -1069,7 +1069,7 @@ i830_allocate_framebuffer(ScrnInfoPtr pScrn)
 {
     I830Ptr pI830 = I830PTR(pScrn);
     unsigned int pitch = pScrn->displayWidth * pI830->cpp;
-    unsigned long minspace, avail;
+    unsigned long minspace;
     int align;
     long size, fb_height;
     int flags;
@@ -1088,7 +1088,6 @@ i830_allocate_framebuffer(ScrnInfoPtr pScrn)
      * enough for the virtual screen size.
      */
     minspace = pitch * pScrn->virtualY;
-    avail = pScrn->videoRam * 1024;
 
     size = ROUND_TO_PAGE(pitch * fb_height);
 
commit 1c68bc376a9cb3c0a010c8e28f69a776755c8f64
Author: Jesse Barnes <jbarnes at virtuousgeek.org>
Date:   Wed May 13 13:19:53 2009 -0700

    Add new have_gem flag
    
    Prior to this patch, code that wanted to check whether GEM was present
    would look at pI830->memory_manager.  This turned out to be occasionally
    problematic in the KMS case, since memory_manager didn't always get set
    correctly.  So add a new pI830->have_gem flag to make things clear in
    the various code paths, and set it after GEM initializes or when KMS is
    detected.
    
    Reviewed-by: Eric Anholt <eric at anholt.net>
    Tested-by: Magnus Kessler <Magnus.Kessler at gmx.net>
    Signed-off-by: Jesse Barnes <jbarnes at virtuousgeek.org>

diff --git a/src/i830.h b/src/i830.h
index 0d8726c..68bc0a5 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -405,6 +405,7 @@ typedef struct _I830Rec {
 
    i830_memory *memory_manager;		/**< DRI memory manager aperture */
 
+   Bool have_gem;
    Bool need_mi_flush;
 
    Bool tiling;
diff --git a/src/i830_batchbuffer.c b/src/i830_batchbuffer.c
index 5a9f9c5..a6d9c6e 100644
--- a/src/i830_batchbuffer.c
+++ b/src/i830_batchbuffer.c
@@ -179,7 +179,7 @@ intel_batch_flush(ScrnInfoPtr pScrn, Bool flushed)
 	return;
 
     /* If we're not using GEM, then emit a flush after each batch buffer */
-    if (pI830->memory_manager == NULL && !flushed) {
+    if (!pI830->have_gem && !flushed) {
 	int flags = MI_WRITE_DIRTY_STATE | MI_INVALIDATE_MAP_CACHE;
 
 	if (IS_I965G(pI830))
@@ -219,7 +219,7 @@ intel_batch_flush(ScrnInfoPtr pScrn, Bool flushed)
      * blockhandler.  We could set this less often, but it's probably not worth
      * the work.
      */
-    if (pI830->memory_manager != NULL)
+    if (pI830->have_gem)
 	pI830->need_mi_flush = TRUE;
 
     if (pI830->batch_flush_notify)
diff --git a/src/i830_debug.c b/src/i830_debug.c
index 5a8c3eb..f070978 100644
--- a/src/i830_debug.c
+++ b/src/i830_debug.c
@@ -1882,7 +1882,7 @@ i830_check_error_state(ScrnInfoPtr pScrn)
 	errors++;
     }
     temp = INREG(LP_RING + RING_LEN);
-    if (!pI830->memory_manager && (temp & 1)) {
+    if (!pI830->have_gem && (temp & 1)) {
 	xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
 		   "PRB0_CTL (0x%08lx) indicates ring buffer enabled\n", temp);
 	errors++;
diff --git a/src/i830_driver.c b/src/i830_driver.c
index aaf5a20..854ad0f 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -611,7 +611,7 @@ i830_update_front_offset(ScrnInfoPtr pScrn)
    /* If we are still in ScreenInit, there is no screen pixmap to be updated
     * yet.  We'll fix it up at CreateScreenResources.
     */
-   if (!pI830->memory_manager) {
+   if (!pI830->have_gem) {
        data = pI830->FbBase + pScrn->fbOffset; /* default to legacy */
    } else {
       dri_bo *bo = pI830->front_buffer->bo;
@@ -1444,6 +1444,7 @@ I830DrmModeInit(ScrnInfoPtr pScrn)
     }
 
     pI830->directRenderingType = DRI_NONE;
+    pI830->have_gem = TRUE;
 
     i830_init_bufmgr(pScrn);
 
@@ -2227,7 +2228,7 @@ I830BlockHandler(int i,
 	* fashion.
 	*/
        intel_batch_flush(pScrn, flushed);
-       if (pI830->memory_manager)
+       if (pI830->have_gem)
 	 drmCommandNone(pI830->drmSubFD, DRM_I915_GEM_THROTTLE);
 
        pI830->need_mi_flush = FALSE;
@@ -2370,7 +2371,7 @@ i830_init_bufmgr(ScrnInfoPtr pScrn)
    if (pI830->bufmgr)
        return;
 
-   if (pI830->memory_manager || pI830->use_drm_mode) {
+   if (pI830->have_gem) {
       int batch_size;
 
       batch_size = 4096 * 4;
@@ -2557,8 +2558,10 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
    }
 
    if (pI830->use_drm_mode) {
-       pI830->stolen_size = 0;
-       pScrn->videoRam = ~0UL / KB(1);
+       struct pci_device *const device = pI830->PciInfo;
+       int fb_bar = IS_I9XX(pI830) ? 2 : 0;
+
+       pScrn->videoRam = device->regions[fb_bar].size / 1024;
    } else {
        I830AdjustMemory(pScreen);
    }
@@ -2651,7 +2654,7 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
    }
 
    if (pI830->accel != ACCEL_NONE && !pI830->use_drm_mode) {
-      if (pI830->memory_manager == NULL && pI830->ring.mem->size == 0) {
+      if (!pI830->have_gem && pI830->ring.mem->size == 0) {
 	  xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
 		     "Disabling acceleration because the ring buffer "
 		      "allocation failed.\n");
@@ -2875,11 +2878,10 @@ I830LeaveVT(int scrnIndex, int flags)
        /* Evict everything from the bufmgr, as we're about to lose ownership of
 	* the graphics memory.
 	*/
-       if (!pI830->memory_manager)
+       if (!pI830->have_gem) {
 	   intel_bufmgr_fake_evict_all(pI830->bufmgr);
-
-       if (!pI830->memory_manager)
 	   i830_stop_ring(pScrn, TRUE);
+       }
 
        if (pI830->debug_modes) {
 	   i830CompareRegsToSnapshot(pScrn, "After LeaveVT");
@@ -2891,7 +2893,7 @@ I830LeaveVT(int scrnIndex, int flags)
 
    i830_unbind_all_memory(pScrn);
 
-   if (pI830->memory_manager && !pI830->use_drm_mode) {
+   if (pI830->have_gem && !pI830->use_drm_mode) {
       int ret;
 
       /* Tell the kernel to evict all buffer objects and block GTT usage while
@@ -2968,7 +2970,7 @@ I830EnterVT(int scrnIndex, int flags)
    if (!pI830->use_drm_mode)
        i830_disable_render_standby(pScrn);
 
-   if (pI830->memory_manager && !pI830->use_drm_mode) {
+   if (pI830->have_gem && !pI830->use_drm_mode) {
       int ret;
 
       /* Tell the kernel that we're back in control and ready for GTT
@@ -2999,7 +3001,7 @@ I830EnterVT(int scrnIndex, int flags)
        }
 
        /* Re-set up the ring. */
-       if (!pI830->memory_manager) {
+       if (!pI830->have_gem) {
 	   i830_stop_ring(pScrn, FALSE);
 	   i830_start_ring(pScrn);
        }
diff --git a/src/i830_exa.c b/src/i830_exa.c
index c1f512d..824f032 100644
--- a/src/i830_exa.c
+++ b/src/i830_exa.c
@@ -497,7 +497,7 @@ i830_uxa_prepare_access (PixmapPtr pixmap, uxa_access_t access)
 	intel_batch_flush(scrn, FALSE);
 
 	/* No VT sema or GEM?  No GTT mapping. */
-	if (!scrn->vtSema || !i830->memory_manager) {
+	if (!scrn->vtSema || !i830->have_gem) {
 	    if (dri_bo_map(bo, access == UXA_ACCESS_RW) != 0)
 		return FALSE;
 	    pixmap->devPrivate.ptr = bo->virtual;
@@ -535,7 +535,7 @@ i830_uxa_finish_access (PixmapPtr pixmap)
 	if (bo == i830->front_buffer->bo)
 	    i830->need_flush = TRUE;
 
-	if (!scrn->vtSema || !i830->memory_manager) {
+	if (!scrn->vtSema || !i830->have_gem) {
 	    dri_bo_unmap(bo);
 	    pixmap->devPrivate.ptr = NULL;
 	    return;
diff --git a/src/i830_memory.c b/src/i830_memory.c
index 18ddff4..14e7f89 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -480,6 +480,7 @@ i830_allocator_init(ScrnInfoPtr pScrn, unsigned long size)
 		    i830_free_memory(pScrn, pI830->memory_manager);
 		    pI830->memory_manager = NULL;
 		}
+		pI830->have_gem = TRUE;
 		i830_init_bufmgr(pScrn);
 	    }
 	} else {
commit 52367847087206b92f18c40d356d36ab9ee89d39
Author: Keith Packard <keithp at keithp.com>
Date:   Thu May 7 14:58:02 2009 -0700

    Load i915 and fbcon when checking for KMS
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Eric Anholt <eric at anholt.net>

diff --git a/src/i830_driver.c b/src/i830_driver.c
index 0f66d63..aaf5a20 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -1009,6 +1009,14 @@ static Bool i830_kernel_mode_enabled(ScrnInfoPtr pScrn)
     busIdString = DRICreatePCIBusID(PciInfo);
 
     ret = drmCheckModesettingSupported(busIdString);
+    if (ret)
+	if (xf86LoadKernelModule("i915")) {
+	    ret = drmCheckModesettingSupported(busIdString);
+
+	    /* Be nice to the user and load fbcon too */
+	    if (!ret)
+		(void) xf86LoadKernelModule("fbcon");
+	}
     xfree(busIdString);
     if (ret)
 	return FALSE;
commit ff7494b4c4b1bd8bb6f169402a9edbe9780787bb
Author: Keith Packard <keithp at keithp.com>
Date:   Thu May 7 14:58:01 2009 -0700

    Add DP link and GMCH M and N registers
    
    Signed-off-by: Eric Anholt <eric at anholt.net>

diff --git a/src/i810_reg.h b/src/i810_reg.h
index 8d4e641..cb33784 100644
--- a/src/i810_reg.h
+++ b/src/i810_reg.h
@@ -2214,6 +2214,43 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define PIPE_PIXEL_MASK		0x00ffffff
 #define PIPE_PIXEL_SHIFT	0
 
+/*
+ * Computing GMCH M and N values.
+ *
+ * GMCH M/N = dot clock * bytes per pixel / ls_clk * # of lanes
+ *
+ * ls_clk (we assume) is the DP link clock (1.62 or 2.7 GHz)
+ *
+ * The GMCH value is used internally
+ */
+#define PIPEA_GMCH_DATA_M	0x70050
+
+/* Transfer unit size for display port - 1, default is 0x3f (for TU size 64) */
+#define PIPE_GMCH_DATA_M_TU_SIZE_MASK	(0x3f << 25)
+#define PIPE_GMCH_DATA_M_TU_SIZE_SHIFT	25
+
+#define PIPE_GMCH_DATA_M_MASK		(0xffffff)
+
+#define PIPEA_GMCH_DATA_N	0x70054
+#define PIPE_GMCH_DATA_N_MASK		(0xffffff)
+
+/*
+ * Computing Link M and N values.
+ *
+ * Link M / N = pixel_clock / ls_clk
+ *
+ * (the DP spec calls pixel_clock the 'strm_clk')
+ *
+ * The Link value is transmitted in the Main Stream
+ * Attributes and VB-ID.
+ */
+
+#define PIPEA_DP_LINK_M		0x70060
+#define PIPEA_DP_LINK_M_MASK	(0xffffff)
+
+#define PIPEA_DP_LINK_N		0x70064
+#define PIPEA_DP_LINK_N_MASK	(0xffffff)
+
 #define PIPEB_DSL		0x71000
 
 #define PIPEBCONF 0x71008
@@ -2231,6 +2268,11 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define PIPEBFRAMEHIGH		0x71040
 #define PIPEBFRAMEPIXEL		0x71044
 
+#define PIPEB_GMCH_DATA_M	0x71050
+#define PIPEB_GMCH_DATA_N	0x71054
+#define PIPEB_DP_LINK_M		0x71060
+#define PIPEB_DP_LINK_N		0x71064
+
 #define DSPACNTR		0x70180
 #define DSPBCNTR		0x71180
 #define DISPLAY_PLANE_ENABLE 			(1<<31)
diff --git a/src/i830_debug.c b/src/i830_debug.c
index 86f5f21..5a8c3eb 100644
--- a/src/i830_debug.c
+++ b/src/i830_debug.c
@@ -652,6 +652,10 @@ static struct i830SnapshotRec {
     DEFINEREG2(PIPEACONF, i830_debug_pipeconf),
     DEFINEREG2(PIPEASRC, i830_debug_yxminus1),
     DEFINEREG2(PIPEASTAT, i830_debug_pipestat),
+    DEFINEREG(PIPEA_GMCH_DATA_M),
+    DEFINEREG(PIPEA_GMCH_DATA_N),
+    DEFINEREG(PIPEA_DP_LINK_M),
+    DEFINEREG(PIPEA_DP_LINK_N),
 
     DEFINEREG2(FPA0, i830_debug_fp),
     DEFINEREG2(FPA1, i830_debug_fp),
@@ -676,6 +680,10 @@ static struct i830SnapshotRec {
     DEFINEREG2(PIPEBCONF, i830_debug_pipeconf),
     DEFINEREG2(PIPEBSRC, i830_debug_yxminus1),
     DEFINEREG2(PIPEBSTAT, i830_debug_pipestat),
+    DEFINEREG(PIPEB_GMCH_DATA_M),
+    DEFINEREG(PIPEB_GMCH_DATA_N),
+    DEFINEREG(PIPEB_DP_LINK_M),
+    DEFINEREG(PIPEB_DP_LINK_N),
 
     DEFINEREG2(FPB0, i830_debug_fp),
     DEFINEREG2(FPB1, i830_debug_fp),
commit e54a23bff068416ccbdb75d538dc7dcd40a6c95c
Author: Keith Packard <keithp at keithp.com>
Date:   Thu May 7 16:35:19 2009 -0700

    Fallback when VT inactive
    
    While the VT is inactive, pI830->batch_bo will be NULL, so use that as a
    simple check for when to not use the accelerator. The alternative is to
    ignore VT switch and just keep drawing, which would also be fine.
    
    Bug #21468.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    [anholt: Removed extra return FALSE -- I830FALLBACK does that.]
    Signed-off-by: Eric Anholt <eric at anholt.net>

diff --git a/src/i830_exa.c b/src/i830_exa.c
index 0a15de8..c1f512d 100644
--- a/src/i830_exa.c
+++ b/src/i830_exa.c
@@ -126,6 +126,9 @@ i830_get_aperture_space(ScrnInfoPtr pScrn, drm_intel_bo **bo_table, int num_bos)
 {
     I830Ptr pI830 = I830PTR(pScrn);
 
+    if (pI830->batch_bo == NULL)
+	I830FALLBACK("VT inactive\n");
+
     bo_table[0] = pI830->batch_bo;
     if (drm_intel_bufmgr_check_aperture_space(bo_table, num_bos) != 0) {
 	intel_batch_flush(pScrn, FALSE);
commit 660bd745c21c56e330d844fe4c8eaae862a77483
Author: Wu Fengguang <fengguang.wu at intel.com>
Date:   Thu Apr 30 18:42:18 2009 +0800

    Remove the offset parameter from i830_allocator_init()
    
    offset is redundant.  i830_allocator_init() is only called
    in one place with offset=0.
    
    Acked-by: Magnus Kessler <Magnus.Kessler at gmx.net>
    Signed-off-by: Wu Fengguang <fengguang.wu at intel.com>
    Signed-off-by: Eric Anholt <eric at anholt.net>

diff --git a/src/i830.h b/src/i830.h
index 207d4ec..0d8726c 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -692,8 +692,7 @@ extern void I830SetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop,
 extern void I830SubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y,
 					int w, int h);
 
-Bool i830_allocator_init(ScrnInfoPtr pScrn, unsigned long offset,
-			 unsigned long size);
+Bool i830_allocator_init(ScrnInfoPtr pScrn, unsigned long size);
 void i830_allocator_fini(ScrnInfoPtr pScrn);
 i830_memory * i830_allocate_memory(ScrnInfoPtr pScrn, const char *name,
 				   unsigned long size, unsigned long pitch,
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 1887a51..0f66d63 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -2319,7 +2319,7 @@ i830_memory_init(ScrnInfoPtr pScrn)
 
     tiled = i830_tiled_width(pI830, &pScrn->displayWidth, pI830->cpp);
     /* Set up our video memory allocator for the chosen videoRam */
-    if (!i830_allocator_init(pScrn, 0, pScrn->videoRam * KB(1))) {
+    if (!i830_allocator_init(pScrn, pScrn->videoRam * KB(1))) {
 	xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
 		"Couldn't initialize video memory allocator\n");
 	PreInitCleanup(pScrn);
diff --git a/src/i830_memory.c b/src/i830_memory.c
index d5827f8..18ddff4 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -364,7 +364,7 @@ i830_reset_allocations(ScrnInfoPtr pScrn)
  * addresses to reference.
  */
 Bool
-i830_allocator_init(ScrnInfoPtr pScrn, unsigned long offset, unsigned long size)
+i830_allocator_init(ScrnInfoPtr pScrn, unsigned long size)
 {
     I830Ptr pI830 = I830PTR(pScrn);
     i830_memory *start, *end;
@@ -395,12 +395,12 @@ i830_allocator_init(ScrnInfoPtr pScrn, unsigned long offset, unsigned long size)
     }
 
     start->key = -1;
-    start->offset = offset;
+    start->offset = 0;
     start->end = start->offset;
     start->size = 0;
     start->next = end;
     end->key = -1;
-    end->offset = offset + size;
+    end->offset = size;
     end->end = end->offset;
     end->size = 0;
     end->prev = start;
commit b1f5cc3349f6811ff4d8dc64cc291788d6726372
Author: Carl Worth <cworth at cworth.org>
Date:   Tue May 12 11:45:03 2009 -0700

    RELEASING: Better instructions for where to send announcements
    
    The xorg-announce list doesn't need to hear about development
    snapshots and release candidates. The intel-gfx list is good for
    that.

diff --git a/RELEASING b/RELEASING
index 9376110..2196c8f 100644
--- a/RELEASING
+++ b/RELEASING
@@ -33,8 +33,19 @@ The process for releasing a new tarball is as follows:
 
 	$ <path_to>/util/modular/release.sh driver <last_ver> <ver>
 
-7. Edit the generated release message as needed and send it out
+7. Edit and send the generated release message.
 
 	At the very least, add the release notes from the NEWS file.
 
+	The message is generated as xf86-video-inte-<version>.announce
+
+	For snapshots and release candidates, mail to:
+
+		intel-gfx at lists.freedesktop.org
+
+	For major releases also send to:
+
+		xorg at lists.freedesktop.org
+		xorg-announce at lists.freedesktop.org
+
 8. Throw a release party, you're done! :)
commit f16ee218845ec48940ea457b921d34896d80a807
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date:   Sun May 10 16:25:24 2009 -0700

    Fix "Unkown" typo in two FatalError messages
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at sun.com>

diff --git a/src/i830_render.c b/src/i830_render.c
index 4ca4e33..4bee5ba 100644
--- a/src/i830_render.c
+++ b/src/i830_render.c
@@ -285,7 +285,7 @@ i830_texture_setup(PicturePtr pPict, PixmapPtr pPix, int unit)
 	wrap_mode = TEXCOORDMODE_MIRROR;
 	break;
     default:
-	FatalError("Unkown repeat type %d\n", pPict->repeatType);
+	FatalError("Unknown repeat type %d\n", pPict->repeatType);
     }
 
     switch (pPict->filter) {
diff --git a/src/i915_render.c b/src/i915_render.c
index 268dd8a..ab04e9c 100644
--- a/src/i915_render.c
+++ b/src/i915_render.c
@@ -270,7 +270,7 @@ i915_texture_setup(PicturePtr pPict, PixmapPtr pPix, int unit)
 	wrap_mode = TEXCOORDMODE_MIRROR;
 	break;
     default:
-	FatalError("Unkown repeat type %d\n", pPict->repeatType);
+	FatalError("Unknown repeat type %d\n", pPict->repeatType);
     }
 
     switch (pPict->filter) {
commit 8d27247829fe4f55691ce68f9f4b14810fb34b32
Author: Stijn van Drongelen <tinctorius at gmail.com>
Date:   Tue May 5 16:37:06 2009 +0200

    Fix typo in (unused) INTEL_BIOS_32 macro
    
    Debian bug#527062 <http://bugs.debian.org/527062>
    
    [jcristau: fix same typo in bios_reader.c]
    Signed-off-by: Julien Cristau <jcristau at debian.org>

diff --git a/src/bios_reader/bios_reader.c b/src/bios_reader/bios_reader.c
index fc51821..328cacf 100644
--- a/src/bios_reader/bios_reader.c
+++ b/src/bios_reader/bios_reader.c
@@ -55,8 +55,8 @@ struct _fake_i830 *pI830 = &I830;
 #define INTEL_BIOS_16(_addr)	(pI830->VBIOS[_addr] | \
 				 (pI830->VBIOS[_addr + 1] << 8))
 #define INTEL_BIOS_32(_addr)	(pI830->VBIOS[_addr] | \
-				 (pI830->VBIOS[_addr + 1] << 8) \
-				 (pI830->VBIOS[_addr + 2] << 16) \
+				 (pI830->VBIOS[_addr + 1] << 8) | \
+				 (pI830->VBIOS[_addr + 2] << 16) | \
 				 (pI830->VBIOS[_addr + 3] << 24))
 
 #define YESNO(val) ((val) ? "yes" : "no")
diff --git a/src/i830_bios.c b/src/i830_bios.c
index 7c51f38..73c097a 100644
--- a/src/i830_bios.c
+++ b/src/i830_bios.c
@@ -43,8 +43,8 @@
 #define INTEL_BIOS_16(_addr)	(bios[_addr] |			\
 				 (bios[_addr + 1] << 8))
 #define INTEL_BIOS_32(_addr)	(bios[_addr] |			\
-				 (bios[_addr + 1] << 8)		\
-				 (bios[_addr + 2] << 16)	\
+				 (bios[_addr + 1] << 8) |	\
+				 (bios[_addr + 2] << 16) |	\
 				 (bios[_addr + 3] << 24))
 
 static void *
commit a8a771a853478e5f45f71d0eff3c4d55bf24d0ad
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Wed Apr 29 00:21:18 2009 +0200

    Restore CFLAGS after tests.
    
    Reverts single line of broken commit e5133a94dc78411eaef324131ea8056aeb81779e.
    
    Signed-off-by: Eric Anholt <eric at anholt.net>

diff --git a/configure.ac b/configure.ac
index 12fec79..8aef4cf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -116,6 +116,7 @@ if test x$DRI = xauto; then
         fi
 fi
 AC_MSG_RESULT([$DRI])
+CFLAGS="$save_CFLAGS"
 
 PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.10])
 
commit 8255cca2c9092f7ecb798944aa8f03fa3efcfa6c
Author: Keith Packard <keithp at keithp.com>
Date:   Fri May 1 18:34:43 2009 -0700

    Split i915 textured video commands to fit into batch buffers.
    
    i915 textured video commands are quite long, but must be contained in the
    same batch buffer as the 3D setup commands. When the number of clip rects
    for the video becomes too large for the associated commands to fit in the
    same batch buffer, this change breaks the sequence into pieces, ensuring
    that each batch contains the necessary setup sequence.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/src/i915_video.c b/src/i915_video.c
index 1d1fa01..150cf04 100644
--- a/src/i915_video.c
+++ b/src/i915_video.c
@@ -50,7 +50,8 @@ I915DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id,
    I830Ptr pI830 = I830PTR(pScrn);
    uint32_t format, ms3, s5;
    BoxPtr pbox = REGION_RECTS(dstRegion);
-   int nbox = REGION_NUM_RECTS(dstRegion);
+   int nbox_total = REGION_NUM_RECTS(dstRegion);
+   int nbox_this_time;
    int dxo, dyo, pix_xoff, pix_yoff;
    Bool planar;
 
@@ -73,7 +74,17 @@ I915DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id,
       return;
    }
 
-   intel_batch_start_atomic(pScrn, 200 + 20 * nbox);
+#define BYTES_FOR_BOXES(n)	((200 + (n) * 20) * 4)
+#define BOXES_IN_BYTES(s)	((((s)/4) - 200) / 20)
+#define BATCH_BYTES(p)		((p)->batch_bo->size - 16)
+
+   while (nbox_total) {
+	nbox_this_time = nbox_total;
+	if (BYTES_FOR_BOXES(nbox_this_time) > BATCH_BYTES(pI830))
+		nbox_this_time = BOXES_IN_BYTES(BATCH_BYTES(pI830));
+	nbox_total -= nbox_this_time;
+
+   intel_batch_start_atomic(pScrn, 200 + 20 * nbox_this_time);
 
    IntelEmitInvarientState(pScrn);
    pI830->last_3d = LAST_3D_VIDEO;
@@ -366,7 +377,7 @@ I915DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id,
    dxo = dstRegion->extents.x1;
    dyo = dstRegion->extents.y1;
 
-   while (nbox--)
+   while (nbox_this_time--)
    {
       int box_x1 = pbox->x1;
       int box_y1 = pbox->y1;
@@ -415,5 +426,6 @@ I915DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id,
    }
 
    intel_batch_end_atomic(pScrn);
+   }
 }
 
commit e5e0fb846bda3e1757b89e50d5244d28457b9fe3
Author: Keith Packard <keithp at keithp.com>
Date:   Fri May 1 12:26:04 2009 -0700

    Call down to lower CloseScreen before shutting down DRM allocator
    
    Lower level functions will destroy objects that are managed by the DRM
    allocator, so make sure those are done before the allocator shuts down.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/src/i830_driver.c b/src/i830_driver.c
index 1ff5866..1887a51 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -3085,6 +3085,9 @@ I830CloseScreen(int scrnIndex, ScreenPtr pScreen)
    free(pI830->offscreenImages);
    pI830->offscreenImages = NULL;
 
+   pScreen->CloseScreen = pI830->CloseScreen;
+   (*pScreen->CloseScreen) (scrnIndex, pScreen);
+
    dri_bufmgr_destroy(pI830->bufmgr);
    pI830->bufmgr = NULL;
 
@@ -3098,8 +3101,7 @@ I830CloseScreen(int scrnIndex, ScreenPtr pScreen)
    pScrn->PointerMoved = pI830->PointerMoved;
    pScrn->vtSema = FALSE;
    pI830->closing = FALSE;
-   pScreen->CloseScreen = pI830->CloseScreen;
-   return (*pScreen->CloseScreen) (scrnIndex, pScreen);
+   return TRUE;
 }
 
 static ModeStatus
commit cfb98f3da936907945f48dad4c2345930f7beb60
Author: Keith Packard <keithp at keithp.com>
Date:   Fri May 1 12:23:32 2009 -0700

    Revert "Leave allocator running until lower-level CloseScreens are done"
    
    Uh, oops -- the FD used to talk to the kernel is closed before the
    allocator_fini function is called now.
    
    This reverts commit 1872869e6ffcc8e6cab820c508fe5404d7e8ff9c.

diff --git a/src/i830_driver.c b/src/i830_driver.c
index ff7124d..1ff5866 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -3079,6 +3079,7 @@ I830CloseScreen(int scrnIndex, ScreenPtr pScreen)
 
    xf86_cursors_fini (pScreen);
 
+   i830_allocator_fini(pScrn);
 
    i965_free_video(pScrn);
    free(pI830->offscreenImages);
@@ -3098,9 +3099,7 @@ I830CloseScreen(int scrnIndex, ScreenPtr pScreen)
    pScrn->vtSema = FALSE;
    pI830->closing = FALSE;
    pScreen->CloseScreen = pI830->CloseScreen;
-   (*pScreen->CloseScreen) (scrnIndex, pScreen);
-   i830_allocator_fini(pScrn);
-   return TRUE;
+   return (*pScreen->CloseScreen) (scrnIndex, pScreen);
 }
 
 static ModeStatus
commit 11a853bd8e5d907fe7f5bd907453bcdac9032861
Author: Keith Packard <keithp at keithp.com>
Date:   Fri May 1 11:51:13 2009 -0700

    Hold reference to video binding table until all rects are painted.
    
    The optimization of unreferencing the binding table when the relocation is
    posted causes the object to be dereferenced for each box in the clip list,
    causing general chaos in the buffer manager. It's easier to just hold a
    reference to the object until all of the boxes are painted and then drop it.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/src/i965_video.c b/src/i965_video.c
index a1f577f..d459027 100644
--- a/src/i965_video.c
+++ b/src/i965_video.c
@@ -791,7 +791,6 @@ i965_emit_video_setup(ScrnInfoPtr pScrn, drm_intel_bo *bind_bo, int n_src_surf)
     OUT_BATCH(0); /* sf */
     /* Only the PS uses the binding table */
     OUT_RELOC(bind_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, 0);
-    drm_intel_bo_unreference(bind_bo);
 
     /* Blend constant color (magenta is fun) */
     OUT_BATCH(BRW_3DSTATE_CONSTANT_COLOR | 3);
@@ -1158,6 +1157,9 @@ I965DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id,
 	i965_post_draw_debug(pScrn);
     }
 
+    /* release reference once we're finished */
+    drm_intel_bo_unreference(bind_bo);
+
 #if WATCH_STATS
     i830_dump_error_state(pScrn);
 #endif
commit ed492131c13715b73c14d328d0668120acb58b40
Author: Keith Packard <keithp at keithp.com>
Date:   Fri May 1 11:50:17 2009 -0700

    3D_STATE_VERTEX_BUFFERS takes four 32-bit values, not three.
    
    The spec says this command takes an extra (mbz) 32-bit value, so let's
    provide it with one.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/src/i965_video.c b/src/i965_video.c
index c25bcb3..a1f577f 100644
--- a/src/i965_video.c
+++ b/src/i965_video.c
@@ -1127,15 +1127,16 @@ I965DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id,
 
 	i965_emit_video_setup(pScrn, bind_bo, n_src_surf);
 
-	BEGIN_BATCH(10);
+	BEGIN_BATCH(12);
 	/* Set up the pointer to our vertex buffer */
-	OUT_BATCH(BRW_3DSTATE_VERTEX_BUFFERS | 2);
+	OUT_BATCH(BRW_3DSTATE_VERTEX_BUFFERS | 3);
 	/* four 32-bit floats per vertex */
 	OUT_BATCH((0 << VB0_BUFFER_INDEX_SHIFT) |
 		  VB0_VERTEXDATA |
 		  ((4 * 4) << VB0_BUFFER_PITCH_SHIFT));
 	OUT_RELOC(vb_bo, I915_GEM_DOMAIN_VERTEX, 0, 0);
 	OUT_BATCH(3); /* four corners to our rectangle */
+	OUT_BATCH(0); /* reserved */
 
 	OUT_BATCH(BRW_3DPRIMITIVE |
 		  BRW_3DPRIMITIVE_VERTEX_SEQUENTIAL |
@@ -1147,6 +1148,7 @@ I965DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id,
 	OUT_BATCH(1); /* single instance */
 	OUT_BATCH(0); /* start instance location */
 	OUT_BATCH(0); /* index buffer offset, ignored */
+	OUT_BATCH(MI_NOOP);
 	ADVANCE_BATCH();
 
 	intel_batch_end_atomic(pScrn);
commit 66d1536a2ecc7a3d44da4c0dbe6c85aaa4e05791
Author: Keith Packard <keithp at keithp.com>
Date:   Fri May 1 11:48:51 2009 -0700

    Don't bother to enable VF statistics during 965 video playback
    
    This was used while bringing up the driver to debug vertext fetches.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/src/i965_video.c b/src/i965_video.c
index 1d0ed74..c25bcb3 100644
--- a/src/i965_video.c
+++ b/src/i965_video.c
@@ -772,8 +772,7 @@ i965_emit_video_setup(ScrnInfoPtr pScrn, drm_intel_bo *bind_bo, int n_src_surf)
     /* brw_debug (pScrn, "after base address modify"); */
 
     BEGIN_BATCH(38);
-    /* Enable VF statistics */
-    OUT_BATCH(BRW_3DSTATE_VF_STATISTICS | 1);
+    OUT_BATCH(MI_NOOP);
 
     /* Pipe control */
     OUT_BATCH(BRW_PIPE_CONTROL |
commit 1872869e6ffcc8e6cab820c508fe5404d7e8ff9c
Author: Keith Packard <keithp at keithp.com>
Date:   Fri May 1 11:46:51 2009 -0700

    Leave allocator running until lower-level CloseScreens are done
    
    The lower level close screen functions will free allocated objects, causing
    a crash if the allocator isn't still available.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/src/i830_driver.c b/src/i830_driver.c
index 1ff5866..ff7124d 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -3079,7 +3079,6 @@ I830CloseScreen(int scrnIndex, ScreenPtr pScreen)
 
    xf86_cursors_fini (pScreen);
 
-   i830_allocator_fini(pScrn);
 
    i965_free_video(pScrn);
    free(pI830->offscreenImages);
@@ -3099,7 +3098,9 @@ I830CloseScreen(int scrnIndex, ScreenPtr pScreen)
    pScrn->vtSema = FALSE;
    pI830->closing = FALSE;
    pScreen->CloseScreen = pI830->CloseScreen;
-   return (*pScreen->CloseScreen) (scrnIndex, pScreen);
+   (*pScreen->CloseScreen) (scrnIndex, pScreen);
+   i830_allocator_fini(pScrn);
+   return TRUE;
 }
 
 static ModeStatus
commit 1142353b487c155a31011923fbd08ec67e60f505
Author: Keith Packard <keithp at keithp.com>
Date:   Fri May 1 11:44:13 2009 -0700

    intel_batch_start_atomic: fix size passed to intel_batch_require_space (*4)
    
    intel_batch_start_atomic takes an argument in 32-bit units, and so it must
    multiply that by 4 before passing it to intel_batch_require_space, which
    takes an argument in bytes.
    
    We should figure out what units we want to use and use the same everywhere...
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/src/i830_batchbuffer.h b/src/i830_batchbuffer.h
index 6e0aaa7..0283438 100644
--- a/src/i830_batchbuffer.h
+++ b/src/i830_batchbuffer.h
@@ -57,7 +57,7 @@ intel_batch_start_atomic(ScrnInfoPtr pScrn, unsigned int sz)
     I830Ptr pI830 = I830PTR(pScrn);
 
     assert(!pI830->in_batch_atomic);
-    intel_batch_require_space(pScrn, pI830, sz);
+    intel_batch_require_space(pScrn, pI830, sz * 4);
 
     pI830->in_batch_atomic = TRUE;
     pI830->batch_atomic_limit = pI830->batch_used + sz * 4;
commit 8232177a005127a0001af4b14c3beb766958ef11
Author: Keith Packard <keithp at keithp.com>
Date:   Thu Apr 30 15:30:05 2009 -0700

    Allow cursors to roam past 2048x2048 limit.
    
    There's no reason to clip cursor positions to an artificial limit; the
    hardware cursor limits always mirror the hardware display limits.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/src/i830_cursor.c b/src/i830_cursor.c
index 33b1bd9..a6aba41 100644
--- a/src/i830_cursor.c
+++ b/src/i830_cursor.c
@@ -147,15 +147,15 @@ i830_crtc_set_cursor_position (xf86CrtcPtr crtc, int x, int y)
 
     temp = 0;
     if (x < 0) {
-	temp |= (CURSOR_POS_SIGN << CURSOR_X_SHIFT);
+	temp |= CURSOR_POS_SIGN << CURSOR_X_SHIFT;
 	x = -x;
     }
     if (y < 0) {
-	temp |= (CURSOR_POS_SIGN << CURSOR_Y_SHIFT);
+	temp |= CURSOR_POS_SIGN << CURSOR_Y_SHIFT;
 	y = -y;
     }
-    temp |= ((x & CURSOR_POS_MASK) << CURSOR_X_SHIFT);
-    temp |= ((y & CURSOR_POS_MASK) << CURSOR_Y_SHIFT);
+    temp |= x << CURSOR_X_SHIFT;
+    temp |= y << CURSOR_Y_SHIFT;
 
     switch (intel_crtc->pipe) {
     case 0:
commit 417f3784b7fae8de3559c7607a2de60661a6a448
Author: Carl Worth <cworth at cworth.org>
Date:   Tue Apr 28 20:42:22 2009 -0700

    Add doltlibtool to DISTCLEANFILES
    
    Otherwise make distcheck fails.

diff --git a/Makefile.am b/Makefile.am
index d91b3d2..10653ff 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -24,4 +24,4 @@ ACLOCAL_AMFLAGS = -I m4
 SUBDIRS = uxa src man
 
 EXTRA_DIST = README AUTHORS NEWS
-DISTCLEANFILES = doltcompile
+DISTCLEANFILES = doltcompile doltlibtool
commit bc9a688476f02233450eb05dfb40acbf337d679b
Author: Carl Worth <cworth at cworth.org>
Date:   Tue Apr 28 20:37:13 2009 -0700

    NEWS: Add notes for 2.7.99.1 snapshot

diff --git a/NEWS b/NEWS
index 0d0cd8a..5787be3 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,42 @@
+Snapshot 2.7.99.1 (2009-04-28)
+------------------------------
+This is a development snapshot very early in the process toward
+developing 2.8. There have been some big changes to the code, and
+we're anxious to get feedback on these changes as early as possible.
+
+Here is a summary of the biggest changes:
+
+  * Driver now depends on X server 1.6 or later
+
+  * Eliminate XAA and EXA support (in favor of UXA)
+
+  * Eliminate DRI1 support
+
+  * Fixes for running without DRI at all
+
+These code removals represent a deletion of a substantial amount of
+code, (and hopefully piles of bugs), as well as reduce the maintenance
+effort going forward as the number of combinatorial configurations for
+the driver are greatly reduced. This means that users are much more
+likely to be running code that has actually been tested, and it will
+be much easy for developers to replicate bugs that users experience.
+
+One of the things that would be most useful in testing this release is
+to revisit any outstanding bugs that you have previously reported. If
+the buggy behavior is gone, (or the bug is no longer relevant---such
+as a bug that's specific to XAA only), please feel free to indicate so
+in bugzilla or even just close the bug.
+
+If you confirm that the bug is still present, please indicate so in
+the bug report. (I was going to ask that you select a 1.7.99 version,
+but it looks like bugzilla only has versions for products not
+compoenents, while we use a "xorg" product and a "driver/intel"
+component.) We definitely want to make any such confirmed bugs a
+priority, so it would be nice to have a consistent mechanism to search
+for these bugs. Suggestions are welcome on the best approach.
+
+Thanks in advance for any testing or feedback on this snapshot.
+
 Release 2.7.0 (2009-04-15)
 --------------------------
 Compared to the 2.6 series, 2.7.0 has a large number of bug fixes, but
commit a90cab43209bba52d35b953f3d686a19c154fc43
Author: Kristian Høgsberg <krh at redhat.com>
Date:   Tue Apr 28 13:12:55 2009 -0400

    Remove a handful of pointless comments
    
    CVS keywords, comments about how the source was once reformatted,
    and the ad-hoc changelog comment in in i830_driver.c

diff --git a/src/common.h b/src/common.h
index 1576d3a..ab7a653 100644
--- a/src/common.h
+++ b/src/common.h
@@ -27,7 +27,6 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 **************************************************************************/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/common.h,v 1.9 2003/09/24 02:43:23 dawes Exp $ */
 
 /*
  * Authors:
diff --git a/src/i810.h b/src/i810.h
index a3f45ad..bb356e8 100644
--- a/src/i810.h
+++ b/src/i810.h
@@ -27,7 +27,6 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 **************************************************************************/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810.h,v 1.41 2003/06/18 13:14:17 dawes Exp $ */
 
 /*
  * Authors:
diff --git a/src/i810_accel.c b/src/i810_accel.c
index 1f859b8..ae4a654 100644
--- a/src/i810_accel.c
+++ b/src/i810_accel.c
@@ -25,26 +25,12 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 **************************************************************************/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_accel.c,v 1.21 2004/01/02 20:22:17 dawes Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
 /*
- * Reformatted with GNU indent (2.2.8), using the following options:
- *
- *    -bad -bap -c41 -cd0 -ncdb -ci6 -cli0 -cp0 -ncs -d0 -di3 -i3 -ip3 -l78
- *    -lp -npcs -psl -sob -ss -br -ce -sc -hnl
- *
- * This provides a good match with the original i810 code and preferred
- * XFree86 formatting conventions.
- *
- * When editing this driver, please follow the existing formatting, and edit
- * with <TAB> characters expanded at 8-column intervals.
- */
-
-/*
  * Authors:
  *   Keith Whitwell <keith at tungstengraphics.com>
  *
diff --git a/src/i810_common.h b/src/i810_common.h
index 02e548b..29be444 100644
--- a/src/i810_common.h
+++ b/src/i810_common.h
@@ -25,7 +25,6 @@
  * Converted to common header format:
  *   Jens Owen <jens at tungstengraphics.com>
  *
- * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_common.h,v 1.1 2002/09/11 00:29:31 dawes Exp $
  *
  */
 
diff --git a/src/i810_cursor.c b/src/i810_cursor.c
index 30f42d1..898a136 100644
--- a/src/i810_cursor.c
+++ b/src/i810_cursor.c
@@ -25,26 +25,12 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 **************************************************************************/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_cursor.c,v 1.6 2002/09/11 00:29:31 dawes Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
 /*
- * Reformatted with GNU indent (2.2.8), using the following options:
- *
- *    -bad -bap -c41 -cd0 -ncdb -ci6 -cli0 -cp0 -ncs -d0 -di3 -i3 -ip3 -l78
- *    -lp -npcs -psl -sob -ss -br -ce -sc -hnl
- *
- * This provides a good match with the original i810 code and preferred
- * XFree86 formatting conventions.
- *
- * When editing this driver, please follow the existing formatting, and edit
- * with <TAB> characters expanded at 8-column intervals.
- */
-
-/*
  * Authors:
  *   Keith Whitwell <keith at tungstengraphics.com>
  *
diff --git a/src/i810_dga.c b/src/i810_dga.c
index 4ab7a3d..3f53057 100644
--- a/src/i810_dga.c
+++ b/src/i810_dga.c
@@ -21,20 +21,6 @@
  *
  * Authors:  Alan Hourihane, <alanh at fairlite.demon.co.uk>
  */
-/*
- * Reformatted with GNU indent (2.2.8), using the following options:
- *
- *    -bad -bap -c41 -cd0 -ncdb -ci6 -cli0 -cp0 -ncs -d0 -di3 -i3 -ip3 -l78
- *    -lp -npcs -psl -sob -ss -br -ce -sc -hnl
- *
- * This provides a good match with the original i810 code and preferred
- * XFree86 formatting conventions.
- *
- * When editing this driver, please follow the existing formatting, and edit
- * with <TAB> characters expanded at 8-column intervals.
- */
-
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dga.c,v 1.5 2002/09/11 00:29:31 dawes Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
diff --git a/src/i810_dri.c b/src/i810_dri.c
index 00691af..e566acf 100644
--- a/src/i810_dri.c
+++ b/src/i810_dri.c
@@ -1,17 +1,3 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c,v 1.41 2003/09/24 02:43:23 dawes Exp $ */
-/*
- * Reformatted with GNU indent (2.2.8), using the following options:
- *
- *    -bad -bap -c41 -cd0 -ncdb -ci6 -cli0 -cp0 -ncs -d0 -di3 -i3 -ip3 -l78
- *    -lp -npcs -psl -sob -ss -br -ce -sc -hnl
- *
- * This provides a good match with the original i810 code and preferred
- * XFree86 formatting conventions.
- *
- * When editing this driver, please follow the existing formatting, and edit
- * with <TAB> characters expanded at 8-column intervals.
- */
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
diff --git a/src/i810_dri.h b/src/i810_dri.h
index 5aa4338..16b6f08 100644
--- a/src/i810_dri.h
+++ b/src/i810_dri.h
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.h,v 1.10 2002/12/10 01:27:04 dawes Exp $ */
 
 #ifndef _I810_DRI_
 #define _I810_DRI_
diff --git a/src/i810_driver.c b/src/i810_driver.c
index 263e8d9..627cffc 100644
--- a/src/i810_driver.c
+++ b/src/i810_driver.c
@@ -25,26 +25,12 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 **************************************************************************/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c,v 1.101 2004/01/02 20:15:47 dawes Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
 /*
- * Reformatted with GNU indent (2.2.8), using the following options:
- *
- *    -bad -bap -c41 -cd0 -ncdb -ci6 -cli0 -cp0 -ncs -d0 -di3 -i3 -ip3 -l78
- *    -lp -npcs -psl -sob -ss -br -ce -sc -hnl
- *
- * This provides a good match with the original i810 code and preferred
- * XFree86 formatting conventions.
- *
- * When editing this driver, please follow the existing formatting, and edit
- * with <TAB> characters expanded at 8-column intervals.
- */
-
-/*
  * Authors:
  *   Keith Whitwell <keith at tungstengraphics.com>
  *
diff --git a/src/i810_hwmc.c b/src/i810_hwmc.c
index d56dfc4..12ffdd9 100644
--- a/src/i810_hwmc.c
+++ b/src/i810_hwmc.c
@@ -32,7 +32,6 @@ THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  *
  *
  */
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_hwmc.c,v 1.3 2001/12/04 21:17:56 tsi Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
diff --git a/src/i810_io.c b/src/i810_io.c
index 3fd8e4e..a6cf305 100644
--- a/src/i810_io.c
+++ b/src/i810_io.c
@@ -24,26 +24,12 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 **************************************************************************/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_io.c,v 1.4 2002/01/25 21:56:04 tsi Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
 /*
- * Reformatted with GNU indent (2.2.8), using the following options:
- *
- *    -bad -bap -c41 -cd0 -ncdb -ci6 -cli0 -cp0 -ncs -d0 -di3 -i3 -ip3 -l78
- *    -lp -npcs -psl -sob -ss -br -ce -sc -hnl
- *
- * This provides a good match with the original i810 code and preferred
- * XFree86 formatting conventions.
- *
- * When editing this driver, please follow the existing formatting, and edit
- * with <TAB> characters expanded at 8-column intervals.
- */
-
-/*
  * Authors:
  *   Daryll Strauss <daryll at precisioninsight.com>
  *
diff --git a/src/i810_memory.c b/src/i810_memory.c
index 222b5cf..f57ddbe 100644
--- a/src/i810_memory.c
+++ b/src/i810_memory.c
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_memory.c,v 1.27 2002/12/10 01:27:05 dawes Exp $ */
 /**************************************************************************
 
 Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
@@ -31,19 +30,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #endif
 
 /*
- * Reformatted with GNU indent (2.2.8), using the following options:
- *
- *    -bad -bap -c41 -cd0 -ncdb -ci6 -cli0 -cp0 -ncs -d0 -di3 -i3 -ip3 -l78
- *    -lp -npcs -psl -sob -ss -br -ce -sc -hnl
- *
- * This provides a good match with the original i810 code and preferred
- * XFree86 formatting conventions.
- *
- * When editing this driver, please follow the existing formatting, and edit
- * with <TAB> characters expanded at 8-column intervals.
- */
-
-/*
  * Authors:
  *   Keith Whitwell <keith at tungstengraphics.com>
  *
diff --git a/src/i810_reg.h b/src/i810_reg.h
index d5d41b3..8d4e641 100644
--- a/src/i810_reg.h
+++ b/src/i810_reg.h
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_reg.h,v 1.13 2003/02/06 04:18:04 dawes Exp $ */
 /**************************************************************************
 
 Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
diff --git a/src/i810_video.c b/src/i810_video.c
index 418f295..9528bc7 100644
--- a/src/i810_video.c
+++ b/src/i810_video.c
@@ -23,7 +23,6 @@ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
 THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 **************************************************************************/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_video.c,v 1.26 2003/11/10 18:22:22 tsi Exp $ */
 
 /*
  * i810_video.c: i810 Xv driver. Based on the mga Xv driver by Mark Vojkovich.
diff --git a/src/i810_wmark.c b/src/i810_wmark.c
index d21f6aa..71b2a82 100644
--- a/src/i810_wmark.c
+++ b/src/i810_wmark.c
@@ -1,4 +1,3 @@
-
 /**************************************************************************
 
 Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
@@ -25,20 +24,6 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 **************************************************************************/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_wmark.c,v 1.7 2002/09/11 00:29:32 dawes Exp $ */
-
-/*
- * Reformatted with GNU indent (2.2.8), using the following options:
- *
- *    -bad -bap -c41 -cd0 -ncdb -ci6 -cli0 -cp0 -ncs -d0 -di3 -i3 -ip3 -l78
- *    -lp -npcs -psl -sob -ss -br -ce -sc -hnl
- *
- * This provides a good match with the original i810 code and preferred
- * XFree86 formatting conventions.
- *
- * When editing this driver, please follow the existing formatting, and edit
- * with <TAB> characters expanded at 8-column intervals.
- */
 
 /*
  * Authors:
diff --git a/src/i830.h b/src/i830.h
index 6257e43..207d4ec 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -26,7 +26,6 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 **************************************************************************/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830.h,v 1.12 2004/01/07 03:43:19 dawes Exp $ */
 
 /*
  * Authors:
diff --git a/src/i830_accel.c b/src/i830_accel.c
index 589f86d..b365e3f 100644
--- a/src/i830_accel.c
+++ b/src/i830_accel.c
@@ -1,12 +1,3 @@
-/*
- * XXX So far, for GXxor this is about 40% of the speed of SW, but CPU
- * utilisation falls from 95% to < 5%.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 /**************************************************************************
 
 Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
@@ -33,27 +24,22 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 **************************************************************************/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_accel.c,v 1.8 2003/04/24 18:00:24 eich Exp $ */
 
 /*
- * Reformatted with GNU indent (2.2.8), using the following options:
- *
- *    -bad -bap -c41 -cd0 -ncdb -ci6 -cli0 -cp0 -ncs -d0 -di3 -i3 -ip3 -l78
- *    -lp -npcs -psl -sob -ss -br -ce -sc -hnl
- *
- * This provides a good match with the original i810 code and preferred
- * XFree86 formatting conventions.
+ * Authors:
+ *   Keith Whitwell <keith at tungstengraphics.com>
  *
- * When editing this driver, please follow the existing formatting, and edit
- * with <TAB> characters expanded at 8-column intervals.
  */
 
 /*
- * Authors:
- *   Keith Whitwell <keith at tungstengraphics.com>
- *
+ * XXX So far, for GXxor this is about 40% of the speed of SW, but CPU
+ * utilisation falls from 95% to < 5%.
  */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <errno.h>
 
 #include "xf86.h"
diff --git a/src/i830_common.h b/src/i830_common.h
index eeb2ed7..e9795a2 100644
--- a/src/i830_common.h
+++ b/src/i830_common.h
@@ -26,7 +26,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 **************************************************************************/
 
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_common.h,v 1.1 2002/09/11 00:29:32 dawes Exp $ */
 
 #ifndef _I830_COMMON_H_
 #define _I830_COMMON_H_
diff --git a/src/i830_cursor.c b/src/i830_cursor.c
index e1cf0bf..33b1bd9 100644
--- a/src/i830_cursor.c
+++ b/src/i830_cursor.c
@@ -26,20 +26,6 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 **************************************************************************/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_cursor.c,v 1.6 2002/12/18 15:49:01 dawes Exp $ */
-
-/*
- * Reformatted with GNU indent (2.2.8), using the following options:
- *
- *    -bad -bap -c41 -cd0 -ncdb -ci6 -cli0 -cp0 -ncs -d0 -di3 -i3 -ip3 -l78
- *    -lp -npcs -psl -sob -ss -br -ce -sc -hnl
- *
- * This provides a good match with the original i810 code and preferred
- * XFree86 formatting conventions.
- *
- * When editing this driver, please follow the existing formatting, and edit
- * with <TAB> characters expanded at 8-column intervals.
- */
 
 /*
  * Authors:
diff --git a/src/i830_dri.c b/src/i830_dri.c
index 743521c..0648249 100644
--- a/src/i830_dri.c
+++ b/src/i830_dri.c
@@ -1,4 +1,3 @@
-/* $xfree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_dri.c,v 1.15 2003/06/18 13:14:17 dawes Exp $ */
 /**************************************************************************
 
 Copyright 2001 VA Linux Systems Inc., Fremont, California.
@@ -28,36 +27,11 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 **************************************************************************/
 
 /*
- * Reformatted with GNU indent (2.2.8), using the following options:
- *
- *    -bad -bap -c41 -cd0 -ncdb -ci6 -cli0 -cp0 -ncs -d0 -di3 -i3 -ip3 -l78
- *    -lp -npcs -psl -sob -ss -br -ce -sc -hnl
- *
- * This provides a good match with the original i810 code and preferred
- * XFree86 formatting conventions.
- *
- * When editing this driver, please follow the existing formatting, and edit
- * with <TAB> characters expanded at 8-column intervals.
- */
-
-/*
  * Authors: Jeff Hartmann <jhartmann at valinux.com>
  *          David Dawes <dawes at xfree86.org>
  *          Keith Whitwell <keith at tungstengraphics.com>
  */
 
-/*
- * This driver does AGP memory allocation a little differently from most
- * others.  The 2D and 3D allocations have been unified (see i830_memory.c).
- * The driver does the AGP allocations and binding directly, then passes
- * on the mappings to the DRM module.  The DRM's AGP interfaces are not used.
- * The main difference with this is that the offsets need to include
- * the AGP aperture base address because that won't be known or added on
- * by the DRM module.
- *
- * DHD 07/2002
- */
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
diff --git a/src/i830_dri.h b/src/i830_dri.h
index 83ddd85..bedbcbe 100644
--- a/src/i830_dri.h
+++ b/src/i830_dri.h
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_dri.h,v 1.6 2003/09/28 20:15:59 alanh Exp $ */
 
 #ifndef _I830_DRI_H
 #define _I830_DRI_H
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 7a81d93..1ff5866 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_driver.c,v 1.50 2004/02/20 00:06:00 alanh Exp $ */
 /**************************************************************************
 
 Copyright 2001 VA Linux Systems Inc., Fremont, California.
@@ -28,135 +27,12 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 **************************************************************************/
 
 /*
- * Reformatted with GNU indent (2.2.8), using the following options:
- *
- *    -bad -bap -c41 -cd0 -ncdb -ci6 -cli0 -cp0 -ncs -d0 -di3 -i3 -ip3 -l78
- *    -lp -npcs -psl -sob -ss -br -ce -sc -hnl
- *
- * This provides a good match with the original i810 code and preferred
- * XFree86 formatting conventions.
- *
- * When editing this driver, please follow the existing formatting, and edit
- * with <TAB> characters expanded at 8-column intervals.
- */
-
-/*
  * Authors: Jeff Hartmann <jhartmann at valinux.com>
  *          Abraham van der Merwe <abraham at 2d3d.co.za>
  *          David Dawes <dawes at xfree86.org>
  *          Alan Hourihane <alanh at tungstengraphics.com>
  */
 
-/*
- * Mode handling is based on the VESA driver written by:
- * Paulo César Pereira de Andrade <pcpa at conectiva.com.br>
- */
-
-/*
- * Changes:
- *
- *    23/08/2001 Abraham van der Merwe <abraham at 2d3d.co.za>
- *        - Fixed display timing bug (mode information for some
- *          modes were not initialized correctly)
- *        - Added workarounds for GTT corruptions (I don't adjust
- *          the pitches for 1280x and 1600x modes so we don't
- *          need extra memory)
- *        - The code will now default to 60Hz if LFP is connected
- *        - Added different refresh rate setting code to work
- *          around 0x4f02 BIOS bug
- *        - BIOS workaround for some mode sets (I use legacy BIOS
- *          calls for setting those)
- *        - Removed 0x4f04, 0x01 (save state) BIOS call which causes
- *          LFP to malfunction (do some house keeping and restore
- *          modes ourselves instead - not perfect, but at least the
- *          LFP is working now)
- *        - Several other smaller bug fixes
- *
- *    06/09/2001 Abraham van der Merwe <abraham at 2d3d.co.za>
- *        - Preliminary local memory support (works without agpgart)
- *        - DGA fixes (the code were still using i810 mode sets, etc.)
- *        - agpgart fixes
- *
- *    18/09/2001
- *        - Proper local memory support (should work correctly now
- *          with/without agpgart module)
- *        - more agpgart fixes
- *        - got rid of incorrect GTT adjustments
- *
- *    09/10/2001
- *        - Changed the DPRINTF() variadic macro to an ANSI C compatible
- *          version
- *
- *    10/10/2001
- *        - Fixed DPRINTF_stub(). I forgot the __...__ macros in there
- *          instead of the function arguments :P
- *        - Added a workaround for the 1600x1200 bug (Text mode corrupts
- *          when you exit from any 1600x1200 mode and 1280x1024 at 85Hz. I
- *          suspect this is a BIOS bug (hence the 1280x1024 at 85Hz case)).
- *          For now I'm switching to 800x600 at 60Hz then to 80x25 text mode
- *          and then restoring the registers - very ugly indeed.
- *
- *    15/10/2001
- *        - Improved 1600x1200 mode set workaround. The previous workaround
- *          was causing mode set problems later on.
- *
- *    18/10/2001
- *        - Fixed a bug in I830BIOSLeaveVT() which caused a bug when you
- *          switched VT's
- */
-/*
- *    07/2002 David Dawes
- *        - Add Intel(R) 855GM/852GM support.
- */
-/*
- *    07/2002 David Dawes
- *        - Cleanup code formatting.
- *        - Improve VESA mode selection, and fix refresh rate selection.
- *        - Don't duplicate functions provided in 4.2 vbe modules.
- *        - Don't duplicate functions provided in the vgahw module.
- *        - Rewrite memory allocation.
- *        - Rewrite initialisation and save/restore state handling.
- *        - Decouple the i810 support from i830 and later.
- *        - Remove various unnecessary hacks and workarounds.
- *        - Fix an 845G problem with the ring buffer not in pre-allocated
- *          memory.
- *        - Fix screen blanking.
- *        - Clear the screen at startup so you don't see the previous session.
- *        - Fix some HW cursor glitches, and turn HW cursor off at VT switch
- *          and exit.
- *
- *    08/2002 Keith Whitwell
- *        - Fix DRI initialisation.
- *
- *
- *    08/2002 Alan Hourihane and David Dawes
- *        - Add XVideo support.
- *
- *
- *    10/2002 David Dawes
- *        - Add Intel(R) 865G support.
- *
- *
- *    01/2004 Alan Hourihane
- *        - Add Intel(R) 915G support.
- *        - Add Dual Head and Clone capabilities.
- *        - Add lid status checking
- *        - Fix Xvideo with high-res LFP's
- *        - Add ARGB HW cursor support
- *
- *    05/2005 Alan Hourihane
- *        - Add Intel(R) 945G support.
- *
- *    09/2005 Alan Hourihane
- *        - Add Intel(R) 945GM support.
- *
- *    10/2005 Alan Hourihane, Keith Whitwell, Brian Paul
- *        - Added Rotation support
- *
- *    12/2005 Alan Hourihane, Keith Whitwell
- *        - Add Intel(R) 965G support.
- */
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
diff --git a/src/i830_memory.c b/src/i830_memory.c
index 52ec872..d5827f8 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_memory.c,v 1.9 2003/09/24 03:16:54 dawes Exp $ */
 /**************************************************************************
 
 Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
@@ -29,19 +28,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 **************************************************************************/
 
 /*
- * Reformatted with GNU indent (2.2.8), using the following options:
- *
- *    -bad -bap -c41 -cd0 -ncdb -ci6 -cli0 -cp0 -ncs -d0 -di3 -i3 -ip3 -l78
- *    -lp -npcs -psl -sob -ss -br -ce -sc -hnl
- *
- * This provides a good match with the original i810 code and preferred
- * XFree86 formatting conventions.
- *
- * When editing this driver, please follow the existing formatting, and edit
- * with <TAB> characters expanded at 8-column intervals.
- */
-
-/*
  * Authors:
  *   Keith Whitwell <keith at tungstengraphics.com>
  *   David Dawes <dawes at xfree86.org>
diff --git a/src/i830_video.c b/src/i830_video.c
index 8d33d69..1e05e9c 100644
--- a/src/i830_video.c
+++ b/src/i830_video.c
@@ -23,7 +23,6 @@
  THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
  **************************************************************************/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_video.c,v 1.11tsi Exp $ */
 
 /*
  * i830_video.c: i830/i845 Xv driver. 
diff --git a/src/xvmc/I810XvMC.c b/src/xvmc/I810XvMC.c
index 10606de..0754ff4 100644
--- a/src/xvmc/I810XvMC.c
+++ b/src/xvmc/I810XvMC.c
@@ -33,7 +33,6 @@ THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 **
 **
 ***************************************************************************/
-/* $XFree86: xc/lib/XvMC/hw/i810/I810XvMC.c,v 1.10 2002/10/30 12:52:01 alanh Exp $ */
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
diff --git a/src/xvmc/I810XvMC.h b/src/xvmc/I810XvMC.h
index dc2cab8..c875eca 100644
--- a/src/xvmc/I810XvMC.h
+++ b/src/xvmc/I810XvMC.h
@@ -32,7 +32,6 @@ THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  *
  *
  ***************************************************************************/
-/* $XFree86: xc/lib/XvMC/hw/i810/I810XvMC.h,v 1.3 2002/10/30 12:52:02 alanh Exp $ */
 
 
 #ifndef I810XVMC_H
diff --git a/src/xvmc/xf86dri.c b/src/xvmc/xf86dri.c
index 96987bf..9ea919a 100644
--- a/src/xvmc/xf86dri.c
+++ b/src/xvmc/xf86dri.c
@@ -1,4 +1,3 @@
-/* $XFree86: xc/lib/GL/dri/XF86dri.c,v 1.13 2002/10/30 12:51:25 alanh Exp $ */
 /**************************************************************************
 
 Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
diff --git a/src/xvmc/xf86dri.h b/src/xvmc/xf86dri.h
index 81cfdfd..5b8655d 100644
--- a/src/xvmc/xf86dri.h
+++ b/src/xvmc/xf86dri.h
@@ -1,4 +1,3 @@
-/* $XFree86: xc/lib/GL/dri/xf86dri.h,v 1.8 2002/10/30 12:51:25 alanh Exp $ */
 /**************************************************************************
 
 Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
diff --git a/src/xvmc/xf86dristr.h b/src/xvmc/xf86dristr.h
index 3b43438..d898996 100644
--- a/src/xvmc/xf86dristr.h
+++ b/src/xvmc/xf86dristr.h
@@ -1,4 +1,3 @@
-/* $XFree86: xc/lib/GL/dri/xf86dristr.h,v 1.10 2002/10/30 12:51:25 alanh Exp $ */
 /**************************************************************************
 
 Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
commit c231b41f3f3eb3ba9c8436d5fd93a30704ed437c
Author: Eric Anholt <eric at anholt.net>
Date:   Tue Apr 21 15:55:01 2009 -0700

    Remove checks for xf86RotateFreeShadow, introduced in server 1.4.

diff --git a/configure.ac b/configure.ac
index 768f39d..12fec79 100644
--- a/configure.ac
+++ b/configure.ac
@@ -119,18 +119,6 @@ AC_MSG_RESULT([$DRI])
 
 PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.10])
 
-SAVE_CPPFLAGS="$CPPFLAGS"
-CPPFLAGS="$CPPFLAGS $XORG_CFLAGS"
-
-AC_CHECK_DECL(xf86RotateFreeShadow,
-	      [AC_DEFINE(HAVE_FREE_SHADOW, 1, [have new FreeShadow API])],
-	      [],
-	      [#include <xorg-server.h>
-	       #include <windowstr.h>
-	       #include <xf86Crtc.h>])
-	     
-CPPFLAGS="$SAVE_CPPFLAGS"
-
 dnl Use lots of warning flags with GCC
 
 WARN_CFLAGS=""
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 3642205..7a81d93 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -2969,10 +2969,6 @@ I830LeaveVT(int scrnIndex, int flags)
    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
    I830Ptr pI830 = I830PTR(pScrn);
    int ret;
-#ifndef HAVE_FREE_SHADOW
-   xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
-   int o;
-#endif
 
    DPRINTF(PFX, "Leave VT\n");
 
@@ -2984,21 +2980,7 @@ I830LeaveVT(int scrnIndex, int flags)
 
    i830SetHotkeyControl(pScrn, HOTKEY_BIOS_SWITCH);
 
-
-#ifndef HAVE_FREE_SHADOW
-   for (o = 0; o < config->num_crtc; o++) {
-       xf86CrtcPtr crtc = config->crtc[o];
-
-       if (crtc->rotatedPixmap || crtc->rotatedData) {
-	   crtc->funcs->shadow_destroy(crtc, crtc->rotatedPixmap,
-				crtc->rotatedData);
-	   crtc->rotatedPixmap = NULL;
-	   crtc->rotatedData = NULL;
-       }
-   }
-#else
    xf86RotateFreeShadow(pScrn);
-#endif
 
    xf86_hide_cursors (pScrn);
 
commit e5133a94dc78411eaef324131ea8056aeb81779e
Author: Eric Anholt <eric at anholt.net>
Date:   Tue Apr 21 15:49:01 2009 -0700

    unifdef LIBPCIACCESS and XSERVER_LIBPCIACCESS.
    
    Depending on new server means these are always present.

diff --git a/configure.ac b/configure.ac
index 14a1c6b..768f39d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -117,21 +117,7 @@ if test x$DRI = xauto; then
 fi
 AC_MSG_RESULT([$DRI])
 
-AC_CHECK_DECL(XSERVER_LIBPCIACCESS,
-	      [XSERVER_LIBPCIACCESS=yes],[XSERVER_LIBPCIACCESS=no],
-	      [#include "xorg-server.h"])
-CFLAGS="$save_CFLAGS"
-
-if test x$XSERVER_LIBPCIACCESS = xyes; then
-	PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.10])
-else
-	PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.10],
-				       have_libpciaccess=yes,
-				       have_libpciaccess=no)
-fi
-AM_CONDITIONAL(XSERVER_LIBPCIACCESS, test "x$XSERVER_LIBPCIACCESS" = xyes)
-AM_CONDITIONAL(LIBPCIACCESS,
-	test "x$XSERVER_LIBPCIACCESS" = xyes -o "x$have_libpciaccess" = xyes)
+PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.10])
 
 SAVE_CPPFLAGS="$CPPFLAGS"
 CPPFLAGS="$CPPFLAGS $XORG_CFLAGS"
diff --git a/src/Makefile.am b/src/Makefile.am
index 221b669..3f42e16 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -18,11 +18,7 @@
 #  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.
 
-if LIBPCIACCESS
-REGDUMPER = reg_dumper
-endif
-
-SUBDIRS = xvmc bios_reader ch7017 ch7xxx ivch sil164 tfp410 $(REGDUMPER)
+SUBDIRS = xvmc bios_reader ch7017 ch7xxx ivch sil164 tfp410 reg_dumper
 
 # this is obnoxious:
 # -module lets us name the module exactly how we want
@@ -37,9 +33,7 @@ intel_drv_la_LTLIBRARIES = intel_drv.la
 intel_drv_la_LDFLAGS = -module -avoid-version
 intel_drv_ladir = @moduledir@/drivers
 intel_drv_la_LIBADD = -lm @DRM_LIBS@ -ldrm_intel ../uxa/libuxa.la
-if XSERVER_LIBPCIACCESS
 intel_drv_la_LIBADD += @PCIACCESS_LIBS@
-endif
 
 INTEL_DRI_SRCS = \
          i810_dri.c \
diff --git a/src/bios_reader/Makefile.am b/src/bios_reader/Makefile.am
index e060633..cff9e1a 100644
--- a/src/bios_reader/Makefile.am
+++ b/src/bios_reader/Makefile.am
@@ -3,7 +3,6 @@ AM_CFLAGS = @WARN_CFLAGS@ @XORG_CFLAGS@ @PCIACCESS_CFLAGS@ \
 
 noinst_PROGRAMS = bios_reader  $(BIOS_DUMPER) $(SWF_DUMPER)
 
-if LIBPCIACCESS
 BIOS_DUMPER = bios_dumper
 
 bios_dumper_SOURCES = bios_dumper.c
@@ -15,5 +14,3 @@ SWF_DUMPER = swf_dumper
 swf_dumper_SOURCES = swf_dumper.c
 
 swf_dumper_LDADD = $(PCIACCESS_LIBS)
-
-endif
diff --git a/src/common.h b/src/common.h
index 99b4645..1576d3a 100644
--- a/src/common.h
+++ b/src/common.h
@@ -322,21 +322,12 @@ extern int I810_DEBUG;
 #define PCI_CHIP_G41_G_BRIDGE	0x2E30
 #endif
 
-#if XSERVER_LIBPCIACCESS
 #define I810_MEMBASE(p,n) (p)->regions[(n)].base_addr
 #define VENDOR_ID(p)      (p)->vendor_id
 #define DEVICE_ID(p)      (p)->device_id
 #define SUBVENDOR_ID(p)	  (p)->subvendor_id
 #define SUBSYS_ID(p)      (p)->subdevice_id
 #define CHIP_REVISION(p)  (p)->revision
-#else
-#define I810_MEMBASE(p,n) (p)->memBase[n]
-#define VENDOR_ID(p)      (p)->vendor
-#define DEVICE_ID(p)      (p)->chipType
-#define SUBVENDOR_ID(p)	  (p)->subsysVendor
-#define SUBSYS_ID(p)      (p)->subsysCard
-#define CHIP_REVISION(p)  (p)->chipRev
-#endif
 
 #define IS_I810(pI810) (DEVICE_ID(pI810->PciInfo) == PCI_CHIP_I810 ||	\
 			DEVICE_ID(pI810->PciInfo) == PCI_CHIP_I810_DC100 || \
@@ -403,9 +394,7 @@ extern int I810_DEBUG;
 
 #define PIPE_NAME(n)			('A' + (n))
 
-#if XSERVER_LIBPCIACCESS
 struct pci_device *
 intel_host_bridge (void);
-#endif
-   
+
 #endif /* _INTEL_COMMON_H_ */
diff --git a/src/i810.h b/src/i810.h
index c88771e..a3f45ad 100644
--- a/src/i810.h
+++ b/src/i810.h
@@ -51,9 +51,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "vgaHW.h"
 
 #include "xorg-server.h"
-#ifdef XSERVER_LIBPCIACCESS
 #include <pciaccess.h>
-#endif
 
 #ifdef XF86DRI
 #include "xf86drm.h"
@@ -190,12 +188,7 @@ typedef struct _I810Rec {
    unsigned long MMIOAddr;
    IOADDRESS ioBase;
    EntityInfoPtr pEnt;
-#if XSERVER_LIBPCIACCESS
    struct pci_device *PciInfo;
-#else
-   pciVideoPtr PciInfo;
-   PCITAG PciTag;
-#endif
 
    I810RingBuffer *LpRing;
    unsigned int BR[20];
diff --git a/src/i810_dri.c b/src/i810_dri.c
index 136a705..00691af 100644
--- a/src/i810_dri.c
+++ b/src/i810_dri.c
@@ -354,14 +354,8 @@ I810DRIScreenInit(ScreenPtr pScreen)
    } else {
       pDRIInfo->busIdString = xalloc(64);
       sprintf(pDRIInfo->busIdString, "PCI:%d:%d:%d",
-#if XSERVER_LIBPCIACCESS
 	      ((pI810->PciInfo->domain << 8) | pI810->PciInfo->bus),
 	      pI810->PciInfo->dev, pI810->PciInfo->func
-#else
-	      ((pciConfigPtr) pI810->PciInfo->thisCard)->busnum,
-	      ((pciConfigPtr) pI810->PciInfo->thisCard)->devnum,
-	      ((pciConfigPtr) pI810->PciInfo->thisCard)->funcnum
-#endif
 	      );
    }
    pDRIInfo->ddxDriverMajorVersion = I810_MAJOR_VERSION;
@@ -978,19 +972,10 @@ I810DRIScreenInit(ScreenPtr pScreen)
 
    if (!pI810DRI->irq) {
       pI810DRI->irq = drmGetInterruptFromBusID(pI810->drmSubFD,
-#if XSERVER_LIBPCIACCESS
 					       ((pI810->PciInfo->domain << 8) |
 						pI810->PciInfo->bus),
 					       pI810->PciInfo->dev,
 					       pI810->PciInfo->func
-#else
-					       ((pciConfigPtr) pI810->
-						PciInfo->thisCard)->busnum,
-					       ((pciConfigPtr) pI810->
-						PciInfo->thisCard)->devnum,
-					       ((pciConfigPtr) pI810->
-						PciInfo->thisCard)->funcnum
-#endif
 					       );
       if ((drmCtlInstHandler(pI810->drmSubFD, pI810DRI->irq)) != 0) {
 	 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
diff --git a/src/i810_driver.c b/src/i810_driver.c
index fe4bd62..263e8d9 100644
--- a/src/i810_driver.c
+++ b/src/i810_driver.c
@@ -95,14 +95,10 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 static void I810Identify(int flags);
 
-#if XSERVER_LIBPCIACCESS
 static Bool intel_pci_probe (DriverPtr		drv,
 			     int		entity_num,
 			     struct pci_device	*dev,
 			     intptr_t		match_data);
-#else
-static Bool I810Probe(DriverPtr drv, int flags);
-#endif
 
 #ifndef I830_ONLY
 static Bool I810PreInit(ScrnInfoPtr pScrn, int flags);
@@ -120,9 +116,6 @@ static ModeStatus I810ValidMode(int scrnIndex, DisplayModePtr mode,
 				Bool verbose, int flags);
 #endif /* I830_ONLY */
 
-
-#if XSERVER_LIBPCIACCESS
-
 #define INTEL_DEVICE_MATCH(d,i) \
     { 0x8086, (d), PCI_MATCH_ANY, PCI_MATCH_ANY, 0, 0, (i) }
 
@@ -162,25 +155,17 @@ static const struct pci_id_match intel_device_match[] = {
     { 0, 0, 0 },
 };
 
-#endif /* XSERVER_LIBPCIACCESS */
-
 _X_EXPORT DriverRec I810 = {
    I810_VERSION,
    I810_DRIVER_NAME,
    I810Identify,
-#if XSERVER_LIBPCIACCESS
    NULL,
-#else
-   I810Probe,
-#endif
    I810AvailableOptions,
    NULL,
    0,
    NULL,
-#if XSERVER_LIBPCIACCESS
    intel_device_match,
    intel_pci_probe
-#endif
 };
 
 /* *INDENT-OFF* */
@@ -482,11 +467,7 @@ i810Setup(pointer module, pointer opts, int *errmaj, int *errmin)
    if (!setupDone) {
       setupDone = 1;
       xf86AddDriver(&I810, module,
-#if XSERVER_LIBPCIACCESS
 		    HaveDriverFuncs
-#else
-		    0
-#endif
 		    );
 
       /*
@@ -575,7 +556,6 @@ I810AvailableOptions(int chipid, int busid)
 #endif
 }
 
-#if XSERVER_LIBPCIACCESS
 struct pci_device *
 intel_host_bridge (void)
 {
@@ -641,147 +621,6 @@ static Bool intel_pci_probe (DriverPtr		driver,
     }
     return scrn != NULL;
 }
-#else /* XSERVER_LIBPCIACCESS */
-
-/*
- * I810Probe --
- *
- * Look through the PCI bus to find cards that are I810 boards.
- * Setup the dispatch table for the rest of the driver functions.
- *
- */
-static Bool
-I810Probe(DriverPtr drv, int flags)
-{
-   int i, numUsed, numDevSections, *usedChips;
-   DevUnion *pPriv;						
-   GDevPtr *devSections;
-   Bool foundScreen = FALSE;
-   pciVideoPtr *VideoInfo;
-   pciVideoPtr *ppPci;
-   PciChipsets *id;
-
-   /*
-    * Find the config file Device sections that match this
-    * driver, and return if there are none.
-    */
-   if ((numDevSections =
-	xf86MatchDevice(I810_DRIVER_NAME, &devSections)) <= 0 ) {
-      return FALSE;
-   }
-
-   /*
-    * This probing is just checking the PCI data the server already
-    * collected.
-    */
-   if (!(VideoInfo = xf86GetPciVideoInfo()))
-      return FALSE;
-
-   /*
-    * Mobile platforms may have both function 0 and 1 active, but they
-    * are handled as a single entity.  To make sure that the function 1
-    * entity isn't assigned to a screen, check for and claim it here
-    * first.
-    *
-    * XXX If function 1's resources are ever needed, they'll need to be
-    * added to the screen and marked active.
-    */
-   for (ppPci = VideoInfo; ppPci != NULL && *ppPci != NULL; ppPci++) {
-      if ((*ppPci)->vendor == PCI_VENDOR_INTEL &&
-	  (*ppPci)->func == 1) {
-	 for (id = I810PciChipsets; id->PCIid != -1; id++) {
-	    if (id->PCIid == (*ppPci)->chipType) {
-	       /* Claim slot */
-	       if (xf86CheckPciSlot((*ppPci)->bus, (*ppPci)->device,
-				    (*ppPci)->func)) {
-	  	  xf86ClaimPciSlot((*ppPci)->bus, (*ppPci)->device,
-				   (*ppPci)->func, drv, id->PCIid,
-				   NULL, FALSE);
-	       }
-	       break;
-	    }
-	 }
-      }
-   }
-
-   /* Look for Intel i8xx devices. */
-   numUsed = xf86MatchPciInstances(I810_NAME, PCI_VENDOR_INTEL,
-				   I810Chipsets, I810PciChipsets,
-				   devSections, numDevSections,
-				   drv, &usedChips);
-
-   if (flags & PROBE_DETECT) {
-      if (numUsed > 0)
-	 foundScreen = TRUE;
-   } else {
-      for (i = 0; i < numUsed; i++) {
-	 ScrnInfoPtr pScrn = NULL;
-
-	 /* Allocate new ScrnInfoRec and claim the slot */
-	 if ((pScrn = xf86ConfigPciEntity(pScrn, 0, usedChips[i],
-					  I810PciChipsets, NULL, NULL, NULL,
-					  NULL, NULL))) {
-	    EntityInfoPtr pEnt;
-
-	    pEnt = xf86GetEntityInfo(usedChips[i]);
-
-	    pScrn->driverVersion = I810_VERSION;
-	    pScrn->driverName = I810_DRIVER_NAME;
-	    pScrn->name = I810_NAME;
-	    pScrn->Probe = I810Probe;
-	    foundScreen = TRUE;
-	    switch (pEnt->chipset) {
-	    case PCI_CHIP_845_G:
-	    case PCI_CHIP_I865_G:
-	    case PCI_CHIP_I830_M:
-	    case PCI_CHIP_I855_GM:
-	    case PCI_CHIP_I915_G:
-	    case PCI_CHIP_E7221_G:
-	    case PCI_CHIP_I915_GM:
-	    case PCI_CHIP_I945_G:
-	    case PCI_CHIP_I945_GM:
-	    case PCI_CHIP_I945_GME:
-	    case PCI_CHIP_IGD_GM:
-	    case PCI_CHIP_IGD_G:
-	    case PCI_CHIP_I965_G:
-	    case PCI_CHIP_G35_G:
-	    case PCI_CHIP_I965_Q:
-	    case PCI_CHIP_I946_GZ:
-	    case PCI_CHIP_I965_GM:
-	    case PCI_CHIP_I965_GME:
- 	    case PCI_CHIP_G33_G:
- 	    case PCI_CHIP_Q35_G:
- 	    case PCI_CHIP_Q33_G:
- 	    case PCI_CHIP_GM45_GM:
-	    case PCI_CHIP_IGD_E_G:
-	    case PCI_CHIP_G45_G:
-	    case PCI_CHIP_Q45_G:
-	    case PCI_CHIP_G41_G:
-	       I830InitpScrn(pScrn);
-	       break;
-#ifndef I830_ONLY
-	    default:
-	       pScrn->PreInit = I810PreInit;
-	       pScrn->ScreenInit = I810ScreenInit;
-	       pScrn->SwitchMode = I810SwitchMode;
-	       pScrn->AdjustFrame = I810AdjustFrame;
-	       pScrn->EnterVT = I810EnterVT;
-	       pScrn->LeaveVT = I810LeaveVT;
-	       pScrn->FreeScreen = I810FreeScreen;
-	       pScrn->ValidMode = I810ValidMode;
-	       break;
-#endif
-	    }
-	 }
-      }
-   }
-
-   xfree(usedChips);
-   xfree(devSections);
-
-   return foundScreen;
-}
-#endif /* else XSERVER_LIBPCIACCESS */
 
 #ifndef I830_ONLY
 static void
@@ -873,10 +712,6 @@ I810PreInit(ScrnInfoPtr pScrn, int flags)
    pI810->ioBase = hwp->PIOOffset;
 
    pI810->PciInfo = xf86GetPciInfoForEntity(pI810->pEnt->index);
-#if !XSERVER_LIBPCIACCESS
-   pI810->PciTag = pciTag(pI810->PciInfo->bus, pI810->PciInfo->device,
-			  pI810->PciInfo->func);
-#endif
 
    if (xf86RegisterResources(pI810->pEnt->index, NULL, ResNone))
       return FALSE;
@@ -1015,45 +850,11 @@ I810PreInit(ScrnInfoPtr pScrn, int flags)
    xf86DrvMsg(pScrn->scrnIndex, from, "Chipset: \"%s\"\n",
 	      (pScrn->chipset != NULL) ? pScrn->chipset : "Unknown i810");
 
-#if XSERVER_LIBPCIACCESS
    pI810->LinearAddr = pI810->PciInfo->regions[0].base_addr;
-#else
-   if (pI810->pEnt->device->MemBase != 0) {
-      pI810->LinearAddr = pI810->pEnt->device->MemBase;
-      from = X_CONFIG;
-   } else {
-      if (pI810->PciInfo->memBase[1] != 0) {
-	 pI810->LinearAddr = pI810->PciInfo->memBase[0] & 0xFF000000;
-	 from = X_PROBED;
-      } else {
-	 xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-		    "No valid FB address in PCI config space\n");
-	 I810FreeRec(pScrn);
-	 return FALSE;
-      }
-   }
-#endif
    xf86DrvMsg(pScrn->scrnIndex, from, "Linear framebuffer at 0x%lX\n",
 	      (unsigned long)pI810->LinearAddr);
 
-#if XSERVER_LIBPCIACCESS
    pI810->MMIOAddr = pI810->PciInfo->regions[1].base_addr;
-#else
-   if (pI810->pEnt->device->IOBase != 0) {
-      pI810->MMIOAddr = pI810->pEnt->device->IOBase;
-      from = X_CONFIG;
-   } else {
-      if (pI810->PciInfo->memBase[1]) {
-	 pI810->MMIOAddr = pI810->PciInfo->memBase[1] & 0xFFF80000;
-	 from = X_PROBED;
-      } else {
-	 xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-		    "No valid MMIO address in PCI config space\n");
-	 I810FreeRec(pScrn);
-	 return FALSE;
-      }
-   }
-#endif
    xf86DrvMsg(pScrn->scrnIndex, from, "IO registers at addr 0x%lX\n",
 	      (unsigned long)pI810->MMIOAddr);
 
@@ -1072,11 +873,7 @@ I810PreInit(ScrnInfoPtr pScrn, int flags)
    {
       uint32_t whtcfg_pamr_drp;
     
-#if XSERVER_LIBPCIACCESS
       pci_device_cfg_read_u32(pI810->PciInfo, & whtcfg_pamr_drp, WHTCFG_PAMR_DRP);
-#else
-      whtcfg_pamr_drp = pciReadLong(pI810->PciTag, WHTCFG_PAMR_DRP);
-#endif
 
       /* Need this for choosing watermarks.
        */
@@ -1129,18 +926,10 @@ I810PreInit(ScrnInfoPtr pScrn, int flags)
 
    /* Calculate Fixed Offsets depending on graphics aperture size */
    {
-#if XSERVER_LIBPCIACCESS
       struct pci_device *bridge = intel_host_bridge ();
       uint32_t   smram_miscc;
       
       pci_device_cfg_read_u32 (bridge, & smram_miscc, SMRAM_MISCC);
-#else
-      PCITAG bridge;
-      long smram_miscc;
-
-      bridge = pciTag(0, 0, 0);		/* This is always the host bridge */
-      smram_miscc = pciReadLong(bridge, SMRAM_MISCC);
-#endif
 
       if ((smram_miscc & GFX_MEM_WIN_SIZE) == GFX_MEM_WIN_32M) {
 	 pI810->FbMapSize = 0x1000000;
@@ -1331,10 +1120,8 @@ I810MapMMIO(ScrnInfoPtr pScrn)
 {
    int mmioFlags;
    I810Ptr pI810 = I810PTR(pScrn);
-#if XSERVER_LIBPCIACCESS
    struct pci_device *const device = pI810->PciInfo;
    int err;
-#endif
 
 #if !defined(__alpha__)
    mmioFlags = VIDMEM_MMIO | VIDMEM_READSIDEEFFECT;
@@ -1342,7 +1129,6 @@ I810MapMMIO(ScrnInfoPtr pScrn)
    mmioFlags = VIDMEM_MMIO | VIDMEM_READSIDEEFFECT | VIDMEM_SPARSE;
 #endif
 
-#if XSERVER_LIBPCIACCESS
    err = pci_device_map_range (device,
 			       pI810->MMIOAddr,
 			       I810_REG_SIZE,
@@ -1355,13 +1141,6 @@ I810MapMMIO(ScrnInfoPtr pScrn)
 		  strerror (err), err);
       return FALSE;
    }
-#else
-   pI810->MMIOBase = xf86MapPciMem(pScrn->scrnIndex, mmioFlags,
-				   pI810->PciTag,
-				   pI810->MMIOAddr, I810_REG_SIZE);
-   if (!pI810->MMIOBase)
-      return FALSE;
-#endif
    return TRUE;
 }
 
@@ -1369,17 +1148,12 @@ static Bool
 I810MapMem(ScrnInfoPtr pScrn)
 {
    I810Ptr pI810 = I810PTR(pScrn);
-#if XSERVER_LIBPCIACCESS
    struct pci_device *const device = pI810->PciInfo;
    int err;
-#else
-   long i;
-#endif
 
    if (!I810MapMMIO(pScrn))
       return FALSE;
 
-#if XSERVER_LIBPCIACCESS
    err = pci_device_map_range (device,
 			       pI810->LinearAddr,
 			       pI810->FbMapSize,
@@ -1392,15 +1166,6 @@ I810MapMem(ScrnInfoPtr pScrn)
 		  strerror (err), err);
       return FALSE;
    }
-#else
-   for (i = 2; i < pI810->FbMapSize; i <<= 1) ;
-
-   pI810->FbBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER,
-				 pI810->PciTag,
-				 pI810->LinearAddr, i);
-   if (!pI810->FbBase)
-      return FALSE;
-#endif
 
    pI810->LpRing->virtual_start = pI810->FbBase + pI810->LpRing->mem.Start;
 
@@ -1412,12 +1177,7 @@ I810UnmapMMIO(ScrnInfoPtr pScrn)
 {
    I810Ptr pI810 = I810PTR(pScrn);
 
-#if XSERVER_LIBPCIACCESS
    pci_device_unmap_range (pI810->PciInfo, pI810->MMIOBase, I810_REG_SIZE);
-#else
-   xf86UnMapVidMem(pScrn->scrnIndex, (pointer) pI810->MMIOBase,
-		   I810_REG_SIZE);
-#endif
    pI810->MMIOBase = NULL;
 }
 
@@ -1426,12 +1186,7 @@ I810UnmapMem(ScrnInfoPtr pScrn)
 {
    I810Ptr pI810 = I810PTR(pScrn);
 
-#if XSERVER_LIBPCIACCESS
    pci_device_unmap_range (pI810->PciInfo, pI810->FbBase, pI810->FbMapSize);
-#else
-   xf86UnMapVidMem(pScrn->scrnIndex, (pointer) pI810->FbBase,
-		   pI810->FbMapSize);
-#endif
    pI810->FbBase = NULL;
    I810UnmapMMIO(pScrn);
    return TRUE;
diff --git a/src/i830.h b/src/i830.h
index a573c2d..6257e43 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -60,9 +60,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "xf86RandR12.h"
 
 #include "xorg-server.h"
-#ifdef XSERVER_LIBPCIACCESS
 #include <pciaccess.h>
-#endif
 
 #include "xf86drm.h"
 #include "sarea.h"
@@ -420,12 +418,7 @@ typedef struct _I830Rec {
    unsigned long MMIOAddr;
    IOADDRESS ioBase;
    EntityInfoPtr pEnt;
-#if XSERVER_LIBPCIACCESS
    struct pci_device *PciInfo;
-#else
-   pciVideoPtr PciInfo;
-   PCITAG PciTag;
-#endif
    uint8_t variant;
 
    unsigned int BR[20];
diff --git a/src/i830_bios.c b/src/i830_bios.c
index 4f2355d..7c51f38 100644
--- a/src/i830_bios.c
+++ b/src/i830_bios.c
@@ -218,7 +218,6 @@ i830_bios_init(ScrnInfoPtr pScrn)
     int ret;
     int size;
 
-#if XSERVER_LIBPCIACCESS
     size = pI830->PciInfo->rom_size;
     if (size == 0) {
 	size = INTEL_VBIOS_SIZE;
@@ -226,14 +225,10 @@ i830_bios_init(ScrnInfoPtr pScrn)
 		   "libpciaccess reported 0 rom size, guessing %dkB\n",
 		   size / 1024);
     }
-#else
-    size = INTEL_VBIOS_SIZE;
-#endif
     bios = xalloc(size);
     if (bios == NULL)
 	return -1;
 
-#if XSERVER_LIBPCIACCESS
     ret = pci_device_read_rom (pI830->PciInfo, bios);
     if (ret != 0) {
 	xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
@@ -242,14 +237,6 @@ i830_bios_init(ScrnInfoPtr pScrn)
 	xfree (bios);
 	return -1;
     }
-#else
-    /* xf86ReadPciBIOS returns the length read */
-    ret = xf86ReadPciBIOS(0, pI830->PciTag, 0, bios, size);
-    if (ret <= 0) {
-	xfree (bios);
-	return -1;
-    }
-#endif
 
     vbt_off = INTEL_BIOS_16(0x1a);
     if (vbt_off >= size) {
diff --git a/src/i830_display.c b/src/i830_display.c
index c1617e3..a7eafb9 100644
--- a/src/i830_display.c
+++ b/src/i830_display.c
@@ -1350,11 +1350,7 @@ i830_get_core_clock_speed(ScrnInfoPtr pScrn)
     else if (IS_I915GM(pI830)) {
 	uint16_t gcfgc;
 
-#if XSERVER_LIBPCIACCESS
       pci_device_cfg_read_u16 (pI830->PciInfo, &gcfgc, I915_GCFGC);
-#else
-      gcfgc = pciReadWord(pI830->PciTag, I915_GCFGC);
-#endif
       if (gcfgc & I915_LOW_FREQUENCY_ENABLE)
 	    return 133000;
 	else {
@@ -1369,14 +1365,9 @@ i830_get_core_clock_speed(ScrnInfoPtr pScrn)
     } else if (IS_I865G(pI830))
 	return 266000;
     else if (IS_I855(pI830)) {
-#if XSERVER_LIBPCIACCESS
         struct pci_device *bridge = intel_host_bridge ();
 	uint16_t hpllcc;
 	pci_device_cfg_read_u16 (bridge, &hpllcc, I855_HPLLCC);
-#else
-	PCITAG bridge = pciTag(0, 0, 0); /* This is always the host bridge */
-	uint16_t hpllcc = pciReadWord(bridge, I855_HPLLCC);
-#endif
 
 	/* Assume that the hardware is in the high speed state.  This
 	 * should be the default.
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 5a8c5d9..3642205 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -389,20 +389,11 @@ static int
 I830DetectMemory(ScrnInfoPtr pScrn)
 {
    I830Ptr pI830 = I830PTR(pScrn);
-#if !XSERVER_LIBPCIACCESS
-   PCITAG bridge;
-#endif
    uint16_t gmch_ctrl;
    int memsize = 0, gtt_size;
    int range;
-
-#if XSERVER_LIBPCIACCESS
    struct pci_device *bridge = intel_host_bridge ();
    pci_device_cfg_read_u16(bridge, & gmch_ctrl, I830_GMCH_CTRL);
-#else
-   bridge = pciTag(0, 0, 0);		/* This is always the host bridge */
-   gmch_ctrl = pciReadWord(bridge, I830_GMCH_CTRL);
-#endif
 
    if (IS_I965G(pI830)) {
       /* The 965 may have a GTT that is actually larger than is necessary
@@ -547,15 +538,10 @@ I830DetectMemory(ScrnInfoPtr pScrn)
 static Bool
 I830MapMMIO(ScrnInfoPtr pScrn)
 {
-#if XSERVER_LIBPCIACCESS
    int err;
    struct pci_device *device;
-#else
-   int mmioFlags;
-#endif
    I830Ptr pI830 = I830PTR(pScrn);
 
-#if XSERVER_LIBPCIACCESS
    device = pI830->PciInfo;
    err = pci_device_map_range (device,
 			       pI830->MMIOAddr,
@@ -569,20 +555,6 @@ I830MapMMIO(ScrnInfoPtr pScrn)
 		  strerror (err), err);
       return FALSE;
    }
-#else
-
-#if !defined(__alpha__)
-   mmioFlags = VIDMEM_MMIO | VIDMEM_READSIDEEFFECT;
-#else
-   mmioFlags = VIDMEM_MMIO | VIDMEM_READSIDEEFFECT | VIDMEM_SPARSE;
-#endif
-
-   pI830->MMIOBase = xf86MapPciMem(pScrn->scrnIndex, mmioFlags,
-				   pI830->PciTag,
-				   pI830->MMIOAddr, I810_REG_SIZE);
-   if (!pI830->MMIOBase)
-      return FALSE;
-#endif
 
    /* Set up the GTT mapping for the various places it has been moved over
     * time.
@@ -605,7 +577,6 @@ I830MapMMIO(ScrnInfoPtr pScrn)
 	 gttaddr = I810_MEMBASE(pI830->PciInfo, 3) & 0xFFFFFF00;
 	 pI830->GTTMapSize = pI830->FbMapSize / 1024;
       }
-#if XSERVER_LIBPCIACCESS
       err = pci_device_map_range (device,
 				  gttaddr, pI830->GTTMapSize,
 				  PCI_DEV_MAP_FLAG_WRITABLE,
@@ -617,13 +588,6 @@ I830MapMMIO(ScrnInfoPtr pScrn)
 		     strerror (err), err);
 	 return FALSE;
       }
-#else
-      pI830->GTTBase = xf86MapPciMem(pScrn->scrnIndex, mmioFlags,
-				     pI830->PciTag,
-				     gttaddr, pI830->GTTMapSize);
-      if (pI830->GTTBase == NULL)
-	 return FALSE;
-#endif
    } else {
       /* The GTT aperture on i830 is write-only.  We could probably map the
        * actual physical pages that back it, but leave it alone for now.
@@ -640,27 +604,17 @@ I830MapMem(ScrnInfoPtr pScrn)
 {
    I830Ptr pI830 = I830PTR(pScrn);
    long i;
-#if XSERVER_LIBPCIACCESS
    struct pci_device *const device = pI830->PciInfo;
    int err;
-#endif
 
    for (i = 2; i < pI830->FbMapSize; i <<= 1) ;
    pI830->FbMapSize = i;
 
-#if XSERVER_LIBPCIACCESS
    err = pci_device_map_range (device, pI830->LinearAddr, pI830->FbMapSize,
 			       PCI_DEV_MAP_FLAG_WRITABLE | PCI_DEV_MAP_FLAG_WRITE_COMBINE,
 			       (void **) &pI830->FbBase);
     if (err)
 	return FALSE;
-#else
-   pI830->FbBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER,
-				 pI830->PciTag,
-				 pI830->LinearAddr, pI830->FbMapSize);
-   if (!pI830->FbBase)
-      return FALSE;
-#endif
 
    if (pI830->ring.mem != NULL) {
       pI830->ring.virtual_start = pI830->FbBase + pI830->ring.mem->offset;
@@ -674,20 +628,11 @@ I830UnmapMMIO(ScrnInfoPtr pScrn)
 {
    I830Ptr pI830 = I830PTR(pScrn);
 
-#if XSERVER_LIBPCIACCESS
    pci_device_unmap_range (pI830->PciInfo, pI830->MMIOBase, I810_REG_SIZE);
-#else
-   xf86UnMapVidMem(pScrn->scrnIndex, (pointer) pI830->MMIOBase,
-		   I810_REG_SIZE);
-#endif
    pI830->MMIOBase = NULL;
 
    if (IS_I9XX(pI830)) {
-#if XSERVER_LIBPCIACCESS
       pci_device_unmap_range (pI830->PciInfo, pI830->GTTBase, pI830->GTTMapSize);
-#else
-      xf86UnMapVidMem(pScrn->scrnIndex, pI830->GTTBase, pI830->GTTMapSize);
-#endif
       pI830->GTTBase = NULL;
    }
 }
@@ -697,12 +642,7 @@ I830UnmapMem(ScrnInfoPtr pScrn)
 {
    I830Ptr pI830 = I830PTR(pScrn);
 
-#if XSERVER_LIBPCIACCESS
    pci_device_unmap_range (pI830->PciInfo, pI830->FbBase, pI830->FbMapSize);
-#else
-   xf86UnMapVidMem(pScrn->scrnIndex, (pointer) pI830->FbBase,
-		   pI830->FbMapSize);
-#endif
    pI830->FbBase = NULL;
    I830UnmapMMIO(pScrn);
    return TRUE;
@@ -1179,11 +1119,7 @@ i830SetHotkeyControl(ScrnInfoPtr pScrn, int mode)
  */
 static Bool i830_kernel_mode_enabled(ScrnInfoPtr pScrn)
 {
-#if XSERVER_LIBPCIACCESS
     struct pci_device *PciInfo;
-#else
-    pciVideoPtr PciInfo;
-#endif
     EntityInfoPtr pEnt;
     char *busIdString;
     int ret;
@@ -1227,11 +1163,7 @@ i830_detect_chipset(ScrnInfoPtr pScrn)
 	break;
     case PCI_CHIP_I855_GM:
 	/* Check capid register to find the chipset variant */
-#if XSERVER_LIBPCIACCESS
 	pci_device_cfg_read_u32 (pI830->PciInfo, &capid, I85X_CAPID);
-#else
-	capid = pciReadLong (pI830->PciTag, I85X_CAPID);
-#endif
 	pI830->variant = (capid >> I85X_VARIANT_SHIFT) & I85X_VARIANT_MASK;
 	switch (pI830->variant) {
 	case I855_GM:
@@ -1410,19 +1342,11 @@ i830_detect_chipset(ScrnInfoPtr pScrn)
 
     /* Now figure out mapsize on 8xx chips */
     if (IS_I830(pI830) || IS_845G(pI830)) {
-#if XSERVER_LIBPCIACCESS
 	uint16_t		gmch_ctrl;
 	struct pci_device *bridge;
 
 	bridge = intel_host_bridge ();
 	pci_device_cfg_read_u16 (bridge, &gmch_ctrl, I830_GMCH_CTRL);
-#else
-	PCITAG bridge;
-	uint16_t gmch_ctrl;
-
-	bridge = pciTag(0, 0, 0);		/* This is always the host bridge */
-	gmch_ctrl = pciReadWord(bridge, I830_GMCH_CTRL);
-#endif
 	if ((gmch_ctrl & I830_GMCH_MEM_MASK) == I830_GMCH_MEM_128M) {
 	    pI830->FbMapSize = 0x8000000;
 	} else {
@@ -1430,12 +1354,7 @@ i830_detect_chipset(ScrnInfoPtr pScrn)
 	}
     } else {
 	if (IS_I9XX(pI830)) {
-#if XSERVER_LIBPCIACCESS
 	    pI830->FbMapSize = pI830->PciInfo->regions[fb_bar].size;
-#else
-	    pI830->FbMapSize = 1UL << pciGetBaseSize(pI830->PciTag, 2, TRUE,
-						     NULL);
-#endif
 	} else {
 	    /* 128MB aperture for later i8xx series. */
 	    pI830->FbMapSize = 0x8000000;
@@ -1726,10 +1645,6 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
       return FALSE;
 
    pI830->PciInfo = xf86GetPciInfoForEntity(pI830->pEnt->index);
-#if !XSERVER_LIBPCIACCESS
-   pI830->PciTag = pciTag(pI830->PciInfo->bus, pI830->PciInfo->device,
-			  pI830->PciInfo->func);
-#endif
 
    if (xf86RegisterResources(pI830->pEnt->index, NULL, ResNone)) {
       PreInitCleanup(pScrn);
diff --git a/src/i830_lvds.c b/src/i830_lvds.c
index 7fc0bce..064810f 100644
--- a/src/i830_lvds.c
+++ b/src/i830_lvds.c
@@ -207,12 +207,8 @@ i830_lvds_set_backlight_legacy(xf86OutputPtr output, int level)
     ScrnInfoPtr pScrn = output->scrn;
     I830Ptr pI830 = I830PTR(pScrn);
 
-#if XSERVER_LIBPCIACCESS
     pci_device_cfg_write_u8(pI830->PciInfo, level,
 			    LEGACY_BACKLIGHT_BRIGHTNESS);
-#else
-    pciWriteByte(pI830->PciTag, LEGACY_BACKLIGHT_BRIGHTNESS, level);
-#endif
 }
 
 static int
@@ -222,11 +218,7 @@ i830_lvds_get_backlight_legacy(xf86OutputPtr output)
     I830Ptr pI830 = I830PTR(pScrn);
     uint8_t lbb;
 
-#if XSERVER_LIBPCIACCESS
     pci_device_cfg_read_u8(pI830->PciInfo, &lbb, LEGACY_BACKLIGHT_BRIGHTNESS);
-#else
-    lbb = pciReadByte(pI830->PciTag, LEGACY_BACKLIGHT_BRIGHTNESS);
-#endif
 
     return lbb;
 }
@@ -242,22 +234,14 @@ i830_lvds_set_backlight_combo(xf86OutputPtr output, int level)
     uint32_t blc_pwm_ctl;
     uint8_t lbb;
 
-#if XSERVER_LIBPCIACCESS
     pci_device_cfg_read_u8(pI830->PciInfo, &lbb, LEGACY_BACKLIGHT_BRIGHTNESS);
-#else
-    lbb = pciReadByte(pI830->PciTag, LEGACY_BACKLIGHT_BRIGHTNESS);
-#endif
     /*
      * If LBB is zero and we're shooting for a non-zero brightness level,
      * we have to increase LBB by at least 1.
      */
     if (!lbb && level) {
-#if XSERVER_LIBPCIACCESS
 	pci_device_cfg_write_u8(pI830->PciInfo, 1,
 				LEGACY_BACKLIGHT_BRIGHTNESS);
-#else
-	pciWriteByte(pI830->PciTag, LEGACY_BACKLIGHT_BRIGHTNESS, 1);
-#endif
     }
 
     /*
diff --git a/src/reg_dumper/gtt.c b/src/reg_dumper/gtt.c
index ead5935..4a46f11 100644
--- a/src/reg_dumper/gtt.c
+++ b/src/reg_dumper/gtt.c
@@ -59,9 +59,9 @@ int main(int argc, char **argv)
 	else {
 		/* 915/945 chips has GTT range in bar 3*/
 		int err = 0;
-		err = pci_device_map_range (pI830->pci_dev,
-				pI830->pci_dev->regions[3].base_addr,
-				pI830->pci_dev->regions[3].size,
+		err = pci_device_map_range (pI830->PciInfo,
+				pI830->PciInfo->regions[3].base_addr,
+				pI830->PciInfo->regions[3].size,
 				PCI_DEV_MAP_FLAG_WRITABLE,
 				(void **)&gtt);
 		if (err != 0) {
@@ -70,7 +70,7 @@ int main(int argc, char **argv)
 		}
 	}
 
-	aper_size = pI830->pci_dev->regions[2].size;
+	aper_size = pI830->PciInfo->regions[2].size;
 
 	for (start = 0; start < aper_size; start += KB(4)) {
 		uint32_t start_pte = INGTT(start);
diff --git a/src/reg_dumper/hotplug.c b/src/reg_dumper/hotplug.c
index 68fe584..de46384 100644
--- a/src/reg_dumper/hotplug.c
+++ b/src/reg_dumper/hotplug.c
@@ -72,10 +72,7 @@ int main(int argc, char **argv)
     if (dev->vendor_id != 0x8086)
 	errx(1, "Graphics card is non-intel");
 
-    i830.PciInfo = &i830.pci_info_rec;
-    i830.PciInfo->chipType = dev->device_id;
-
-    i830.pci_dev = dev;
+    i830.PciInfo = dev;
 
     mmio_bar = IS_I9XX((&i830)) ? 0 : 1;
 
diff --git a/src/reg_dumper/idle.c b/src/reg_dumper/idle.c
index 8d60c0c..cbd68aa 100644
--- a/src/reg_dumper/idle.c
+++ b/src/reg_dumper/idle.c
@@ -142,10 +142,7 @@ int main(int argc, char **argv)
     if (dev->vendor_id != 0x8086)
 	errx(1, "Graphics card is non-intel");
 
-    i830.PciInfo = &i830.pci_info_rec;
-    i830.PciInfo->chipType = dev->device_id;
-
-    i830.pci_dev = dev;
+    i830.PciInfo = dev;
 
     mmio_bar = IS_I9XX((&i830)) ? 0 : 1;
 
diff --git a/src/reg_dumper/main.c b/src/reg_dumper/main.c
index 5c8ef9e..ce883ef 100644
--- a/src/reg_dumper/main.c
+++ b/src/reg_dumper/main.c
@@ -29,7 +29,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <stdarg.h>
-#include <pciaccess.h>
 #include <err.h>
 
 #include "reg_dumper.h"
@@ -62,10 +61,7 @@ int main(int argc, char **argv)
     if (dev->vendor_id != 0x8086)
 	errx(1, "Graphics card is non-intel");
 
-    i830.PciInfo = &i830.pci_info_rec;
-    i830.PciInfo->chipType = dev->device_id;
-
-    i830.pci_dev = dev;
+    i830.PciInfo = dev;
 
     mmio_bar = IS_I9XX((&i830)) ? 0 : 1;
 
diff --git a/src/reg_dumper/reg_dumper.h b/src/reg_dumper/reg_dumper.h
index 9f24d5c..8c2eb0b 100644
--- a/src/reg_dumper/reg_dumper.h
+++ b/src/reg_dumper/reg_dumper.h
@@ -29,6 +29,7 @@
 #include <string.h>
 #include <stdlib.h>
 #include <stdio.h>
+#include <pciaccess.h>
 #include "common.h"
 
 /** @file
@@ -45,18 +46,12 @@ typedef char Bool;
 #define X_WARNING 1
 #define X_ERROR 2
 
-struct pci_info_rec {
-    uint16_t chipType;
-};
-
 typedef struct _i830 {
     /* Fields in common with the real pI830 */
-    struct pci_info_rec *PciInfo;
+    struct pci_device *PciInfo;
     Bool use_drm_mode;
 
     /* Fields used for setting up reg_dumper */
-    struct pci_device *pci_dev;
-    struct pci_info_rec pci_info_rec;
     volatile unsigned char *mmio;
 } I830Rec, *I830Ptr;
 
diff --git a/src/reg_dumper/util.c b/src/reg_dumper/util.c
index 6dd1e48..4d6380e 100644
--- a/src/reg_dumper/util.c
+++ b/src/reg_dumper/util.c
@@ -65,10 +65,7 @@ void intel_i830rec_init(I830Ptr pI830)
     if (dev->vendor_id != 0x8086)
 	errx(1, "Graphics card is non-intel");
 
-    pI830->PciInfo = &pI830->pci_info_rec;
-    pI830->PciInfo->chipType = dev->device_id;
-
-    pI830->pci_dev = dev;
+    pI830->PciInfo = dev;
 
     mmio_bar = IS_I9XX(pI830) ? 0 : 1;
 
commit 4653a7db622ad54a3182d93c81331765d930db34
Author: Eric Anholt <eric at anholt.net>
Date:   Mon Apr 20 22:05:54 2009 -0700

    Rely on BO pixmaps being present in acceleration paths.

diff --git a/src/i830_batchbuffer.h b/src/i830_batchbuffer.h
index 81e84e2..6e0aaa7 100644
--- a/src/i830_batchbuffer.h
+++ b/src/i830_batchbuffer.h
@@ -102,16 +102,9 @@ intel_batch_emit_reloc_pixmap(I830Ptr pI830, PixmapPtr pPixmap,
 			      uint32_t delta)
 {
     dri_bo *bo = i830_get_pixmap_bo(pPixmap);
-    uint32_t offset;
     assert(pI830->batch_ptr != NULL);
     assert(intel_batch_space(pI830) >= 4);
-    if (bo) {
-	intel_batch_emit_reloc(pI830, bo, read_domains, write_domain, delta);
-	return;
-    }
-    offset = intel_get_pixmap_offset(pPixmap);
-    *(uint32_t *)(pI830->batch_ptr + pI830->batch_used) = offset + delta;
-    pI830->batch_used += 4;
+    intel_batch_emit_reloc(pI830, bo, read_domains, write_domain, delta);
 }
 
 #define OUT_BATCH(dword) intel_batch_emit_dword(pI830, dword)
diff --git a/src/i965_render.c b/src/i965_render.c
index e527f11..7583af1 100644
--- a/src/i965_render.c
+++ b/src/i965_render.c
@@ -923,6 +923,7 @@ i965_set_picture_surface_state(dri_bo *ss_bo, int ss_index,
     struct brw_surface_state_padded *ss;
     struct brw_surface_state local_ss;
     dri_bo *pixmap_bo = i830_get_pixmap_bo(pPixmap);
+    uint32_t write_domain, read_domains;
 
     ss = (struct brw_surface_state_padded *)ss_bo->virtual + ss_index;
 
@@ -952,10 +953,7 @@ i965_set_picture_surface_state(dri_bo *ss_bo, int ss_index,
     local_ss.ss0.vert_line_stride_ofs = 0;
     local_ss.ss0.mipmap_layout_mode = 0;
     local_ss.ss0.render_cache_read_mode = 0;
-    if (pixmap_bo != NULL)
-	local_ss.ss1.base_addr = pixmap_bo->offset;
-    else
-	local_ss.ss1.base_addr = intel_get_pixmap_offset(pPixmap);
+    local_ss.ss1.base_addr = pixmap_bo->offset;
 
     local_ss.ss2.mip_count = 0;
     local_ss.ss2.render_target_rotation = 0;
@@ -967,22 +965,20 @@ i965_set_picture_surface_state(dri_bo *ss_bo, int ss_index,
 
     memcpy(ss, &local_ss, sizeof(local_ss));
 
-    if (pixmap_bo != NULL) {
-	uint32_t write_domain, read_domains;
 
-	if (is_dst) {
-	    write_domain = I915_GEM_DOMAIN_RENDER;
-	    read_domains = I915_GEM_DOMAIN_RENDER;
-	} else {
-	    write_domain = 0;
-	    read_domains = I915_GEM_DOMAIN_SAMPLER;
-	}
-	dri_bo_emit_reloc(ss_bo, read_domains, write_domain,
-			  0,
-			  ss_index * sizeof(*ss) +
-			  offsetof(struct brw_surface_state, ss1),
-			  pixmap_bo);
+    if (is_dst) {
+	write_domain = I915_GEM_DOMAIN_RENDER;
+	read_domains = I915_GEM_DOMAIN_RENDER;
+    } else {
+	write_domain = 0;
+	read_domains = I915_GEM_DOMAIN_SAMPLER;
     }
+    drm_intel_bo_emit_reloc(ss_bo,
+			    ss_index * sizeof(*ss) +
+			    offsetof(struct brw_surface_state, ss1),
+			    pixmap_bo,
+			    0,
+			    read_domains, write_domain);
 }
 
 static void
commit 1784efc1f0c74edda8c78fb1b0cdd989f0a088ad
Author: Eric Anholt <eric at anholt.net>
Date:   Mon Apr 20 18:25:59 2009 -0700

    Remove XF86DRM_MODE.
    
    We now depend on server 1.6 and current libdrm, so no need to ifdef it.

diff --git a/configure.ac b/configure.ac
index 18fe983..14a1c6b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -163,13 +163,6 @@ if test "$DRI" = yes; then
         AC_DEFINE(XF86DRI_DEVEL,1,[Enable developmental DRI driver support])
 fi
 
-dnl Server 1.5's set_mode_major required for DRM_MODE.
-PKG_CHECK_MODULES(DRM_MODE, [xorg-server >= 1.5],
-		 [DRM_MODE=yes], [DRM_MODE=no])
-if test "x$DRM_MODE" = xyes; then
-	AC_DEFINE(XF86DRM_MODE,1,[DRM kernel modesetting])
-fi
-
 AM_CONDITIONAL(VIDEO_DEBUG, test x$VIDEO_DEBUG = xyes)
 if test "$VIDEO_DEBUG" = yes; then
 	AC_DEFINE(VIDEO_DEBUG,1,[Enable debug support])
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 298c471..15ffc29 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -31,7 +31,6 @@
 
 #include "xorgVersion.h"
 
-#ifdef XF86DRM_MODE
 #include "i830.h"
 #include "intel_bufmgr.h"
 #include "xf86drmMode.h"
@@ -921,5 +920,3 @@ Bool drmmode_pre_init(ScrnInfoPtr pScrn, int fd, int cpp)
 
 	return TRUE;
 }
-
-#endif
diff --git a/src/i830.h b/src/i830.h
index 8d51f2c..a573c2d 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -685,9 +685,7 @@ i830_pipe_a_require_deactivate (ScrnInfoPtr scrn);
 Bool I830DRI2ScreenInit(ScreenPtr pScreen);
 void I830DRI2CloseScreen(ScreenPtr pScreen);
 
-#ifdef XF86DRM_MODE
 extern Bool drmmode_pre_init(ScrnInfoPtr pScrn, int fd, int cpp);
-#endif
 
 extern Bool I830AccelInit(ScreenPtr pScreen);
 extern void I830SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir,
diff --git a/src/i830_dri.c b/src/i830_dri.c
index 745162d..743521c 100644
--- a/src/i830_dri.c
+++ b/src/i830_dri.c
@@ -387,15 +387,10 @@ Bool I830DRI2ScreenInit(ScreenPtr pScreen)
 	    pI830->PciInfo->dev,
 	    pI830->PciInfo->func);
 
-    info.fd = -1;
-
-#ifdef XF86DRM_MODE
     /* Use the already opened (master) fd from modesetting */
-    if (pI830->use_drm_mode)
+    if (pI830->use_drm_mode) {
 	info.fd = pI830->drmSubFD;
-#endif
-
-    if (info.fd < 0) {
+    } else {
 	info.fd = drmOpen("i915", buf);
 	drmSetVersion sv;
 	int err;
diff --git a/src/i830_driver.c b/src/i830_driver.c
index b4111d3..5a8c5d9 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -208,10 +208,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 #include <sys/ioctl.h>
 #include "i915_drm.h"
-
-#ifdef XF86DRM_MODE
 #include <xf86drmMode.h>
-#endif
 
 #define BIT(x) (1 << (x))
 #define MAX(a,b) ((a) > (b) ? (a) : (b))
@@ -1176,7 +1173,6 @@ i830SetHotkeyControl(ScrnInfoPtr pScrn, int mode)
    pI830->writeControl(pI830, GRX, 0x18, gr18);
 }
 
-#ifdef XF86DRM_MODE
 /*
  * DRM mode setting Linux only at this point... later on we could
  * add a wrapper here.
@@ -1207,9 +1203,6 @@ static Bool i830_kernel_mode_enabled(ScrnInfoPtr pScrn)
 
     return TRUE;
 }
-#else
-#define i830_kernel_mode_enabled(x) FALSE
-#endif
 
 static Bool
 i830_detect_chipset(ScrnInfoPtr pScrn)
@@ -1620,7 +1613,6 @@ I830AccelMethodInit(ScrnInfoPtr pScrn)
 static Bool
 I830DrmModeInit(ScrnInfoPtr pScrn)
 {
-#ifdef XF86DRM_MODE
     I830Ptr pI830 = I830PTR(pScrn);
     char *bus_id;
     int ret;
@@ -1651,7 +1643,6 @@ I830DrmModeInit(ScrnInfoPtr pScrn)
     pI830->directRenderingType = DRI_NONE;
 
     i830_init_bufmgr(pScrn);
-#endif
 
     return TRUE;
 }
@@ -2767,10 +2758,8 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
    }
 
    if (pI830->use_drm_mode) {
-#ifdef XF86DRM_MODE
        pI830->stolen_size = 0;
        pScrn->videoRam = ~0UL / KB(1);
-#endif
    } else {
        I830AdjustMemory(pScreen);
    }
commit d82ea4372fb74654eb0f37d996977003473846ed
Author: Eric Anholt <eric at anholt.net>
Date:   Mon Apr 20 13:20:03 2009 -0700

    Replace I830Sync's irq emit/wait code with bufmgr use.
    
    This pre-GEM code was all sorts of broken -- see intel_bufmgr_fake.c for
    the hoops that must be jumped to use that kernel interface successfully.
    Yet we continued to use it even with KMS/DRI2/UXA, which may account for
    some hangs.

diff --git a/src/i830.h b/src/i830.h
index 7b01018..8d51f2c 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -385,6 +385,7 @@ typedef struct _I830Rec {
    /** Number of bytes to be emitted in the current BEGIN_BATCH. */
    uint32_t batch_emitting;
    dri_bo *batch_bo;
+   dri_bo *last_batch_bo;
    /** Whether we're in a section of code that can't tolerate flushing */
    Bool in_batch_atomic;
    /** Ending batch_used that was verified by i830_start_batch_atomic() */
diff --git a/src/i830_accel.c b/src/i830_accel.c
index c2f30a8..589f86d 100644
--- a/src/i830_accel.c
+++ b/src/i830_accel.c
@@ -156,36 +156,7 @@ I830Sync(ScrnInfoPtr pScrn)
    I830EmitFlush(pScrn);
 
    intel_batch_flush(pScrn, TRUE);
-
-   if (pI830->directRenderingType > DRI_NONE) {
-       struct drm_i915_irq_emit emit;
-       struct drm_i915_irq_wait wait;
-       int ret;
-
-       /* Most of the uses of I830Sync while using GEM should actually be
-	* using set_domain on a specific buffer.  We're not there yet, so fake
-	* it up using irq_emit/wait.  It's still better than spinning on
-	* register reads for idle.
-	*/
-       emit.irq_seq = &wait.irq_seq;
-       ret = drmCommandWriteRead(pI830->drmSubFD, DRM_I830_IRQ_EMIT, &emit,
-			    sizeof(emit));
-       if (ret != 0)
-	   FatalError("Failure to emit IRQ: %s\n", strerror(-ret));
-
-       do {
-	   ret = drmCommandWrite(pI830->drmSubFD, DRM_I830_IRQ_WAIT, &wait,
-				 sizeof(wait));
-       } while (ret == -EINTR);
-
-       if (ret != 0)
-	   FatalError("Failure to wait for IRQ: %s\n", strerror(-ret));
-
-       if (!pI830->memory_manager)
-	   i830_refresh_ring(pScrn);
-   } else if (!pI830->use_drm_mode) {
-       i830_wait_ring_idle(pScrn);
-   }
+   intel_batch_wait_last(pScrn);
 }
 
 void
diff --git a/src/i830_batchbuffer.c b/src/i830_batchbuffer.c
index ff5f0c2..5a9f9c5 100644
--- a/src/i830_batchbuffer.c
+++ b/src/i830_batchbuffer.c
@@ -159,8 +159,13 @@ intel_batch_teardown(ScrnInfoPtr pScrn)
 
     if (pI830->batch_ptr != NULL) {
 	dri_bo_unmap(pI830->batch_bo);
-	dri_bo_unreference(pI830->batch_bo);
 	pI830->batch_ptr = NULL;
+
+	dri_bo_unreference(pI830->batch_bo);
+	pI830->batch_bo = NULL;
+
+	dri_bo_unreference(pI830->last_batch_bo);
+	pI830->last_batch_bo = NULL;
     }
 }
 
@@ -201,7 +206,13 @@ intel_batch_flush(ScrnInfoPtr pScrn, Bool flushed)
     if (ret != 0)
 	FatalError("Failed to submit batchbuffer: %s\n", strerror(-ret));
 
-    dri_bo_unreference(pI830->batch_bo);
+    /* Save a ref to the last batch emitted, which we use for syncing
+     * in debug code.
+     */
+    dri_bo_unreference(pI830->last_batch_bo);
+    pI830->last_batch_bo = pI830->batch_bo;
+    pI830->batch_bo = NULL;
+
     intel_next_batch(pScrn);
 
     /* Mark that we need to flush whatever potential rendering we've done in the
@@ -214,3 +225,17 @@ intel_batch_flush(ScrnInfoPtr pScrn, Bool flushed)
     if (pI830->batch_flush_notify)
 	pI830->batch_flush_notify (pScrn);
 }
+
+/** Waits on the last emitted batchbuffer to be completed. */
+void
+intel_batch_wait_last(ScrnInfoPtr scrn)
+{
+    I830Ptr pI830 = I830PTR(scrn);
+
+    /* Map it CPU write, which guarantees it's done.  This is a completely
+     * non performance path, so we don't need anything better.
+     */
+    drm_intel_bo_map(pI830->last_batch_bo, TRUE);
+    drm_intel_bo_unmap(pI830->last_batch_bo);
+}
+
diff --git a/src/i830_batchbuffer.h b/src/i830_batchbuffer.h
index d011417..81e84e2 100644
--- a/src/i830_batchbuffer.h
+++ b/src/i830_batchbuffer.h
@@ -35,6 +35,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 void intel_batch_init(ScrnInfoPtr pScrn);
 void intel_batch_teardown(ScrnInfoPtr pScrn);
 void intel_batch_flush(ScrnInfoPtr pScrn, Bool flushed);
+void intel_batch_wait_last(ScrnInfoPtr pScrn);
 
 static inline int
 intel_batch_space(I830Ptr pI830)
commit 612c1f1f1859ce0cef41049d79cc473657d48612
Author: Eric Anholt <eric at anholt.net>
Date:   Mon Apr 20 16:16:48 2009 -0700

    Remove I830_XV ifdef.
    
    The developers of the driver don't ever run or test without XV.  Don't do it.

diff --git a/src/Makefile.am b/src/Makefile.am
index c4b9ab0..221b669 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -31,8 +31,7 @@ SUBDIRS = xvmc bios_reader ch7017 ch7xxx ivch sil164 tfp410 $(REGDUMPER)
 # TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc.
 
 AM_CFLAGS = @WARN_CFLAGS@ @XORG_CFLAGS@ @DRM_CFLAGS@ @DRI_CFLAGS@ \
-	@PCIACCESS_CFLAGS@ -I$(top_srcdir)/uxa \
-	-DI830_XV
+	@PCIACCESS_CFLAGS@ -I$(top_srcdir)/uxa
 
 intel_drv_la_LTLIBRARIES = intel_drv.la
 intel_drv_la_LDFLAGS = -module -avoid-version
diff --git a/src/i830.h b/src/i830.h
index 73b0712..7b01018 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -390,11 +390,9 @@ typedef struct _I830Rec {
    /** Ending batch_used that was verified by i830_start_batch_atomic() */
    int batch_atomic_limit;
 
-#ifdef I830_XV
    /* For Xvideo */
    i830_memory *overlay_regs;
    void *offscreenImages;          /**< remembered memory block for release */
-#endif
 #ifdef INTEL_XVMC
    /* For XvMC */
    Bool XvMCEnabled;
@@ -455,7 +453,6 @@ typedef struct _I830Rec {
    Bool XvEnabled;			/* Xv enabled for this generation. */
    Bool XvPreferOverlay;
 
-#ifdef I830_XV
    int colorKey;
    XF86VideoAdaptorPtr adaptor;
    ScreenBlockHandlerProcPtr BlockHandler;
@@ -471,7 +468,6 @@ typedef struct _I830Rec {
       drm_intel_bo *gen4_sampler_bo;
       drm_intel_bo *gen4_sip_kernel_bo;
    } video;
-#endif
 
    /* Render accel state */
    float scale_units[2][2];
@@ -671,10 +667,8 @@ i830_crtc_set_cursor_colors (xf86CrtcPtr crtc, int bg, int fg);
 extern void i830_refresh_ring(ScrnInfoPtr pScrn);
 extern void I830EmitFlush(ScrnInfoPtr pScrn);
 
-#ifdef I830_XV
 extern void I830InitVideo(ScreenPtr pScreen);
 extern void i830_crtc_dpms_video(xf86CrtcPtr crtc, Bool on);
-#endif
 
 int
 i830_crtc_pipe (xf86CrtcPtr crtc);
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 4fa61c9..b4111d3 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -1664,7 +1664,6 @@ I830XvInit(ScrnInfoPtr pScrn)
 
    pI830->XvPreferOverlay = xf86ReturnOptValBool(pI830->Options, OPTION_PREFER_OVERLAY, FALSE);
 
-#ifdef I830_XV
     if (xf86GetOptValInteger(pI830->Options, OPTION_VIDEO_KEY,
 			     &(pI830->colorKey))) {
 	from = X_CONFIG;
@@ -1680,7 +1679,6 @@ I830XvInit(ScrnInfoPtr pScrn)
     }
     xf86DrvMsg(pScrn->scrnIndex, from, "video overlay key set to 0x%x\n",
 	       pI830->colorKey);
-#endif
 }
 
 /**
@@ -2821,14 +2819,11 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
    pI830->last_3d = LAST_3D_OTHER;
    pI830->overlayOn = FALSE;
 
-#ifdef I830_XV
     /*
      * Set this so that the overlay allocation is factored in when
      * appropriate.
      */
     pI830->XvEnabled = TRUE;
-#endif
-
 
    /* Need MMIO mapped to do GTT lookups during memory allocation. */
    if (!pI830->use_drm_mode)
@@ -2861,15 +2856,11 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
    if (!miSetPixmapDepths())
       return FALSE;
 
-#ifdef I830_XV
    if (pI830->accel == ACCEL_NONE) {
       xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Xv is disabled because it "
 		 "needs 2D acceleration.\n");
       pI830->XvEnabled = FALSE;
    }
-#else
-   pI830->XvEnabled = FALSE;
-#endif
 
    if (pI830->accel != ACCEL_NONE && !pI830->use_drm_mode) {
       if (pI830->memory_manager == NULL && pI830->ring.mem->size == 0) {
@@ -2983,7 +2974,6 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
 
    xf86DPMSInit(pScreen, xf86DPMSSet, 0);
 
-#ifdef I830_XV
 #ifdef INTEL_XVMC
     pI830->XvMCEnabled = FALSE;
     from =  xf86GetOptValBool(pI830->Options, OPTION_XVMC,
@@ -2994,7 +2984,6 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
    /* Init video */
    if (pI830->XvEnabled)
       I830InitVideo(pScreen);
-#endif
 
    /* Setup 3D engine, needed for rotation too */
    IntelEmitInvarientState(pScrn);
@@ -3330,11 +3319,9 @@ I830CloseScreen(int scrnIndex, ScreenPtr pScreen)
 
    i830_allocator_fini(pScrn);
 
-#ifdef I830_XV
    i965_free_video(pScrn);
    free(pI830->offscreenImages);
    pI830->offscreenImages = NULL;
-#endif
 
    dri_bufmgr_destroy(pI830->bufmgr);
    pI830->bufmgr = NULL;
diff --git a/src/i830_memory.c b/src/i830_memory.c
index 147fca3..52ec872 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -999,7 +999,6 @@ i830_allocate_ringbuffer(ScrnInfoPtr pScrn)
     return TRUE;
 }
 
-#ifdef I830_XV
 /**
  * Allocate space for overlay registers.
  */
@@ -1037,7 +1036,6 @@ i830_allocate_overlay(ScrnInfoPtr pScrn)
 
     return TRUE;
 }
-#endif
 
 static Bool
 IsTileable(ScrnInfoPtr pScrn, int pitch)
@@ -1311,10 +1309,8 @@ i830_allocate_2d_memory(ScrnInfoPtr pScrn)
 	}
     }
 
-#ifdef I830_XV
     if (!pI830->use_drm_mode)
 	i830_allocate_overlay(pScrn);
-#endif
 
     pI830->front_buffer = i830_allocate_framebuffer(pScrn);
     if (pI830->front_buffer == NULL)
commit af6892f2b873dd508994d8bbf3d67e719b535e35
Author: Eric Anholt <eric at anholt.net>
Date:   Mon Apr 20 16:07:05 2009 -0700

    Replace i830WaitSync with just I830Sync(), as nearly all callers had it wrong.
    
    People were trying to BEGIN_BATCH()/ADVANCE_BATCH() then i830WaitSync on the
    results, which wouldn't necessarily wait and lead to various painful bugs,
    since only EXA called MarkSync and only for certain rendering operations.

diff --git a/src/i830.h b/src/i830.h
index d2307f6..73b0712 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -440,7 +440,6 @@ typedef struct _I830Rec {
 
    uxa_driver_t *uxa_driver;
    Bool need_flush;
-   Bool need_sync;
    PixmapPtr pSrcPixmap;
    int accel_pixmap_pitch_alignment;
    int accel_pixmap_offset_alignment;
@@ -758,9 +757,6 @@ void i830_hdmi_init(ScrnInfoPtr pScrn, int output_reg);
 /* i830_lvds.c */
 void i830_lvds_init(ScrnInfoPtr pScrn);
 
-extern void i830MarkSync(ScrnInfoPtr pScrn);
-extern void i830WaitSync(ScrnInfoPtr pScrn);
-
 /* i830_memory.c */
 Bool i830_bind_all_memory(ScrnInfoPtr pScrn);
 Bool i830_unbind_all_memory(ScrnInfoPtr pScrn);
diff --git a/src/i830_display.c b/src/i830_display.c
index c8e94ff..c1617e3 100644
--- a/src/i830_display.c
+++ b/src/i830_display.c
@@ -1266,8 +1266,10 @@ i830_crtc_dpms(xf86CrtcPtr crtc, int mode)
 static Bool
 i830_crtc_lock (xf86CrtcPtr crtc)
 {
-    /* Sync the engine before mode switch */
-    i830WaitSync(crtc->scrn);
+    /* Sync the engine before mode switch, to finish any outstanding
+     * WAIT_FOR_EVENTS that may rely on CRTC state.
+     */
+    I830Sync(crtc->scrn);
 
     return FALSE;
 }
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 626e658..4fa61c9 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -1935,7 +1935,6 @@ i830_refresh_ring(ScrnInfoPtr pScrn)
    pI830->ring.space = pI830->ring.head - (pI830->ring.tail + 8);
    if (pI830->ring.space < 0)
       pI830->ring.space += pI830->ring.mem->size;
-   i830MarkSync(pScrn);
 }
 
 enum pipe {
@@ -3050,7 +3049,7 @@ i830AdjustFrame(int scrnIndex, int x, int y, int flags)
    if (crtc && crtc->enabled)
    {
       /* Sync the engine before adjust frame */
-      i830WaitSync(pScrn);
+      I830Sync(pScrn);
       i830PipeSetBase(crtc, crtc->desiredX + x, crtc->desiredY + y);
       crtc->x = output->initial_x + x;
       crtc->y = output->initial_y + y;
@@ -3454,26 +3453,6 @@ i830_pipe_to_crtc(ScrnInfoPtr pScrn, int pipe)
 } 
 
 void
-i830WaitSync(ScrnInfoPtr pScrn)
-{
-   I830Ptr pI830 = I830PTR(pScrn);
-
-   if (pI830->uxa_driver && pI830->need_sync) {
-      pI830->need_sync = FALSE;
-      I830Sync(pScrn);
-   }
-}
-
-void
-i830MarkSync(ScrnInfoPtr pScrn)
-{
-   I830Ptr pI830 = I830PTR(pScrn);
-
-   if (pI830->uxa_driver)
-      pI830->need_sync = TRUE;
-}
-
-void
 I830InitpScrn(ScrnInfoPtr pScrn)
 {
    pScrn->PreInit = I830PreInit;
diff --git a/src/i830_exa.c b/src/i830_exa.c
index 3ec3657..0a15de8 100644
--- a/src/i830_exa.c
+++ b/src/i830_exa.c
@@ -492,11 +492,6 @@ i830_uxa_prepare_access (PixmapPtr pixmap, uxa_access_t access)
 	I830Ptr i830 = I830PTR(scrn);
 	
 	intel_batch_flush(scrn, FALSE);
-	/* XXX: dri_bo_map should handle syncing for us, what's the deal? */
-	if (i830->need_sync) {
-	    I830Sync(scrn);
-	    i830->need_sync = FALSE;
-	}
 
 	/* No VT sema or GEM?  No GTT mapping. */
 	if (!scrn->vtSema || !i830->memory_manager) {
diff --git a/src/i830_memory.c b/src/i830_memory.c
index 3443146..147fca3 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -1368,10 +1368,7 @@ i830_set_tiling(ScrnInfoPtr pScrn, unsigned int offset,
 
     assert(tile_format != TILE_NONE);
 
-    if (pI830->need_sync) {
-	I830Sync(pScrn);
-	pI830->need_sync = FALSE;
-    }
+    I830Sync(pScrn);
 
     if (IS_I965G(pI830))
 	max_fence = FENCE_NEW_NR;
diff --git a/src/i830_video.c b/src/i830_video.c
index d07fb65..8d33d69 100644
--- a/src/i830_video.c
+++ b/src/i830_video.c
@@ -461,7 +461,7 @@ i830_overlay_on(ScrnInfoPtr pScrn)
     OUT_BATCH(MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP);
     OUT_BATCH(MI_NOOP);
     ADVANCE_BATCH();
-    i830WaitSync(pScrn);
+    I830Sync(pScrn);
     
     /*
      * If we turned pipe A on up above, turn it
@@ -514,7 +514,7 @@ i830_overlay_off(ScrnInfoPtr pScrn)
 
     /*
      * Wait for overlay to go idle. This has to be
-     * separated from the turning off state by a WaitSync
+     * separated from the turning off state by a Sync
      * to ensure the overlay will not read OCMD early and
      * disable the overlay before the commands here are
      * executed
@@ -524,7 +524,7 @@ i830_overlay_off(ScrnInfoPtr pScrn)
 	OUT_BATCH(MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP);
 	OUT_BATCH(MI_NOOP);
 	ADVANCE_BATCH();
-	i830WaitSync(pScrn);
+	I830Sync(pScrn);
     }
     
     /*
@@ -545,7 +545,7 @@ i830_overlay_off(ScrnInfoPtr pScrn)
 	OUT_BATCH(MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP);
 	OUT_BATCH(MI_NOOP);
 	ADVANCE_BATCH();
-	i830WaitSync(pScrn);
+	I830Sync(pScrn);
     }
     pI830->overlayOn = FALSE;
     OVERLAY_DEBUG("overlay_off\n");
commit 393abc15b76804580bfee0760ddbd1fb77e66c02
Author: Eric Anholt <eric at anholt.net>
Date:   Mon Apr 20 15:58:35 2009 -0700

    Now that video destination pixmaps are always in BOs, no more MarkSync.

diff --git a/src/i915_video.c b/src/i915_video.c
index 93e0c86..1d1fa01 100644
--- a/src/i915_video.c
+++ b/src/i915_video.c
@@ -415,7 +415,5 @@ I915DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id,
    }
 
    intel_batch_end_atomic(pScrn);
-
-   i830MarkSync(pScrn);
 }
 
diff --git a/src/i965_video.c b/src/i965_video.c
index f6020d4..1d0ed74 100644
--- a/src/i965_video.c
+++ b/src/i965_video.c
@@ -375,13 +375,10 @@ i965_create_dst_surface_state(ScrnInfoPtr scrn,
     dest_surf_state->ss0.mipmap_layout_mode = 0;
     dest_surf_state->ss0.render_cache_read_mode = 0;
 
-    if (pixmap_bo != NULL)
-	dest_surf_state->ss1.base_addr =
-	    intel_emit_reloc(surf_bo, offsetof(struct brw_surface_state, ss1),
-			     pixmap_bo, 0,
-			     I915_GEM_DOMAIN_SAMPLER, 0);
-    else
-	dest_surf_state->ss1.base_addr = intel_get_pixmap_offset(pixmap);
+    dest_surf_state->ss1.base_addr =
+	intel_emit_reloc(surf_bo, offsetof(struct brw_surface_state, ss1),
+			 pixmap_bo, 0,
+			 I915_GEM_DOMAIN_SAMPLER, 0);
 
     dest_surf_state->ss2.height = scrn->virtualY - 1;
     dest_surf_state->ss2.width = scrn->virtualX - 1;
@@ -1160,7 +1157,6 @@ I965DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id,
 	i965_post_draw_debug(pScrn);
     }
 
-    i830MarkSync(pScrn);
 #if WATCH_STATS
     i830_dump_error_state(pScrn);
 #endif
commit dc71573292c215f49716f4dc1ebc416c6b172995
Author: Eric Anholt <eric at anholt.net>
Date:   Fri Apr 17 15:13:34 2009 -0700

    Remove can_resize, which is now always true (except when a bug interfered)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 8f682d5..298c471 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -824,9 +824,6 @@ drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height)
 	if (scrn->virtualX == width && scrn->virtualY == height)
 		return TRUE;
 
-	if (!pI830->can_resize)
-		return FALSE;
-
 	pitch = i830_pad_drawable_width(width, pI830->cpp);
 	tiled = i830_tiled_width(pI830, &pitch, pI830->cpp);
 	xf86DrvMsg(scrn->scrnIndex, X_INFO,
@@ -896,7 +893,6 @@ static const xf86CrtcConfigFuncsRec drmmode_xf86crtc_config_funcs = {
 
 Bool drmmode_pre_init(ScrnInfoPtr pScrn, int fd, int cpp)
 {
-	I830Ptr pI830 = I830PTR(pScrn);
 	xf86CrtcConfigPtr   xf86_config;
 	drmmode_ptr drmmode;
 	int i;
@@ -921,7 +917,7 @@ Bool drmmode_pre_init(ScrnInfoPtr pScrn, int fd, int cpp)
 	for (i = 0; i < drmmode->mode_res->count_connectors; i++)
 		drmmode_output_init(pScrn, drmmode, i);
 
-	xf86InitialConfiguration(pScrn, pI830->can_resize);
+	xf86InitialConfiguration(pScrn, TRUE);
 
 	return TRUE;
 }
diff --git a/src/i830.h b/src/i830.h
index 84c2110..d2307f6 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -409,8 +409,6 @@ typedef struct _I830Rec {
 
    i830_memory *memory_manager;		/**< DRI memory manager aperture */
 
-   Bool can_resize;
-
    Bool need_mi_flush;
 
    Bool tiling;
diff --git a/src/i830_driver.c b/src/i830_driver.c
index a044b72..626e658 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -1105,7 +1105,7 @@ i830_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height)
     scrn->virtualX = width;
     scrn->virtualY = height;
 #ifdef DRI2
-    if (i830->can_resize && i830->front_buffer)
+    if (i830->front_buffer)
     {
 	i830_memory *new_front, *old_front;
 	Bool	    tiled;
@@ -1599,16 +1599,8 @@ I830AccelMethodInit(ScrnInfoPtr pScrn)
     I830SetupOutputs(pScrn);
 
     SaveHWState(pScrn);
-    pI830->can_resize = FALSE;
-    if (pI830->accel == ACCEL_UXA)
-	pI830->can_resize = TRUE;
-
-    xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-	       "Resizable framebuffer: %s (%d %d)\n",
-	       pI830->can_resize ? "available" : "not available",
-	       pI830->directRenderingType, pI830->accel);
 
-    if (!xf86InitialConfiguration (pScrn, pI830->can_resize))
+    if (!xf86InitialConfiguration (pScrn, TRUE))
     {
 	xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes.\n");
 	RestoreHWState(pScrn);
@@ -1634,7 +1626,6 @@ I830DrmModeInit(ScrnInfoPtr pScrn)
     int ret;
 
     pI830->accel = ACCEL_UXA;
-    pI830->can_resize = TRUE;
 
     bus_id = DRICreatePCIBusID(pI830->PciInfo);
 
diff --git a/src/i830_memory.c b/src/i830_memory.c
index dae8cf9..3443146 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -1097,13 +1097,6 @@ i830_allocate_framebuffer(ScrnInfoPtr pScrn)
      * rotation.
      */
     fb_height = pScrn->virtualY;
-    if (!pI830->can_resize)
-    {
-	if (!pI830->use_drm_mode && pScrn->virtualX > pScrn->virtualY)
-	    fb_height = pScrn->virtualX;
-	else
-	    fb_height = pScrn->virtualY;
-    }
 
     /* Calculate how much framebuffer memory to allocate.  For the
      * initial allocation, calculate a reasonable minimum.  This is
commit 96df22740b2cdc4f82a4a36c0f77663105d9337e
Author: Eric Anholt <eric at anholt.net>
Date:   Fri Apr 17 15:11:12 2009 -0700

    unifdef I830_USE_UXA.
    
    We only have on acceleration architecture now, and you can always build it
    if you're building the driver.

diff --git a/src/Makefile.am b/src/Makefile.am
index d4b9c8a..c4b9ab0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -32,7 +32,7 @@ SUBDIRS = xvmc bios_reader ch7017 ch7xxx ivch sil164 tfp410 $(REGDUMPER)
 
 AM_CFLAGS = @WARN_CFLAGS@ @XORG_CFLAGS@ @DRM_CFLAGS@ @DRI_CFLAGS@ \
 	@PCIACCESS_CFLAGS@ -I$(top_srcdir)/uxa \
-	-DI830_XV -DI830_USE_UXA
+	-DI830_XV
 
 intel_drv_la_LTLIBRARIES = intel_drv.la
 intel_drv_la_LDFLAGS = -module -avoid-version
diff --git a/src/i830.h b/src/i830.h
index 314fd58..84c2110 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -73,19 +73,15 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "intel_bufmgr.h"
 #include "i915_drm.h"
 
-#ifdef I830_USE_UXA
 #include "uxa.h"
 Bool i830_uxa_init(ScreenPtr pScreen);
 void i830_uxa_create_screen_resources(ScreenPtr pScreen);
 void i830_uxa_block_handler (ScreenPtr pScreen);
 Bool i830_get_aperture_space(ScrnInfoPtr pScrn, drm_intel_bo **bo_table,
 			     int num_bos);
-#endif
 
-#if defined(I830_USE_UXA)
 dri_bo *i830_get_pixmap_bo (PixmapPtr pixmap);
 void i830_set_pixmap_bo(PixmapPtr pixmap, dri_bo *bo);
-#endif
 
 typedef struct _I830OutputRec I830OutputRec, *I830OutputPtr;
 
@@ -444,14 +440,10 @@ typedef struct _I830Rec {
 
    void (*batch_flush_notify)(ScrnInfoPtr pScrn);
 
-#ifdef I830_USE_UXA
    uxa_driver_t *uxa_driver;
    Bool need_flush;
-#endif
    Bool need_sync;
-#if defined(I830_USE_UXA)
    PixmapPtr pSrcPixmap;
-#endif
    int accel_pixmap_pitch_alignment;
    int accel_pixmap_offset_alignment;
    int accel_max_x;
diff --git a/src/i830_accel.c b/src/i830_accel.c
index b185ab1..c2f30a8 100644
--- a/src/i830_accel.c
+++ b/src/i830_accel.c
@@ -124,9 +124,7 @@ I830WaitLpRing(ScrnInfoPtr pScrn, int n, int timeout_millis)
 	 else
 	     i830_dump_error_state(pScrn);
 	 ErrorF("space: %d wanted %d\n", ring->space, n);
-#ifdef I830_USE_UXA
-	pI830->uxa_driver = NULL;
-#endif
+	 pI830->uxa_driver = NULL;
 	 FatalError("lockup\n");
       }
 
@@ -283,9 +281,7 @@ I830AccelInit(ScreenPtr pScreen)
 
     switch (pI830->accel) {
     case ACCEL_UXA:
-#ifdef I830_USE_UXA
 	return i830_uxa_init(pScreen);
-#endif
     case ACCEL_UNINIT:
     case ACCEL_NONE:
 	break;
diff --git a/src/i830_batchbuffer.h b/src/i830_batchbuffer.h
index f16023d..d011417 100644
--- a/src/i830_batchbuffer.h
+++ b/src/i830_batchbuffer.h
@@ -100,18 +100,14 @@ intel_batch_emit_reloc_pixmap(I830Ptr pI830, PixmapPtr pPixmap,
 			      uint32_t read_domains, uint32_t write_domain,
 			      uint32_t delta)
 {
-#if I830_USE_UXA
     dri_bo *bo = i830_get_pixmap_bo(pPixmap);
-#endif
     uint32_t offset;
     assert(pI830->batch_ptr != NULL);
     assert(intel_batch_space(pI830) >= 4);
-#if I830_USE_UXA
     if (bo) {
 	intel_batch_emit_reloc(pI830, bo, read_domains, write_domain, delta);
 	return;
     }
-#endif
     offset = intel_get_pixmap_offset(pPixmap);
     *(uint32_t *)(pI830->batch_ptr + pI830->batch_used) = offset + delta;
     pI830->batch_used += 4;
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 5fa76ca..a044b72 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -840,10 +840,9 @@ i830CreateScreenResources(ScreenPtr pScreen)
 
    i830_update_front_offset(pScrn);
 
-#ifdef I830_USE_UXA
    if (pI830->accel == ACCEL_UXA)
       i830_uxa_create_screen_resources(pScreen);
-#endif
+
    return TRUE;
 }
 
@@ -2456,10 +2455,8 @@ I830BlockHandler(int i,
        pI830->need_mi_flush = FALSE;
     }
 
-#ifdef I830_USE_UXA
     if (pI830->accel == ACCEL_UXA)
 	i830_uxa_block_handler (pScreen);
-#endif
 
     I830VideoBlockHandler(i, blockData, pTimeout, pReadmask);
 }
@@ -3328,13 +3325,11 @@ I830CloseScreen(int scrnIndex, ScreenPtr pScreen)
        vgaHWUnmapMem(pScrn);
    }
 
-#ifdef I830_USE_UXA
    if (pI830->uxa_driver) {
        uxa_driver_fini (pScreen);
        xfree (pI830->uxa_driver);
        pI830->uxa_driver = NULL;
    }
-#endif
    if (pI830->front_buffer) {
 	i830_set_pixmap_bo(pScreen->GetScreenPixmap(pScreen), NULL);
 	i830_free_memory(pScrn, pI830->front_buffer);
@@ -3472,17 +3467,9 @@ i830WaitSync(ScrnInfoPtr pScrn)
 {
    I830Ptr pI830 = I830PTR(pScrn);
 
-   switch (pI830->accel) {
-#ifdef I830_USE_UXA
-   case ACCEL_UXA:
-      if (pI830->uxa_driver && pI830->need_sync) {
-	 pI830->need_sync = FALSE;
-	 I830Sync(pScrn);
-      }
-      break;
-#endif
-   default:
-      break;
+   if (pI830->uxa_driver && pI830->need_sync) {
+      pI830->need_sync = FALSE;
+      I830Sync(pScrn);
    }
 }
 
@@ -3491,16 +3478,8 @@ i830MarkSync(ScrnInfoPtr pScrn)
 {
    I830Ptr pI830 = I830PTR(pScrn);
 
-   switch (pI830->accel) {
-#ifdef I830_USE_UXA
-   case ACCEL_UXA:
-      if (pI830->uxa_driver)
-	 pI830->need_sync = TRUE;
-      break;
-#endif
-   default:
-      break;
-   }
+   if (pI830->uxa_driver)
+      pI830->need_sync = TRUE;
 }
 
 void
diff --git a/src/i830_exa.c b/src/i830_exa.c
index cf39342..3ec3657 100644
--- a/src/i830_exa.c
+++ b/src/i830_exa.c
@@ -79,9 +79,7 @@ const int I830PatternROP[16] =
     ROP_1
 };
 
-#ifdef I830_USE_UXA
 static int uxa_pixmap_index;
-#endif
 
 /**
  * Returns whether a given pixmap is tiled or not.
@@ -455,13 +453,10 @@ i830_get_pixmap_bo(PixmapPtr pixmap)
     ScrnInfoPtr scrn = xf86Screens[screen->myNum];
     I830Ptr i830 = I830PTR(scrn);
 
-#ifdef I830_USE_UXA
-    if (i830->accel == ACCEL_UXA) {
+    if (i830->accel == ACCEL_UXA)
 	return dixLookupPrivate(&pixmap->devPrivates, &uxa_pixmap_index);
-    }
-#endif
-
-    return NULL;
+    else
+	return NULL;
 }
 
 void
@@ -473,17 +468,13 @@ i830_set_pixmap_bo(PixmapPtr pixmap, dri_bo *bo)
 
     if (old_bo)
 	dri_bo_unreference (old_bo);
-#if I830_USE_UXA
     if (i830->accel == ACCEL_UXA) {
 	if (bo != NULL)
 	    dri_bo_reference(bo);
 	dixSetPrivate(&pixmap->devPrivates, &uxa_pixmap_index, bo);
     }
-#endif
 }
 
-#if defined(I830_USE_UXA)
-
 static void
 i830_uxa_set_pixmap_bo (PixmapPtr pixmap, dri_bo *bo)
 {
@@ -736,4 +727,3 @@ i830_uxa_init (ScreenPtr pScreen)
 
     return TRUE;
 }
-#endif /* I830_USE_UXA */
commit fa81ae1637bfd7b73b43355b78c88a9b84c0393c
Author: Eric Anholt <eric at anholt.net>
Date:   Fri Apr 17 14:01:47 2009 -0700

    Remove EXA support.
    
    UXA has completely replaced EXA at this point.  UXA is the same rendering
    core as EXA, but relying on kernel memory management or a fake bufmgr instead
    of trying to manage memory in the X Server.

diff --git a/man/intel.man b/man/intel.man
index 3e74bc2..05aa678 100644
--- a/man/intel.man
+++ b/man/intel.man
@@ -146,14 +146,6 @@ have options for selecting adaptors.
 .IP
 Default: Textured video adaptor is preferred.
 .TP
-.BI "Option \*qAccelMethod\*q \*q" string \*q
-Choose acceleration architecture, either "UXA" or "EXA".
-EXA is a simple acceleration architecture designed for systems without
-kernel memory management, while UXA is designed to take advantage of the
-capabilities of kernel memory management.
-.IP
-Default: "UXA" if kernel-modesetting is available, "EXA" otherwise.
-.TP
 .BI "Option \*qModeDebug\*q \*q" boolean \*q
 Enable printing of additional debugging information about modesetting to
 the server log.
diff --git a/src/Makefile.am b/src/Makefile.am
index 6401269..d4b9c8a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -32,7 +32,7 @@ SUBDIRS = xvmc bios_reader ch7017 ch7xxx ivch sil164 tfp410 $(REGDUMPER)
 
 AM_CFLAGS = @WARN_CFLAGS@ @XORG_CFLAGS@ @DRM_CFLAGS@ @DRI_CFLAGS@ \
 	@PCIACCESS_CFLAGS@ -I$(top_srcdir)/uxa \
-	-DI830_XV -DI830_USE_EXA -DI830_USE_UXA
+	-DI830_XV -DI830_USE_UXA
 
 intel_drv_la_LTLIBRARIES = intel_drv.la
 intel_drv_la_LDFLAGS = -module -avoid-version
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index b081a7b..8f682d5 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -926,28 +926,4 @@ Bool drmmode_pre_init(ScrnInfoPtr pScrn, int fd, int cpp)
 	return TRUE;
 }
 
-Bool drmmode_is_rotate_pixmap(ScrnInfoPtr pScrn, pointer pPixData, dri_bo **bo)
-{
-	return FALSE;
-
-#if 0
-	xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR (pScrn);
-	int i;
-
-	for (i = 0; i < config->num_crtc; i++) {
-		xf86CrtcPtr crtc = config->crtc[i];
-		drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
-
-		if (!drmmode_crtc->rotate_bo)
-			continue;
-
-		if (drmmode_crtc->rotate_bo->virtual == pPixData) {
-			*bo = drmmode_crtc->rotate_bo;
-			return TRUE;
-		}
-	}
-	return FALSE;
-#endif
-}
-
 #endif
diff --git a/src/i830.h b/src/i830.h
index 9f5dd3a..314fd58 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -73,11 +73,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "intel_bufmgr.h"
 #include "i915_drm.h"
 
-#ifdef I830_USE_EXA
-#include "exa.h"
-Bool I830EXAInit(ScreenPtr pScreen);
-#endif
-
 #ifdef I830_USE_UXA
 #include "uxa.h"
 Bool i830_uxa_init(ScreenPtr pScreen);
@@ -87,7 +82,7 @@ Bool i830_get_aperture_space(ScrnInfoPtr pScrn, drm_intel_bo **bo_table,
 			     int num_bos);
 #endif
 
-#if defined(I830_USE_UXA) || defined(I830_USE_EXA)
+#if defined(I830_USE_UXA)
 dri_bo *i830_get_pixmap_bo (PixmapPtr pixmap);
 void i830_set_pixmap_bo(PixmapPtr pixmap, dri_bo *bo);
 #endif
@@ -333,7 +328,6 @@ enum backlight_control {
 typedef enum accel_method {
     ACCEL_UNINIT = 0,
     ACCEL_NONE,
-    ACCEL_EXA,
     ACCEL_UXA
 } accel_method_t;
 
@@ -373,9 +367,6 @@ typedef struct _I830Rec {
    /* separate small buffers for kernels that support this */
    i830_memory *cursor_mem_classic[2];
    i830_memory *cursor_mem_argb[2];
-#ifdef I830_USE_EXA
-   i830_memory *exa_offscreen;
-#endif
    i830_memory *fake_bufmgr_mem;
 
    /* Regions allocated either from the above pools, or from agpgart. */
@@ -453,15 +444,12 @@ typedef struct _I830Rec {
 
    void (*batch_flush_notify)(ScrnInfoPtr pScrn);
 
-#ifdef I830_USE_EXA
-   ExaDriverPtr	EXADriverPtr;
-#endif
 #ifdef I830_USE_UXA
    uxa_driver_t *uxa_driver;
    Bool need_flush;
 #endif
    Bool need_sync;
-#if defined(I830_USE_EXA) || defined(I830_USE_UXA)
+#if defined(I830_USE_UXA)
    PixmapPtr pSrcPixmap;
 #endif
    int accel_pixmap_pitch_alignment;
@@ -496,12 +484,12 @@ typedef struct _I830Rec {
    } video;
 #endif
 
-   /* EXA render state */
+   /* Render accel state */
    float scale_units[2][2];
   /** Transform pointers for src/mask, or NULL if identity */
    PictTransform *transform[2];
    float coord_adjust;
-   /* i915 EXA render state */
+   /* i915 render accel state */
    uint32_t mapstate[6];
    uint32_t samplerstate[6];
 
@@ -653,10 +641,6 @@ typedef struct _I830Rec {
 unsigned long intel_get_pixmap_offset(PixmapPtr pPix);
 unsigned long intel_get_pixmap_pitch(PixmapPtr pPix);
 
-struct i830_exa_pixmap_priv {
-    dri_bo *bo;
-};
-
 /* Batchbuffer support macros and functions */
 #include "i830_batchbuffer.h"
 
@@ -719,8 +703,6 @@ void I830DRI2CloseScreen(ScreenPtr pScreen);
 
 #ifdef XF86DRM_MODE
 extern Bool drmmode_pre_init(ScrnInfoPtr pScrn, int fd, int cpp);
-extern Bool drmmode_is_rotate_pixmap(ScrnInfoPtr pScrn, pointer pPixData,
-				     dri_bo **bo);
 #endif
 
 extern Bool I830AccelInit(ScreenPtr pScreen);
@@ -889,7 +871,7 @@ static inline int i830_fb_compression_supported(I830Ptr pI830)
 do {							\
     if (I830PTR(pScrn)->fallback_debug) {		\
 	xf86DrvMsg(pScrn->scrnIndex, X_INFO,		\
-		   "EXA fallback: " s "\n", ##arg);	\
+		   "fallback: " s "\n", ##arg);	\
     }							\
     return FALSE;					\
 } while(0)
diff --git a/src/i830_accel.c b/src/i830_accel.c
index a3772c5..b185ab1 100644
--- a/src/i830_accel.c
+++ b/src/i830_accel.c
@@ -66,28 +66,16 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 unsigned long
 intel_get_pixmap_offset(PixmapPtr pPix)
 {
-#if defined(I830_USE_EXA) || defined(I830_USE_UXA)
     ScreenPtr pScreen = pPix->drawable.pScreen;
     ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
     I830Ptr pI830 = I830PTR(pScrn);
 
-    if (pI830->accel == ACCEL_EXA)
-	return exaGetPixmapOffset(pPix);
-#endif
     return (unsigned long)pPix->devPrivate.ptr - (unsigned long)pI830->FbBase;
 }
 
 unsigned long
 intel_get_pixmap_pitch(PixmapPtr pPix)
 {
-#ifdef I830_USE_EXA
-    ScreenPtr pScreen = pPix->drawable.pScreen;
-    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
-    I830Ptr pI830 = I830PTR(pScrn);
-
-    if (pI830->accel == ACCEL_EXA)
-	return exaGetPixmapPitch(pPix);
-#endif
     return (unsigned long)pPix->devKind;
 }
 
@@ -136,9 +124,6 @@ I830WaitLpRing(ScrnInfoPtr pScrn, int n, int timeout_millis)
 	 else
 	     i830_dump_error_state(pScrn);
 	 ErrorF("space: %d wanted %d\n", ring->space, n);
-#ifdef I830_USE_EXA
-	 pI830->EXADriverPtr = NULL;
-#endif
 #ifdef I830_USE_UXA
 	pI830->uxa_driver = NULL;
 #endif
@@ -279,7 +264,7 @@ I830AccelInit(ScreenPtr pScreen)
      *
      * For the tiled issues, the only tiled buffer we draw to should be
      * the front, which will have an appropriate pitch/offset already set up,
-     * so EXA doesn't need to worry.
+     * so UXA doesn't need to worry.
      */
     if (IS_I965G(pI830)) {
 	pI830->accel_pixmap_offset_alignment = 4 * 2;
@@ -300,14 +285,6 @@ I830AccelInit(ScreenPtr pScreen)
     case ACCEL_UXA:
 #ifdef I830_USE_UXA
 	return i830_uxa_init(pScreen);
-#else
-	xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
-		   "UXA not built in, falling back to EXA.\n");
-	return I830EXAInit(pScreen);
-#endif
-#ifdef I830_USE_EXA
-    case ACCEL_EXA:
-	return I830EXAInit(pScreen);
 #endif
     case ACCEL_UNINIT:
     case ACCEL_NONE:
diff --git a/src/i830_batchbuffer.h b/src/i830_batchbuffer.h
index a72786e..f16023d 100644
--- a/src/i830_batchbuffer.h
+++ b/src/i830_batchbuffer.h
@@ -100,13 +100,13 @@ intel_batch_emit_reloc_pixmap(I830Ptr pI830, PixmapPtr pPixmap,
 			      uint32_t read_domains, uint32_t write_domain,
 			      uint32_t delta)
 {
-#if I830_USE_UXA || I830_USE_EXA
+#if I830_USE_UXA
     dri_bo *bo = i830_get_pixmap_bo(pPixmap);
 #endif
     uint32_t offset;
     assert(pI830->batch_ptr != NULL);
     assert(intel_batch_space(pI830) >= 4);
-#if I830_USE_UXA || I830_USE_EXA
+#if I830_USE_UXA
     if (bo) {
 	intel_batch_emit_reloc(pI830, bo, read_domains, write_domain, delta);
 	return;
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 93bb0ea..5fa76ca 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -213,18 +213,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include <xf86drmMode.h>
 #endif
 
-#ifdef I830_USE_EXA
-static const char *I830exaSymbols[] = {
-    "exaGetVersion",
-    "exaDriverInit",
-    "exaDriverFini",
-    "exaOffscreenAlloc",
-    "exaOffscreenFree",
-    "exaWaitSync",
-    NULL
-};
-#endif
-
 #define BIT(x) (1 << (x))
 #define MAX(a,b) ((a) > (b) ? (a) : (b))
 #define NB_OF(x) (sizeof (x) / sizeof (*x))
@@ -297,7 +285,6 @@ static PciChipsets I830PciChipsets[] = {
  */
 
 typedef enum {
-   OPTION_ACCELMETHOD,
    OPTION_NOACCEL,
    OPTION_DRI,
    OPTION_VIDEO_KEY,
@@ -316,7 +303,6 @@ typedef enum {
 } I830Opts;
 
 static OptionInfoRec I830Options[] = {
-   {OPTION_ACCELMETHOD,	"AccelMethod",	OPTV_ANYSTR,	{0},	FALSE},
    {OPTION_NOACCEL,	"NoAccel",	OPTV_BOOLEAN,	{0},	FALSE},
    {OPTION_DRI,		"DRI",		OPTV_BOOLEAN,	{0},	TRUE},
    {OPTION_COLOR_KEY,	"ColorKey",	OPTV_INTEGER,	{0},	FALSE},
@@ -1471,7 +1457,6 @@ static const char *accel_name[] =
 {
    "unspecified",
    "no",
-   "EXA",
    "UXA",
 };
 
@@ -1564,34 +1549,12 @@ 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;
-    }
-
-    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_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, "UXA")) {
-		from = X_CONFIG;
-	       pI830->accel = ACCEL_UXA;
-	    }
-	}
-#endif
+    } else {
+       pI830->accel = ACCEL_UXA;
 	xf86DrvMsg(pScrn->scrnIndex, from, "Using %s for acceleration\n",
 		   accel_name[pI830->accel]);
     }
@@ -1669,25 +1632,10 @@ I830DrmModeInit(ScrnInfoPtr pScrn)
 #ifdef XF86DRM_MODE
     I830Ptr pI830 = I830PTR(pScrn);
     char *bus_id;
-    char *s;
     int ret;
 
-    /* Default to UXA but allow override */
     pI830->accel = ACCEL_UXA;
-
-    if ((s = (char *)xf86GetOptValString(pI830->Options, OPTION_ACCELMETHOD))) {
-	if (xf86NameCmp(s, "UXA"))
-	    xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "kernel mode setting active,overridding accelmethod and using UXA\n");
-    }
-
-    pI830->can_resize = FALSE;
-    if (pI830->accel == ACCEL_UXA)
-	pI830->can_resize = TRUE;
-
-    xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-	       "Resizable framebuffer: %s (%d %d)\n",
-	       pI830->can_resize ? "available" : "not available",
-	       pI830->directRenderingType, pI830->accel);
+    pI830->can_resize = TRUE;
 
     bus_id = DRICreatePCIBusID(pI830->PciInfo);
 
@@ -1894,33 +1842,6 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
 
    xf86LoaderReqSymLists(I810fbSymbols, NULL);
 
-   switch (pI830->accel) {
-#ifdef I830_USE_EXA
-   case ACCEL_EXA: {
-      XF86ModReqInfo req;
-      int errmaj, errmin;
-
-      memset(&req, 0, sizeof(req));
-      req.majorversion = 2;
-#if EXA_VERSION_MINOR >= 2
-      req.minorversion = 2;
-#else
-      req.minorversion = 1;
-#endif
-      if (!LoadSubModule(pScrn->module, "exa", NULL, NULL, NULL, &req,
-		&errmaj, &errmin)) {
-	 LoaderErrorMsg(NULL, "exa", errmaj, errmin);
-	 PreInitCleanup(pScrn);
-	 return FALSE;
-      }
-      xf86LoaderReqSymLists(I830exaSymbols, NULL);
-      break;
-   }
-#endif
-   default:
-      break;
-   }
-
    if (!pI830->use_drm_mode) {
        i830CompareRegsToSnapshot(pScrn, "After PreInit");
 
@@ -3235,7 +3156,7 @@ I830LeaveVT(int scrnIndex, int flags)
 	 FatalError("DRM_I915_LEAVEVT failed: %s\n", strerror(ret));
    }
 
-   if ((pI830->accel == ACCEL_EXA || pI830->accel == ACCEL_UXA) && IS_I965G(pI830))
+   if (pI830->accel == ACCEL_UXA && IS_I965G(pI830))
       gen4_render_state_cleanup(pScrn);
 
    ret = drmDropMaster(pI830->drmSubFD);
@@ -3322,8 +3243,7 @@ I830EnterVT(int scrnIndex, int flags)
 
    intel_batch_init(pScrn);
 
-   if ((pI830->accel == ACCEL_EXA || pI830->accel == ACCEL_UXA) &&
-       IS_I965G(pI830))
+   if (pI830->accel == ACCEL_UXA && IS_I965G(pI830))
       gen4_render_state_init(pScrn);
 
    if (!pI830->use_drm_mode) {
@@ -3408,13 +3328,6 @@ I830CloseScreen(int scrnIndex, ScreenPtr pScreen)
        vgaHWUnmapMem(pScrn);
    }
 
-#ifdef I830_USE_EXA
-   if (pI830->EXADriverPtr) {
-       exaDriverFini(pScreen);
-       xfree(pI830->EXADriverPtr);
-       pI830->EXADriverPtr = NULL;
-   }
-#endif
 #ifdef I830_USE_UXA
    if (pI830->uxa_driver) {
        uxa_driver_fini (pScreen);
@@ -3560,14 +3473,6 @@ i830WaitSync(ScrnInfoPtr pScrn)
    I830Ptr pI830 = I830PTR(pScrn);
 
    switch (pI830->accel) {
-#ifdef I830_USE_EXA
-   case ACCEL_EXA:
-      if (pI830->EXADriverPtr) {
-	 ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex];
-	 exaWaitSync(pScreen);
-      }
-      break;
-#endif
 #ifdef I830_USE_UXA
    case ACCEL_UXA:
       if (pI830->uxa_driver && pI830->need_sync) {
@@ -3587,14 +3492,6 @@ i830MarkSync(ScrnInfoPtr pScrn)
    I830Ptr pI830 = I830PTR(pScrn);
 
    switch (pI830->accel) {
-#ifdef I830_USE_EXA
-   case ACCEL_EXA:
-      if (pI830->EXADriverPtr) {
-	 ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex];
-	 exaMarkSync(pScreen);
-      }
-      break;
-#endif
 #ifdef I830_USE_UXA
    case ACCEL_UXA:
       if (pI830->uxa_driver)
diff --git a/src/i830_exa.c b/src/i830_exa.c
index e88d260..cf39342 100644
--- a/src/i830_exa.c
+++ b/src/i830_exa.c
@@ -153,39 +153,6 @@ i830_pixmap_pitch_is_aligned(PixmapPtr pixmap)
     return i830_pixmap_pitch(pixmap) % pI830->accel_pixmap_pitch_alignment == 0;
 }
 
-static Bool
-i830_exa_pixmap_is_offscreen(PixmapPtr pPixmap)
-{
-    ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum];
-    I830Ptr pI830 = I830PTR(pScrn);
-
-    if ((void *)pPixmap->devPrivate.ptr >= (void *)pI830->FbBase &&
-	(void *)pPixmap->devPrivate.ptr <
-	(void *)(pI830->FbBase + pI830->FbMapSize))
-    {
-	return TRUE;
-    } else {
-	return FALSE;
-    }
-}
-
-/**
- * I830EXASync - wait for a command to finish
- * @pScreen: current screen
- * @marker: marker command to wait for
- *
- * Wait for the command specified by @marker to finish, then return.  We don't
- * actually do marker waits, though we might in the future.  For now, just
- * wait for a full idle.
- */
-static void
-I830EXASync(ScreenPtr pScreen, int marker)
-{
-    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
-
-    I830Sync(pScrn);
-}
-
 /**
  * Sets up hardware state for a series of solid fills.
  */
@@ -200,7 +167,7 @@ i830_uxa_prepare_solid(PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg)
 	i830_get_pixmap_bo(pPixmap),
     };
 
-    if (!EXA_PM_IS_SOLID(&pPixmap->drawable, planemask))
+    if (!UXA_PM_IS_SOLID(&pPixmap->drawable, planemask))
 	I830FALLBACK("planemask is not solid");
 
     if (pPixmap->drawable.bitsPerPixel == 24)
@@ -295,7 +262,7 @@ i830_uxa_prepare_copy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir,
 	i830_get_pixmap_bo(pDstPixmap),
     };
 
-    if (!EXA_PM_IS_SOLID(&pSrcPixmap->drawable, planemask))
+    if (!UXA_PM_IS_SOLID(&pSrcPixmap->drawable, planemask))
 	I830FALLBACK("planemask is not solid");
 
     if (pDstPixmap->drawable.bitsPerPixel < 8)
@@ -481,265 +448,6 @@ i830_transform_is_affine (PictTransformPtr t)
     return t->matrix[2][0] == 0 && t->matrix[2][1] == 0;
 }
 
-#ifdef XF86DRM_MODE
-
-static void *
-I830EXACreatePixmap(ScreenPtr screen, int size, int align)
-{
-    ScrnInfoPtr scrn = xf86Screens[screen->myNum];
-    I830Ptr i830 = I830PTR(scrn);
-    struct i830_exa_pixmap_priv *new_priv;
-
-    new_priv = xcalloc(1, sizeof(struct i830_exa_pixmap_priv));
-    if (!new_priv)
-        return NULL;
-
-    if (size == 0)
-	return new_priv;
-
-    new_priv->bo = dri_bo_alloc(i830->bufmgr, "pixmap", size,
-				i830->accel_pixmap_offset_alignment);
-    if (!new_priv->bo) {
-	xfree(new_priv);
-	return NULL;
-    }
-
-    return new_priv;
-}
-
-static void
-I830EXADestroyPixmap(ScreenPtr pScreen, void *driverPriv)
-{
-    struct i830_exa_pixmap_priv *priv = driverPriv;
-
-    if (priv->bo)
-	dri_bo_unreference(priv->bo);
-    xfree(priv);
-}
-
-static Bool I830EXAPixmapIsOffscreen(PixmapPtr pPix)
-{
-    struct i830_exa_pixmap_priv *driver_priv = exaGetPixmapDriverPrivate(pPix);
-
-    if (driver_priv && driver_priv->bo)
-	return TRUE;
-
-    return FALSE;
-}
-
-static Bool I830EXAPrepareAccess(PixmapPtr pPix, int index)
-{
-    ScreenPtr screen = pPix->drawable.pScreen;
-    ScrnInfoPtr scrn = xf86Screens[screen->myNum];
-    I830Ptr i830 = I830PTR(scrn);
-    struct i830_exa_pixmap_priv *driver_priv = exaGetPixmapDriverPrivate(pPix);
-
-    if (!driver_priv) {
-	xf86DrvMsg(scrn->scrnIndex, X_WARNING, "%s: no driver private?\n",
-		   __FUNCTION__);
-	return FALSE;
-    }
-
-    if (!driver_priv->bo) {
-	xf86DrvMsg(scrn->scrnIndex, X_WARNING, "%s: no buffer object?\n",
-		   __FUNCTION__);
-	return TRUE;
-    }
-
-    intel_batch_flush(scrn, FALSE);
-    if (i830->need_sync) {
-	I830Sync(scrn);
-	i830->need_sync = FALSE;
-    }
-    if (drm_intel_gem_bo_map_gtt(driver_priv->bo)) {
-	xf86DrvMsg(scrn->scrnIndex, X_WARNING, "%s: bo map failed\n",
-		   __FUNCTION__);
-	return FALSE;
-    }
-    pPix->devPrivate.ptr = driver_priv->bo->virtual;
-
-    return TRUE;
-}
-
-static void I830EXAFinishAccess(PixmapPtr pPix, int index)
-{
-    ScreenPtr screen = pPix->drawable.pScreen;
-    ScrnInfoPtr scrn = xf86Screens[screen->myNum];
-    I830Ptr i830 = I830PTR(scrn);
-    struct i830_exa_pixmap_priv *driver_priv = exaGetPixmapDriverPrivate(pPix);
-
-    if (!driver_priv) {
-	xf86DrvMsg(scrn->scrnIndex, X_WARNING, "%s: no driver private?\n",
-		   __FUNCTION__);
-	return;
-    }
-
-    if (!driver_priv->bo) {
-	xf86DrvMsg(scrn->scrnIndex, X_WARNING, "%s: no buffer object?\n",
-		   __FUNCTION__);
-	return;
-    }
-
-    dri_bo_unmap(driver_priv->bo);
-    pPix->devPrivate.ptr = NULL;
-    if (driver_priv->bo == i830->front_buffer->bo)
-	i830->need_flush = TRUE;
-}
-
-static Bool I830EXAModifyPixmapHeader(PixmapPtr pPix, int width, int height,
-				      int depth, int bitsPerPixel, int devKind,
-				      pointer pPixData)
-{
-    ScreenPtr	pScreen = pPix->drawable.pScreen;
-    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
-    I830Ptr pI830 = I830PTR(pScrn);
-    struct i830_exa_pixmap_priv *driver_priv = exaGetPixmapDriverPrivate(pPix);
-
-    if (!driver_priv)
-	return FALSE;
-
-    if (pI830->use_drm_mode &&
-	drmmode_is_rotate_pixmap(pScrn, pPixData, &driver_priv->bo)) {
-	/* this is a rotate pixmap */
-	dri_bo_unmap(driver_priv->bo);
-	dri_bo_reference(driver_priv->bo);
-        miModifyPixmapHeader(pPix, width, height, depth,
-			     bitsPerPixel, devKind, NULL);
-    }
-
-    if (pPixData == pI830->FbBase + pScrn->fbOffset) {
-	if (driver_priv->bo)
-		dri_bo_unreference(driver_priv->bo);
-	driver_priv->bo =
-	    intel_bo_gem_create_from_name(pI830->bufmgr, "front",
-					  pI830->front_buffer->gem_name);
-	if (!driver_priv->bo)
-	    return FALSE;
-
-	miModifyPixmapHeader(pPix, width, height, depth,
-			     bitsPerPixel, devKind, NULL);
-
-	return TRUE;
-    }
-    return FALSE;
-}
-
-#endif /* XF86DRM_MODE */
-
-Bool
-I830EXAInit(ScreenPtr pScreen)
-{
-    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
-    I830Ptr pI830 = I830PTR(pScrn);
-
-    pI830->EXADriverPtr = exaDriverAlloc();
-    if (pI830->EXADriverPtr == NULL) {
-	pI830->accel = ACCEL_NONE;
-	return FALSE;
-    }
-    memset(pI830->EXADriverPtr, 0, sizeof(*pI830->EXADriverPtr));
-
-    pI830->bufferOffset = 0;
-    pI830->EXADriverPtr->exa_major = 2;
-    /* If compiled against EXA 2.2, require 2.2 so we can use the
-     * PixmapIsOffscreen hook.
-     */
-#if EXA_VERSION_MINOR >= 2
-    pI830->EXADriverPtr->exa_minor = 2;
-#else
-    pI830->EXADriverPtr->exa_minor = 1;
-    xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
-	       "EXA compatibility mode.  Output rotation rendering "
-	       "performance may suffer\n");
-#endif
-    if (!pI830->use_drm_mode) {
-	pI830->EXADriverPtr->memoryBase = pI830->FbBase;
-	if (pI830->exa_offscreen) {
-	    pI830->EXADriverPtr->offScreenBase = pI830->exa_offscreen->offset;
-	    pI830->EXADriverPtr->memorySize = pI830->exa_offscreen->offset +
-		pI830->exa_offscreen->size;
-	} else {
-	    pI830->EXADriverPtr->offScreenBase = pI830->FbMapSize;
-	    pI830->EXADriverPtr->memorySize = pI830->FbMapSize;
-	}
-	pI830->EXADriverPtr->flags = EXA_OFFSCREEN_PIXMAPS;
-    } else {
-#ifdef XF86DRM_MODE
-	pI830->EXADriverPtr->flags = EXA_OFFSCREEN_PIXMAPS | EXA_HANDLES_PIXMAPS;
-	pI830->EXADriverPtr->PrepareAccess = I830EXAPrepareAccess;
-	pI830->EXADriverPtr->FinishAccess = I830EXAFinishAccess;
-#if EXA_VERSION_MINOR >= 4
-	pI830->EXADriverPtr->CreatePixmap = I830EXACreatePixmap;
-	pI830->EXADriverPtr->DestroyPixmap = I830EXADestroyPixmap;
-	pI830->EXADriverPtr->PixmapIsOffscreen = I830EXAPixmapIsOffscreen;
-	pI830->EXADriverPtr->ModifyPixmapHeader = I830EXAModifyPixmapHeader;
-#endif
-#endif /* XF86DRM_MODE */
-    }
-
-    DPRINTF(PFX, "EXA Mem: memoryBase 0x%x, end 0x%x, offscreen base 0x%x, "
-	    "memorySize 0x%x\n",
-	    pI830->EXADriverPtr->memoryBase,
-	    pI830->EXADriverPtr->memoryBase + pI830->EXADriverPtr->memorySize,
-	    pI830->EXADriverPtr->offScreenBase,
-	    pI830->EXADriverPtr->memorySize);
-
-    pI830->EXADriverPtr->pixmapOffsetAlign = pI830->accel_pixmap_offset_alignment;
-    pI830->EXADriverPtr->pixmapPitchAlign = pI830->accel_pixmap_pitch_alignment;
-    pI830->EXADriverPtr->maxX = pI830->accel_max_x;
-    pI830->EXADriverPtr->maxY = pI830->accel_max_y;
-
-    /* Sync */
-    pI830->EXADriverPtr->WaitMarker = I830EXASync;
-
-    /* Solid fill */
-    pI830->EXADriverPtr->PrepareSolid = i830_uxa_prepare_solid;
-    pI830->EXADriverPtr->Solid = i830_uxa_solid;
-    pI830->EXADriverPtr->DoneSolid = i830_uxa_done_solid;
-
-    /* Copy */
-    pI830->EXADriverPtr->PrepareCopy = i830_uxa_prepare_copy;
-    pI830->EXADriverPtr->Copy = i830_uxa_copy;
-    pI830->EXADriverPtr->DoneCopy = i830_uxa_done_copy;
-
-    /* Composite */
-    if (!IS_I9XX(pI830)) {
-    	pI830->EXADriverPtr->CheckComposite = i830_check_composite;
-    	pI830->EXADriverPtr->PrepareComposite = i830_prepare_composite;
-    	pI830->EXADriverPtr->Composite = i830_composite;
-    	pI830->EXADriverPtr->DoneComposite = i830_done_composite;
-    } else if (IS_I915G(pI830) || IS_I915GM(pI830) ||
-	       IS_I945G(pI830) || IS_I945GM(pI830) || IS_G33CLASS(pI830))
-    {
-	pI830->EXADriverPtr->CheckComposite = i915_check_composite;
-   	pI830->EXADriverPtr->PrepareComposite = i915_prepare_composite;
-	pI830->EXADriverPtr->Composite = i915_composite;
-    	pI830->EXADriverPtr->DoneComposite = i830_done_composite;
-    } else {
- 	pI830->EXADriverPtr->CheckComposite = i965_check_composite;
- 	pI830->EXADriverPtr->PrepareComposite = i965_prepare_composite;
- 	pI830->EXADriverPtr->Composite = i965_composite;
- 	pI830->EXADriverPtr->DoneComposite = i830_done_composite;
-    }
-#if EXA_VERSION_MINOR >= 2
-    if (!pI830->use_drm_mode)
-	pI830->EXADriverPtr->PixmapIsOffscreen = i830_exa_pixmap_is_offscreen;
-#endif
-
-    if(!exaDriverInit(pScreen, pI830->EXADriverPtr)) {
-	xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-		   "EXA initialization failed; trying older version\n");
-	pI830->EXADriverPtr->exa_minor = 0;
-	if(!exaDriverInit(pScreen, pI830->EXADriverPtr)) {
-	    xfree(pI830->EXADriverPtr);
-	    pI830->accel = ACCEL_NONE;
-	    return FALSE;
-	}
-    }
-
-    return TRUE;
-}
-
 dri_bo *
 i830_get_pixmap_bo(PixmapPtr pixmap)
 {
@@ -752,13 +460,6 @@ i830_get_pixmap_bo(PixmapPtr pixmap)
 	return dixLookupPrivate(&pixmap->devPrivates, &uxa_pixmap_index);
     }
 #endif
-#ifdef XF86DRM_MODE
-    if (i830->accel == ACCEL_EXA) {
-	struct i830_exa_pixmap_priv *driver_priv =
-	    exaGetPixmapDriverPrivate(pixmap);
-	return driver_priv ? driver_priv->bo : NULL;
-    }
-#endif
 
     return NULL;
 }
@@ -779,18 +480,8 @@ i830_set_pixmap_bo(PixmapPtr pixmap, dri_bo *bo)
 	dixSetPrivate(&pixmap->devPrivates, &uxa_pixmap_index, bo);
     }
 #endif
-#ifdef XF86DRM_MODE
-    if (i830->accel == ACCEL_EXA) {
-	struct i830_exa_pixmap_priv *driver_priv =
-	    exaGetPixmapDriverPrivate(pixmap);
-	if (driver_priv) {
-	    if (bo != NULL)
-		dri_bo_reference(bo);
-	    driver_priv->bo = bo;
-	}
-    }
-#endif
 }
+
 #if defined(I830_USE_UXA)
 
 static void
diff --git a/src/i830_memory.c b/src/i830_memory.c
index c46541c..dae8cf9 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -70,10 +70,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  * - Compatibility texture pool (optional, more is always better)
  * - New texture pool (optional, more is always better.  aperture allocation
  *     only)
- * - EXA offscreen pool (more is always better)
- *
- * We also want to be able to resize the front/back/depth buffers, and then
- * resize the EXA and texture memory pools appropriately.
  *
  * The user may request a specific amount of memory to be used
  * (pI830->pEnt->videoRam != 0), in which case allocations have to fit within
@@ -366,7 +362,6 @@ i830_reset_allocations(ScrnInfoPtr pScrn)
 	pI830->cursor_mem_argb[p] = NULL;
     }
     pI830->front_buffer = NULL;
-    pI830->exa_offscreen = NULL;
     pI830->overlay_regs = NULL;
     pI830->power_context = NULL;
     pI830->ring.mem = NULL;
@@ -451,11 +446,6 @@ i830_allocator_init(ScrnInfoPtr pScrn, unsigned long offset, unsigned long size)
 	 */
 	mmsize = size;
 
-	/* EXA area is fixed. */
-	if (pI830->accel == ACCEL_EXA) {
-	    mmsize -= ROUND_TO_PAGE(3 * pScrn->displayWidth * pI830->cpp *
-				    pScrn->virtualY);
-	}
 	/* Overlay and cursors, if physical, need to be allocated outside
 	 * of the kernel memory manager.
 	 */
@@ -1292,8 +1282,6 @@ Bool
 i830_allocate_2d_memory(ScrnInfoPtr pScrn)
 {
     I830Ptr pI830 = I830PTR(pScrn);
-    unsigned int pitch = pScrn->displayWidth * pI830->cpp;
-    long size;
 
     if (!pI830->use_drm_mode) {
 	if (!xf86AgpGARTSupported() || !xf86AcquireGART(pScrn->scrnIndex)) {
@@ -1339,36 +1327,6 @@ i830_allocate_2d_memory(ScrnInfoPtr pScrn)
     if (pI830->front_buffer == NULL)
 	return FALSE;
 
-#ifdef I830_USE_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).
-	     *
-	     * XXX: It would be nice to auto-size it larger if the user
-	     * specified a larger size, or to fit along with texture and FB
-	     * memory if a low videoRam is specified.
-	     */
-	    size = 3 * pitch * pScrn->virtualY;
-	    size = ROUND_TO_PAGE(size);
-
-	    /* EXA has no way to tell it that the offscreen memory manager has
-	     * moved its base and all the contents with it, so we have to have
-	     * it locked in place for the whole driver instance.
-	     */
-	    pI830->exa_offscreen =
-		i830_allocate_memory(pScrn, "exa offscreen",
-				     size, PITCH_NONE, 1, NEED_LIFETIME_FIXED,
-				     TILE_NONE);
-	    if (pI830->exa_offscreen == NULL) {
-		xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
-			   "Failed to allocate EXA offscreen memory.\n");
-		return FALSE;
-	    }
-	}
-    }
-#endif /* I830_USE_EXA */
-
     return TRUE;
 }
 
diff --git a/src/i830_video.c b/src/i830_video.c
index 210f8db..d07fb65 100644
--- a/src/i830_video.c
+++ b/src/i830_video.c
@@ -138,11 +138,6 @@ static Atom xvSyncToVblank;
 #define OVERLAY_DEBUG if (0) ErrorF
 #endif
 
-/* Oops, I never exported this function in EXA.  I meant to. */
-#ifndef exaMoveInPixmap
-void exaMoveInPixmap (PixmapPtr pPixmap);
-#endif
-
 /*
  * OCMD - Overlay Command Register
  */
@@ -2479,13 +2474,6 @@ I830PutImage(ScrnInfoPtr pScrn,
 	pPixmap = (PixmapPtr)pDraw;
     }
 
-#ifdef I830_USE_EXA
-    if (pPriv->textured && pI830->accel == ACCEL_EXA) {
-	/* Force the pixmap into framebuffer so we can draw to it. */
-	exaMoveInPixmap(pPixmap);
-    }
-#endif
-
     if (!pPriv->textured) {
 	i830_display_video(pScrn, crtc, destId, width, height, dstPitch,
 			   x1, y1, x2, y2, &dstBox, src_w, src_h,
commit 1b10745a2528622a32271f64c35fcdb7b7154d11
Author: Eric Anholt <eric at anholt.net>
Date:   Fri Jan 23 08:39:59 2009 -0800

    Remove XAA support.
    
    While EXA/UXA aren't completely good replacements (see bugzilla for
    performance and stability problems), we are pretty sure at this point that
    it's the right way to go and that having multiple acceleration architectures
    is getting in the way of producing a stable codebase.

diff --git a/man/intel.man b/man/intel.man
index 4f8db81..3e74bc2 100644
--- a/man/intel.man
+++ b/man/intel.man
@@ -147,12 +147,10 @@ have options for selecting adaptors.
 Default: Textured video adaptor is preferred.
 .TP
 .BI "Option \*qAccelMethod\*q \*q" string \*q
-Choose acceleration architecture, either "XAA", "EXA", or "UXA".  XAA is the old
-XFree86 based acceleration architecture.  EXA is a simpler
-acceleration architecture designed to better accelerate the X Render extension.
-UXA is a newer acceleration architecture built from the EXA acceleration
-code but taking advantage of kernel memory management to provide simpler,
-faster code.
+Choose acceleration architecture, either "UXA" or "EXA".
+EXA is a simple acceleration architecture designed for systems without
+kernel memory management, while UXA is designed to take advantage of the
+capabilities of kernel memory management.
 .IP
 Default: "UXA" if kernel-modesetting is available, "EXA" otherwise.
 .TP
diff --git a/src/Makefile.am b/src/Makefile.am
index 6ab43fc..6401269 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -32,7 +32,7 @@ SUBDIRS = xvmc bios_reader ch7017 ch7xxx ivch sil164 tfp410 $(REGDUMPER)
 
 AM_CFLAGS = @WARN_CFLAGS@ @XORG_CFLAGS@ @DRM_CFLAGS@ @DRI_CFLAGS@ \
 	@PCIACCESS_CFLAGS@ -I$(top_srcdir)/uxa \
-	-DI830_XV -DI830_USE_XAA -DI830_USE_EXA -DI830_USE_UXA
+	-DI830_XV -DI830_USE_EXA -DI830_USE_UXA
 
 intel_drv_la_LTLIBRARIES = intel_drv.la
 intel_drv_la_LDFLAGS = -module -avoid-version
@@ -112,7 +112,6 @@ intel_drv_la_SOURCES = \
 	 i915_video.c \
 	 i965_video.c \
 	 i830_exa.c \
-	 i830_xaa.c \
 	 i830_render.c \
 	 i915_render.c \
 	 i965_render.c \
diff --git a/src/i830.h b/src/i830.h
index e362d24..9f5dd3a 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -53,7 +53,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "xf86PciInfo.h"
 #include "xf86Pci.h"
 #include "i810_reg.h"
-#include "xaa.h"
 #include "xf86Cursor.h"
 #include "xf86xv.h"
 #include "vgaHW.h"
@@ -93,10 +92,6 @@ dri_bo *i830_get_pixmap_bo (PixmapPtr pixmap);
 void i830_set_pixmap_bo(PixmapPtr pixmap, dri_bo *bo);
 #endif
 
-#ifdef I830_USE_XAA
-Bool I830XAAInit(ScreenPtr pScreen);
-#endif
-
 typedef struct _I830OutputRec I830OutputRec, *I830OutputPtr;
 
 #include "common.h"
@@ -338,7 +333,6 @@ enum backlight_control {
 typedef enum accel_method {
     ACCEL_UNINIT = 0,
     ACCEL_NONE,
-    ACCEL_XAA,
     ACCEL_EXA,
     ACCEL_UXA
 } accel_method_t;
@@ -356,8 +350,6 @@ typedef struct _I830Rec {
    int cpp;
 
    unsigned int bufferOffset;		/* for I830SelectBuffer */
-   BoxRec FbMemBox;
-   int CacheLines;
 
    /* These are set in PreInit and never changed. */
    long FbMapSize;
@@ -381,7 +373,6 @@ typedef struct _I830Rec {
    /* separate small buffers for kernels that support this */
    i830_memory *cursor_mem_classic[2];
    i830_memory *cursor_mem_argb[2];
-   i830_memory *xaa_scratch;
 #ifdef I830_USE_EXA
    i830_memory *exa_offscreen;
 #endif
@@ -455,28 +446,9 @@ typedef struct _I830Rec {
 
    unsigned int BR[20];
 
-   unsigned char **ScanlineColorExpandBuffers;
-   int NumScanlineColorExpandBuffers;
-   int nextColorExpandBuf;
-
    Bool fence_used[FENCE_NEW_NR];
 
    accel_method_t accel;
-#ifdef I830_USE_XAA
-   XAAInfoRecPtr AccelInfoRec;
-
-   /* additional XAA accelerated Composite support */
-   CompositeProcPtr saved_composite;
-   Bool (*xaa_check_composite)(int op, PicturePtr pSrc, PicturePtr pMask,
-			       PicturePtr pDst);
-   Bool (*xaa_prepare_composite)(int op, PicturePtr pSrc, PicturePtr pMask,
-				 PicturePtr pDst, PixmapPtr pSrcPixmap,
-				 PixmapPtr pMaskPixmap, PixmapPtr pDstPixmap);
-   void (*xaa_composite)(PixmapPtr pDst, int xSrc, int ySrc,
-			 int xMask, int yMask, int xDst, int yDst,
-			 int w, int h);
-   void (*xaa_done_composite)(PixmapPtr pDst);
-#endif
    CloseScreenProcPtr CloseScreen;
 
    void (*batch_flush_notify)(ScrnInfoPtr pScrn);
@@ -899,9 +871,9 @@ static inline int i830_fb_compression_supported(I830Ptr pI830)
     if (IS_IGD(pI830))
 	return FALSE;
     /* fbc depends on tiled surface. And we don't support tiled
-     * front buffer with XAA now.
+     * front buffer with unaccelerated.
      */
-    if (!pI830->tiling || (IS_I965G(pI830) && pI830->accel <= ACCEL_XAA))
+    if (!pI830->tiling || (IS_I965G(pI830) && pI830->accel == ACCEL_NONE))
 	return FALSE;
     /* We have not gotten FBC to work consistently on 965GM. Our best
      * working theory right now is that FBC simply isn't reliable on
diff --git a/src/i830_accel.c b/src/i830_accel.c
index 12bb5a2..a3772c5 100644
--- a/src/i830_accel.c
+++ b/src/i830_accel.c
@@ -57,7 +57,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include <errno.h>
 
 #include "xf86.h"
-#include "xaarop.h"
 #include "i830.h"
 #include "i810_reg.h"
 #include "i830_debug.h"
@@ -137,9 +136,6 @@ I830WaitLpRing(ScrnInfoPtr pScrn, int n, int timeout_millis)
 	 else
 	     i830_dump_error_state(pScrn);
 	 ErrorF("space: %d wanted %d\n", ring->space, n);
-#ifdef I830_USE_XAA
-	 pI830->AccelInfoRec = NULL;	/* Stops recursive behavior */
-#endif
 #ifdef I830_USE_EXA
 	 pI830->EXADriverPtr = NULL;
 #endif
@@ -207,8 +203,6 @@ I830Sync(ScrnInfoPtr pScrn)
    } else if (!pI830->use_drm_mode) {
        i830_wait_ring_idle(pScrn);
    }
-
-   pI830->nextColorExpandBuf = 0;
 }
 
 void
@@ -315,10 +309,6 @@ I830AccelInit(ScreenPtr pScreen)
     case ACCEL_EXA:
 	return I830EXAInit(pScreen);
 #endif
-#ifdef I830_USE_XAA
-    case ACCEL_XAA:
-	return I830XAAInit(pScreen);
-#endif
     case ACCEL_UNINIT:
     case ACCEL_NONE:
 	break;
diff --git a/src/i830_driver.c b/src/i830_driver.c
index f8373a8..93bb0ea 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -299,7 +299,6 @@ static PciChipsets I830PciChipsets[] = {
 typedef enum {
    OPTION_ACCELMETHOD,
    OPTION_NOACCEL,
-   OPTION_CACHE_LINES,
    OPTION_DRI,
    OPTION_VIDEO_KEY,
    OPTION_COLOR_KEY,
@@ -319,7 +318,6 @@ typedef enum {
 static OptionInfoRec I830Options[] = {
    {OPTION_ACCELMETHOD,	"AccelMethod",	OPTV_ANYSTR,	{0},	FALSE},
    {OPTION_NOACCEL,	"NoAccel",	OPTV_BOOLEAN,	{0},	FALSE},
-   {OPTION_CACHE_LINES,	"CacheLines",	OPTV_INTEGER,	{0},	FALSE},
    {OPTION_DRI,		"DRI",		OPTV_BOOLEAN,	{0},	TRUE},
    {OPTION_COLOR_KEY,	"ColorKey",	OPTV_INTEGER,	{0},	FALSE},
    {OPTION_VIDEO_KEY,	"VideoKey",	OPTV_INTEGER,	{0},	FALSE},
@@ -1473,7 +1471,6 @@ static const char *accel_name[] =
 {
    "unspecified",
    "no",
-   "XAA",
    "EXA",
    "UXA",
 };
@@ -1574,20 +1571,6 @@ I830AccelMethodInit(ScrnInfoPtr pScrn)
 	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.
-     *
-     * Then, just to make things more confusing, the default EXA will
-     * be overridden to UXA if KMS is available. See I830DrmModeInit.
-     *
-     * All this *will* go away when we remove XAA and EXA support from
-     * this driver. (And there will be much rejoicing.)
-     */
     if (!(pI830->accel == ACCEL_NONE)) {
 #ifdef I830_USE_UXA
 	pI830->accel = ACCEL_UXA;
@@ -1595,7 +1578,7 @@ I830AccelMethodInit(ScrnInfoPtr pScrn)
 #ifdef I830_USE_EXA
 	pI830->accel = ACCEL_EXA;
 #endif
-#if I830_USE_XAA + I830_USE_EXA + I830_USE_UXA >= 2
+#if I830_USE_EXA + I830_USE_UXA >= 2
 	from = X_DEFAULT;
 	if ((s = (char *)xf86GetOptValString(pI830->Options,
 					     OPTION_ACCELMETHOD))) {
@@ -1603,10 +1586,6 @@ I830AccelMethodInit(ScrnInfoPtr pScrn)
 		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;
@@ -1916,16 +1895,6 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
    xf86LoaderReqSymLists(I810fbSymbols, NULL);
 
    switch (pI830->accel) {
-#ifdef I830_USE_XAA
-   case ACCEL_XAA:
-      if (!xf86LoadSubModule(pScrn, "xaa")) {
-	 PreInitCleanup(pScrn);
-	 return FALSE;
-      }
-      xf86LoaderReqSymLists(I810xaaSymbols, NULL);
-      break;
-#endif
-
 #ifdef I830_USE_EXA
    case ACCEL_EXA: {
       XF86ModReqInfo req;
@@ -2499,46 +2468,6 @@ I830PointerMoved(int index, int x, int y)
    (*pI830->PointerMoved)(index, newX, newY);
 }
 
-static Bool
-I830InitFBManager(
-    ScreenPtr pScreen,  
-    BoxPtr FullBox
-){
-   ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
-   RegionRec ScreenRegion;
-   RegionRec FullRegion;
-   BoxRec ScreenBox;
-   Bool ret;
-
-   ScreenBox.x1 = 0;
-   ScreenBox.y1 = 0;
-   ScreenBox.x2 = pScrn->displayWidth;
-   if (pScrn->virtualX > pScrn->virtualY)
-      ScreenBox.y2 = pScrn->virtualX;
-   else
-      ScreenBox.y2 = pScrn->virtualY;
-
-   if((FullBox->x1 >  ScreenBox.x1) || (FullBox->y1 >  ScreenBox.y1) ||
-      (FullBox->x2 <  ScreenBox.x2) || (FullBox->y2 <  ScreenBox.y2)) {
-	return FALSE;   
-   }
-
-   if (FullBox->y2 < FullBox->y1) return FALSE;
-   if (FullBox->x2 < FullBox->x2) return FALSE;
-
-   REGION_INIT(pScreen, &ScreenRegion, &ScreenBox, 1); 
-   REGION_INIT(pScreen, &FullRegion, FullBox, 1); 
-
-   REGION_SUBTRACT(pScreen, &FullRegion, &FullRegion, &ScreenRegion);
-
-   ret = xf86InitFBManagerRegion(pScreen, &FullRegion);
-
-   REGION_UNINIT(pScreen, &ScreenRegion);
-   REGION_UNINIT(pScreen, &FullRegion);
-    
-   return ret;
-}
-
 /**
  * Intialiazes the hardware for the 3D pipeline use in the 2D driver.
  *
@@ -2713,14 +2642,6 @@ i830_memory_init(ScrnInfoPtr pScrn)
 	    pI830->pEnt->device->videoRam ? X_CONFIG : X_DEFAULT,
 	    "VideoRam: %d KB\n", pScrn->videoRam);
 
-    if (xf86GetOptValInteger(pI830->Options, OPTION_CACHE_LINES,
-		&(pI830->CacheLines))) {
-	xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Requested %d cache lines\n",
-		pI830->CacheLines);
-    } else {
-	pI830->CacheLines = -1;
-    }
-
     /* Tiled first if we got a good displayWidth */
     if (tiled) {
 	if (i830_try_memory_allocation(pScrn))
@@ -3067,13 +2988,6 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
 
    DPRINTF(PFX, "assert( if(!I830EnterVT(scrnIndex, 0)) )\n");
 
-   if (pI830->accel <= ACCEL_XAA) {
-      if (!I830InitFBManager(pScreen, &(pI830->FbMemBox))) {
-	 xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-		    "Failed to init memory manager\n");
-      }
-   }
-
     if (pScrn->virtualX > pScrn->displayWidth)
 	pScrn->displayWidth = pScrn->virtualX;
 
@@ -3105,9 +3019,6 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
 
    xf86DiDGAInit (pScreen, pI830->LinearAddr + pScrn->fbOffset);
 
-   DPRINTF(PFX,
-	   "assert( if(!I830InitFBManager(pScreen, &(pI830->FbMemBox))) )\n");
-
    if (pI830->accel != ACCEL_NONE) {
       if (!I830AccelInit(pScreen)) {
 	 xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
@@ -3327,9 +3238,6 @@ I830LeaveVT(int scrnIndex, int flags)
    if ((pI830->accel == ACCEL_EXA || pI830->accel == ACCEL_UXA) && IS_I965G(pI830))
       gen4_render_state_cleanup(pScrn);
 
-   if (pI830->AccelInfoRec)
-      pI830->AccelInfoRec->NeedToSync = FALSE;
-
    ret = drmDropMaster(pI830->drmSubFD);
    if (ret)
       xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
@@ -3483,9 +3391,6 @@ I830CloseScreen(int scrnIndex, ScreenPtr pScreen)
 {
    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
    I830Ptr pI830 = I830PTR(pScrn);
-#ifdef I830_USE_XAA
-   XAAInfoRecPtr infoPtr = pI830->AccelInfoRec;
-#endif
 
    pI830->closing = TRUE;
 
@@ -3503,18 +3408,6 @@ I830CloseScreen(int scrnIndex, ScreenPtr pScreen)
        vgaHWUnmapMem(pScrn);
    }
 
-   if (pI830->ScanlineColorExpandBuffers) {
-      xfree(pI830->ScanlineColorExpandBuffers);
-      pI830->ScanlineColorExpandBuffers = NULL;
-   }
-#ifdef I830_USE_XAA
-   if (infoPtr) {
-      if (infoPtr->ScanlineColorExpandBuffers)
-	 xfree(infoPtr->ScanlineColorExpandBuffers);
-      XAADestroyInfoRec(infoPtr);
-      pI830->AccelInfoRec = NULL;
-   }
-#endif
 #ifdef I830_USE_EXA
    if (pI830->EXADriverPtr) {
        exaDriverFini(pScreen);
@@ -3667,14 +3560,6 @@ i830WaitSync(ScrnInfoPtr pScrn)
    I830Ptr pI830 = I830PTR(pScrn);
 
    switch (pI830->accel) {
-#ifdef I830_USE_XAA
-   case ACCEL_XAA:
-      if (pI830->AccelInfoRec && pI830->AccelInfoRec->NeedToSync) {
-	 (*pI830->AccelInfoRec->Sync)(pScrn);
-	 pI830->AccelInfoRec->NeedToSync = FALSE;
-      }
-      break;
-#endif
 #ifdef I830_USE_EXA
    case ACCEL_EXA:
       if (pI830->EXADriverPtr) {
@@ -3702,12 +3587,6 @@ i830MarkSync(ScrnInfoPtr pScrn)
    I830Ptr pI830 = I830PTR(pScrn);
 
    switch (pI830->accel) {
-#ifdef I830_USE_XAA
-   case ACCEL_XAA:
-      if (pI830->AccelInfoRec)
-	 pI830->AccelInfoRec->NeedToSync = TRUE;
-      break;
-#endif
 #ifdef I830_USE_EXA
    case ACCEL_EXA:
       if (pI830->EXADriverPtr) {
diff --git a/src/i830_memory.c b/src/i830_memory.c
index 14b52ed..c46541c 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -64,11 +64,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  * - Ring buffer
  * - HW cursor block (either one block or four)
  * - Overlay registers
- * - XAA linear allocator (optional)
- * - XAA scratch (screen 1)
- * - XAA scratch (screen 2, only in zaphod mode)
- * - Front buffer (screen 1, more is better for XAA)
- * - Front buffer (screen 2, only in zaphod mode, more is better for XAA)
+ * - Front buffer (screen 1)
+ * - Front buffer (screen 2, only in zaphod mode)
  * - Back/depth buffer (3D only)
  * - Compatibility texture pool (optional, more is always better)
  * - New texture pool (optional, more is always better.  aperture allocation
@@ -369,7 +366,6 @@ i830_reset_allocations(ScrnInfoPtr pScrn)
 	pI830->cursor_mem_argb[p] = NULL;
     }
     pI830->front_buffer = NULL;
-    pI830->xaa_scratch = NULL;
     pI830->exa_offscreen = NULL;
     pI830->overlay_regs = NULL;
     pI830->power_context = NULL;
@@ -1015,8 +1011,7 @@ i830_allocate_ringbuffer(ScrnInfoPtr pScrn)
 
 #ifdef I830_XV
 /**
- * Allocate space for overlay registers and XAA linear allocator (if
- * requested)
+ * Allocate space for overlay registers.
  */
 static Bool
 i830_allocate_overlay(ScrnInfoPtr pScrn)
@@ -1088,13 +1083,6 @@ IsTileable(ScrnInfoPtr pScrn, int pitch)
     }
 }
 
-/* This is the 2D rendering vertical coordinate limit.  We can ignore
- * the 3D rendering limits in our 2d pixmap cache allocation, because XAA
- * doesn't do any 3D rendering to/from the cache lines when using an offset
- * at the start of framebuffer.
- */
-#define MAX_2D_HEIGHT		65536
-
 /**
  * Allocates a framebuffer for a screen.
  *
@@ -1107,7 +1095,6 @@ i830_allocate_framebuffer(ScrnInfoPtr pScrn)
     I830Ptr pI830 = I830PTR(pScrn);
     unsigned int pitch = pScrn->displayWidth * pI830->cpp;
     unsigned long minspace, avail;
-    int cacheLines, maxCacheLines;
     int align;
     long size, fb_height;
     int flags;
@@ -1128,67 +1115,17 @@ i830_allocate_framebuffer(ScrnInfoPtr pScrn)
 	    fb_height = pScrn->virtualY;
     }
 
-    pI830->FbMemBox.x1 = 0;
-    pI830->FbMemBox.x2 = pScrn->displayWidth;
-    pI830->FbMemBox.y1 = 0;
-    pI830->FbMemBox.y2 = fb_height;
-
     /* Calculate how much framebuffer memory to allocate.  For the
      * initial allocation, calculate a reasonable minimum.  This is
-     * enough for the virtual screen size, plus some pixmap cache
-     * space if we're using XAA.
+     * enough for the virtual screen size.
      */
     minspace = pitch * pScrn->virtualY;
     avail = pScrn->videoRam * 1024;
 
-    if (pI830->accel == ACCEL_XAA) {
-	maxCacheLines = (avail - minspace) / pitch;
-	/* This shouldn't happen. */
-	if (maxCacheLines < 0) {
-	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-		       "Internal Error: "
-		       "maxCacheLines < 0 in i830_allocate_2d_memory()\n");
-	    maxCacheLines = 0;
-	}
-	if (maxCacheLines > (MAX_2D_HEIGHT - pScrn->virtualY))
-	    maxCacheLines = MAX_2D_HEIGHT - pScrn->virtualY;
-
-	if (pI830->CacheLines >= 0) {
-	    cacheLines = pI830->CacheLines;
-	} else {
-	    int size;
-
-	    size = 3 * pitch * pScrn->virtualY;
-	    size = ROUND_TO_PAGE(size);
-
-	    cacheLines = (size + pitch - 1) / pitch;
-	}
-	if (cacheLines > maxCacheLines)
-	    cacheLines = maxCacheLines;
-
-	pI830->FbMemBox.y2 += cacheLines;
-
-	xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-		   "Allocating %d scanlines for pixmap cache\n",
-		   cacheLines);
-    } else {
-	/* For non-XAA, we have a separate allocation for the linear allocator
-	 * which also does the pixmap cache.
-	 */
-	cacheLines = 0;
-    }
-
-    size = pitch * (fb_height + cacheLines);
-    size = ROUND_TO_PAGE(size);
+    size = ROUND_TO_PAGE(pitch * fb_height);
 
-    /* Front buffer tiling has to be disabled with G965 XAA because some of the
-     * acceleration operations (non-XY COLOR_BLT) can't be done to tiled
-     * buffers.
-     */
     if (pI830->tiling)
 	tile_format = TILE_XMAJOR;
-    if (pI830->accel == ACCEL_XAA && IS_I965G(pI830))
-	tile_format = TILE_NONE;
 
     if (!IsTileable(pScrn, pitch))
 	tile_format = TILE_NONE;
@@ -1394,9 +1331,6 @@ i830_allocate_2d_memory(ScrnInfoPtr pScrn)
     }
 
 #ifdef I830_XV
-    /* Allocate overlay register space and optional XAA linear allocator
-     * space.  The second head in zaphod mode will share the space.
-     */
     if (!pI830->use_drm_mode)
 	i830_allocate_overlay(pScrn);
 #endif
@@ -1435,29 +1369,6 @@ i830_allocate_2d_memory(ScrnInfoPtr pScrn)
     }
 #endif /* I830_USE_EXA */
 
-    if (pI830->accel == ACCEL_XAA) {
-	/* The lifetime fixed offset of xaa scratch is probably not required,
-	 * but we do some setup using it at XAAInit() time.  And XAA may not
-	 * end up being supported with GEM anyway.
-	 */
-	pI830->xaa_scratch =
-	    i830_allocate_memory(pScrn, "xaa scratch", MAX_SCRATCH_BUFFER_SIZE,
-				 PITCH_NONE, GTT_PAGE_SIZE, NEED_LIFETIME_FIXED,
-				 TILE_NONE);
-	if (pI830->xaa_scratch == NULL) {
-	    pI830->xaa_scratch =
-		i830_allocate_memory(pScrn, "xaa scratch",
-				     MIN_SCRATCH_BUFFER_SIZE, PITCH_NONE,
-				     GTT_PAGE_SIZE, NEED_LIFETIME_FIXED,
-				     TILE_NONE);
-	    if (pI830->xaa_scratch == NULL) {
-		xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
-			   "Failed to allocate scratch buffer space\n");
-		return FALSE;
-	    }
-	}
-    }
-
     return TRUE;
 }
 
diff --git a/src/i830_video.c b/src/i830_video.c
index f73c1f7..210f8db 100644
--- a/src/i830_video.c
+++ b/src/i830_video.c
@@ -70,8 +70,6 @@
 #include "i830_video.h"
 #include "xf86xv.h"
 #include <X11/extensions/Xv.h>
-#include "xaa.h"
-#include "xaalocal.h"
 #include "dixstruct.h"
 #include "fourcc.h"
 
@@ -2488,16 +2486,6 @@ I830PutImage(ScrnInfoPtr pScrn,
     }
 #endif
 
-    if (pPriv->textured && pI830->accel <= ACCEL_XAA &&
-	    (((char *)pPixmap->devPrivate.ptr < (char *)pI830->FbBase) ||
-	     ((char *)pPixmap->devPrivate.ptr >= (char *)pI830->FbBase +
-	      pI830->FbMapSize))) {
-	/* If the pixmap wasn't in framebuffer, then we have no way in XAA to
-	 * force it there.  So, we simply refuse to draw and fail.
-	 */
-	return BadAlloc;
-    }
-
     if (!pPriv->textured) {
 	i830_display_video(pScrn, crtc, destId, width, height, dstPitch,
 			   x1, y1, x2, y2, &dstBox, src_w, src_h,
diff --git a/src/i830_xaa.c b/src/i830_xaa.c
deleted file mode 100644
index a118055..0000000
--- a/src/i830_xaa.c
+++ /dev/null
@@ -1,809 +0,0 @@
-/**************************************************************************
-
-Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
-All Rights Reserved.
-
-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, sub license, 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 NON-INFRINGEMENT.
-IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS 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.
-
-**************************************************************************/
-
-/*
- * Reformatted with GNU indent (2.2.8), using the following options:
- *
- *    -bad -bap -c41 -cd0 -ncdb -ci6 -cli0 -cp0 -ncs -d0 -di3 -i3 -ip3 -l78
- *    -lp -npcs -psl -sob -ss -br -ce -sc -hnl
- *
- * This provides a good match with the original i810 code and preferred
- * XFree86 formatting conventions.
- *
- * When editing this driver, please follow the existing formatting, and edit
- * with <TAB> characters expanded at 8-column intervals.
- */
-
-/*
- * Authors:
- *   Keith Whitwell <keith at tungstengraphics.com>
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <assert.h>
-#include "xf86.h"
-#include "xaarop.h"
-#include "i830.h"
-#include "i810_reg.h"
-#include "mipict.h"
-
-#ifndef DO_SCANLINE_IMAGE_WRITE
-#define DO_SCANLINE_IMAGE_WRITE 0
-#endif
-
-/* I830 Accel Functions */
-static void I830SetupForMono8x8PatternFill(ScrnInfoPtr pScrn,
-					   int pattx, int patty,
-					   int fg, int bg, int rop,
-					   unsigned int planemask);
-static void I830SubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn,
-						 int pattx, int patty,
-						 int x, int y, int w, int h);
-
-static void I830SetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
-							   int fg, int bg,
-							   int rop,
-							   unsigned int mask);
-
-static void I830SubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr
-							     pScrn, int x,
-							     int y, int w,
-							     int h,
-							     int skipleft);
-
-static void I830SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno);
-
-#if DO_SCANLINE_IMAGE_WRITE
-static void I830SetupForScanlineImageWrite(ScrnInfoPtr pScrn, int rop,
-					   unsigned int planemask,
-					   int trans_color, int bpp,
-					   int depth);
-static void I830SubsequentScanlineImageWriteRect(ScrnInfoPtr pScrn,
-						 int x, int y, int w, int h,
-						 int skipleft);
-static void I830SubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno);
-#endif
-
-static void
-i830_xaa_composite(CARD8	op,
-		   PicturePtr	pSrc,
-		   PicturePtr	pMask,
-		   PicturePtr	pDst,
-		   INT16	xSrc,
-		   INT16	ySrc,
-		   INT16	xMask,
-		   INT16	yMask,
-		   INT16	xDst,
-		   INT16	yDst,
-		   CARD16	width,
-		   CARD16	height);
-
-Bool
-I830XAAInit(ScreenPtr pScreen)
-{
-    XAAInfoRecPtr infoPtr;
-    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
-    PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
-    I830Ptr pI830 = I830PTR(pScrn);
-    int i;
-    int width = 0;
-    int nr_buffers = 0;
-    unsigned char *ptr = NULL;
-
-    if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)
-	ErrorF("I830XAAInit\n");
-
-    pI830->AccelInfoRec = infoPtr = XAACreateInfoRec();
-    if (!infoPtr)
-	return FALSE;
-
-    infoPtr->Flags = LINEAR_FRAMEBUFFER | OFFSCREEN_PIXMAPS | PIXMAP_CACHE;
-
-    /* Use the same sync function as the I830.
-     */
-    infoPtr->Sync = I830Sync;
-
-    /* Everything else is different enough to justify different functions */
-    {
-	infoPtr->SolidFillFlags = NO_PLANEMASK;
-	infoPtr->SetupForSolidFill = I830SetupForSolidFill;
-	infoPtr->SubsequentSolidFillRect = I830SubsequentSolidFillRect;
-    }
-
-    {
-	infoPtr->ScreenToScreenCopyFlags = (NO_PLANEMASK | NO_TRANSPARENCY);
-
-	infoPtr->SetupForScreenToScreenCopy = I830SetupForScreenToScreenCopy;
-	infoPtr->SubsequentScreenToScreenCopy =
-	    I830SubsequentScreenToScreenCopy;
-    }
-
-    {
-	infoPtr->SetupForMono8x8PatternFill = I830SetupForMono8x8PatternFill;
-	infoPtr->SubsequentMono8x8PatternFillRect =
-	    I830SubsequentMono8x8PatternFillRect;
-
-	infoPtr->Mono8x8PatternFillFlags = (HARDWARE_PATTERN_PROGRAMMED_BITS |
-					    HARDWARE_PATTERN_SCREEN_ORIGIN |
-					    HARDWARE_PATTERN_PROGRAMMED_ORIGIN|
-					    BIT_ORDER_IN_BYTE_MSBFIRST |
-					    NO_PLANEMASK);
-
-    }
-
-    if (pI830->xaa_scratch->size != 0) {
-	width = ((pScrn->displayWidth + 31) & ~31) / 8;
-	nr_buffers = pI830->xaa_scratch->size / width;
-	ptr = pI830->FbBase + pI830->xaa_scratch->offset;
-    }
-
-    if (nr_buffers) {
-	pI830->NumScanlineColorExpandBuffers = nr_buffers;
-	pI830->ScanlineColorExpandBuffers = (unsigned char **)
-	    xnfcalloc(nr_buffers, sizeof(unsigned char *));
-
-	for (i = 0; i < nr_buffers; i++, ptr += width)
-	    pI830->ScanlineColorExpandBuffers[i] = ptr;
-
-	infoPtr->ScanlineCPUToScreenColorExpandFillFlags =
-	    (NO_PLANEMASK | ROP_NEEDS_SOURCE | BIT_ORDER_IN_BYTE_MSBFIRST);
-
-	infoPtr->ScanlineColorExpandBuffers = (unsigned char **)
-	    xnfcalloc(1, sizeof(unsigned char *));
-	infoPtr->NumScanlineColorExpandBuffers = 1;
-
-	infoPtr->ScanlineColorExpandBuffers[0] =
-	    pI830->ScanlineColorExpandBuffers[0];
-	pI830->nextColorExpandBuf = 0;
-
-	infoPtr->SetupForScanlineCPUToScreenColorExpandFill =
-	    I830SetupForScanlineCPUToScreenColorExpandFill;
-
-	infoPtr->SubsequentScanlineCPUToScreenColorExpandFill =
-	    I830SubsequentScanlineCPUToScreenColorExpandFill;
-
-	infoPtr->SubsequentColorExpandScanline =
-	    I830SubsequentColorExpandScanline;
-
-#if DO_SCANLINE_IMAGE_WRITE
-	infoPtr->NumScanlineImageWriteBuffers = 1;
-	infoPtr->ScanlineImageWriteBuffers =
-	    infoPtr->ScanlineColorExpandBuffers;
-	infoPtr->SetupForScanlineImageWrite = I830SetupForScanlineImageWrite;
-	infoPtr->SubsequentScanlineImageWriteRect =
-	    I830SubsequentScanlineImageWriteRect;
-	infoPtr->SubsequentImageWriteScanline =
-	    I830SubsequentImageWriteScanline;
-	infoPtr->ScanlineImageWriteFlags = NO_GXCOPY |
-	    NO_PLANEMASK |
-	    ROP_NEEDS_SOURCE |
-	    SCANLINE_PAD_DWORD;
-#endif
-    }
-
-    /* Set up pI830->bufferOffset */
-    I830SelectBuffer(pScrn, I830_SELECT_FRONT);
-
-    if (!XAAInit(pScreen, infoPtr))
-	return FALSE;
-
-    if (ps != NULL) {
-	if (IS_I865G(pI830) || IS_I855(pI830) ||
-	    IS_845G(pI830) || IS_I830(pI830))
-	{
-	    pI830->xaa_check_composite = i830_check_composite;
-	    pI830->xaa_prepare_composite = i830_prepare_composite;
-	    pI830->xaa_composite = i830_composite;
-	    pI830->xaa_done_composite = i830_done_composite;
-	} else if (IS_I915G(pI830) || IS_I915GM(pI830) ||
-		   IS_I945G(pI830) || IS_I945GM(pI830) || IS_G33CLASS(pI830))
-	{
-	    pI830->xaa_check_composite = i915_check_composite;
-	    pI830->xaa_prepare_composite = i915_prepare_composite;
-	    pI830->xaa_composite = i830_composite;
-	    pI830->xaa_done_composite = i830_done_composite;
-	} else {
-	    pI830->xaa_check_composite = i965_check_composite;
-	    pI830->xaa_prepare_composite = i965_prepare_composite;
-	    pI830->xaa_composite = i965_composite;
-	    pI830->xaa_done_composite = i830_done_composite;
-	}
-
-	pI830->saved_composite = ps->Composite;
-	ps->Composite = i830_xaa_composite;
-    }
-
-    return TRUE;
-}
-
-static unsigned int
-I830CheckTiling(ScrnInfoPtr pScrn)
-{
-   I830Ptr pI830 = I830PTR(pScrn);
-
-   return pI830->front_buffer->tiling != TILE_NONE;
-}
-
-void
-I830SetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop,
-		      unsigned int planemask)
-{
-    I830Ptr pI830 = I830PTR(pScrn);
-
-    if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)
-	ErrorF("I830SetupForFillRectSolid color: %x rop: %x mask: %x\n",
-	       color, rop, planemask);
-
-    if (IS_I965G(pI830) && I830CheckTiling(pScrn)) {
-	pI830->BR[13] = (pScrn->displayWidth * pI830->cpp) >> 2;
-    } else {
-	pI830->BR[13] = (pScrn->displayWidth * pI830->cpp);
-    }
-
-#ifdef I830_USE_EXA
-    /* This function gets used by I830DRIInitBuffers(), and we might not have
-     * XAAGetPatternROP() available.  So just use the ROPs from our EXA code
-     * if available.
-     */
-    pI830->BR[13] |= (I830PatternROP[rop] << 16);
-#else
-    pI830->BR[13] |= (XAAGetPatternROP(rop) << 16);
-#endif
-
-    pI830->BR[16] = color;
-
-    switch (pScrn->bitsPerPixel) {
-    case 8:
-	break;
-    case 16:
-	pI830->BR[13] |= (1 << 24);
-	break;
-    case 32:
-	pI830->BR[13] |= ((1 << 25) | (1 << 24));
-	break;
-    }
-}
-
-void
-I830SubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h)
-{
-    I830Ptr pI830 = I830PTR(pScrn);
-
-    if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)
-	ErrorF("I830SubsequentFillRectSolid %d,%d %dx%d\n", x, y, w, h);
-
-    {
-	BEGIN_BATCH(6);
-
-	if (pScrn->bitsPerPixel == 32) {
-	    OUT_BATCH(COLOR_BLT_CMD | COLOR_BLT_WRITE_ALPHA |
-		      COLOR_BLT_WRITE_RGB);
-	} else {
-	    OUT_BATCH(COLOR_BLT_CMD);
-	}
-	OUT_BATCH(pI830->BR[13]);
-	OUT_BATCH((h << 16) | (w * pI830->cpp));
-	OUT_BATCH(pI830->front_buffer->offset + (y * pScrn->displayWidth + x) *
-		  pI830->cpp);
-	OUT_BATCH(pI830->BR[16]);
-	OUT_BATCH(0);
-
-	ADVANCE_BATCH();
-    }
-
-    if (IS_I965G(pI830))
-      I830EmitFlush(pScrn);
-}
-
-void
-I830SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, int rop,
-			       unsigned int planemask, int transparency_color)
-{
-    I830Ptr pI830 = I830PTR(pScrn);
-
-    if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)
-	ErrorF("I830SetupForScreenToScreenCopy %d %d %x %x %d\n",
-	       xdir, ydir, rop, planemask, transparency_color);
-
-    if (IS_I965G(pI830) && I830CheckTiling(pScrn)) {
-	pI830->BR[13] = (pScrn->displayWidth * pI830->cpp) >> 2;
-    } else {
-	pI830->BR[13] = (pScrn->displayWidth * pI830->cpp);
-    }
-
-#ifdef I830_USE_EXA
-    /* This function gets used by I830DRIInitBuffers(), and we might not have
-     * XAAGetCopyROP() available.  So just use the ROPs from our EXA code
-     * if available.
-     */
-    pI830->BR[13] |= I830CopyROP[rop] << 16;
-#else
-    pI830->BR[13] |= XAAGetCopyROP(rop) << 16;
-#endif
-
-    switch (pScrn->bitsPerPixel) {
-    case 8:
-	break;
-    case 16:
-	pI830->BR[13] |= (1 << 24);
-	break;
-    case 32:
-	pI830->BR[13] |= ((1 << 25) | (1 << 24));
-	break;
-    }
-
-}
-
-void
-I830SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int src_x1, int src_y1,
-				 int dst_x1, int dst_y1, int w, int h)
-{
-    I830Ptr pI830 = I830PTR(pScrn);
-    int dst_x2, dst_y2;
-    unsigned int tiled = I830CheckTiling(pScrn);
-
-    if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)
-	ErrorF("I830SubsequentScreenToScreenCopy %d,%d - %d,%d %dx%d\n",
-	       src_x1, src_y1, dst_x1, dst_y1, w, h);
-
-    dst_x2 = dst_x1 + w;
-    dst_y2 = dst_y1 + h;
-
-    {
-	BEGIN_BATCH(8);
-
-	if (pScrn->bitsPerPixel == 32) {
-	    OUT_BATCH(XY_SRC_COPY_BLT_CMD | XY_SRC_COPY_BLT_WRITE_ALPHA |
-		      XY_SRC_COPY_BLT_WRITE_RGB | tiled << 15 | tiled << 11);
-	} else {
-	    OUT_BATCH(XY_SRC_COPY_BLT_CMD | tiled << 15 | tiled << 11);
-	}
-	OUT_BATCH(pI830->BR[13]);
-	OUT_BATCH((dst_y1 << 16) | (dst_x1 & 0xffff));
-	OUT_BATCH((dst_y2 << 16) | (dst_x2 & 0xffff));
-	OUT_BATCH(pI830->front_buffer->offset);
-	OUT_BATCH((src_y1 << 16) | (src_x1 & 0xffff));
-	OUT_BATCH(pI830->BR[13] & 0xFFFF);
-	OUT_BATCH(pI830->front_buffer->offset);
-
-	ADVANCE_BATCH();
-    }
-
-    if (IS_I965G(pI830))
-      I830EmitFlush(pScrn);
-}
-
-static void
-I830SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int pattx, int patty,
-			       int fg, int bg, int rop,
-			       unsigned int planemask)
-{
-    I830Ptr pI830 = I830PTR(pScrn);
-
-    if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)
-	ErrorF("I830SetupForMono8x8PatternFill\n");
-
-    pI830->BR[16] = pattx;
-    pI830->BR[17] = patty;
-    pI830->BR[18] = bg;
-    pI830->BR[19] = fg;
-
-    if (IS_I965G(pI830) && I830CheckTiling(pScrn)) {
-	pI830->BR[13] = (pScrn->displayWidth * pI830->cpp) >> 2;
-    } else {
-	pI830->BR[13] = (pScrn->displayWidth * pI830->cpp);
-    }
-    pI830->BR[13] |= XAAGetPatternROP(rop) << 16;
-    if (bg == -1)
-	pI830->BR[13] |= (1 << 28);
-
-    switch (pScrn->bitsPerPixel) {
-    case 8:
-	break;
-    case 16:
-	pI830->BR[13] |= (1 << 24);
-	break;
-    case 32:
-	pI830->BR[13] |= ((1 << 25) | (1 << 24));
-	break;
-    }
-
-}
-
-static void
-I830SubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, int pattx, int patty,
-				     int x, int y, int w, int h)
-{
-    I830Ptr pI830 = I830PTR(pScrn);
-    int x1, x2, y1, y2;
-    unsigned int tiled = I830CheckTiling(pScrn);
-
-    x1 = x;
-    x2 = x + w;
-    y1 = y;
-    y2 = y + h;
-
-    if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)
-	ErrorF("I830SubsequentMono8x8PatternFillRect\n");
-
-    {
-	BEGIN_BATCH(10);
-
-	if (pScrn->bitsPerPixel == 32) {
-	    OUT_BATCH(XY_MONO_PAT_BLT_CMD | XY_MONO_PAT_BLT_WRITE_ALPHA |
-		      XY_MONO_PAT_BLT_WRITE_RGB | tiled << 11 |
-		      ((patty << 8) & XY_MONO_PAT_VERT_SEED) |
-		      ((pattx << 12) & XY_MONO_PAT_HORT_SEED));
-	} else {
-	    OUT_BATCH(XY_MONO_PAT_BLT_CMD | tiled << 11 |
-		      ((patty << 8) & XY_MONO_PAT_VERT_SEED) |
-		      ((pattx << 12) & XY_MONO_PAT_HORT_SEED));
-	}
-	OUT_BATCH(pI830->BR[13]);
-	OUT_BATCH((y1 << 16) | x1);
-	OUT_BATCH((y2 << 16) | x2);
-	OUT_BATCH(pI830->front_buffer->offset);
-	OUT_BATCH(pI830->BR[18]);		/* bg */
-	OUT_BATCH(pI830->BR[19]);		/* fg */
-	OUT_BATCH(pI830->BR[16]);		/* pattern data */
-	OUT_BATCH(pI830->BR[17]);
-	OUT_BATCH(0);
-	ADVANCE_BATCH();
-    }
-
-    if (IS_I965G(pI830))
-      I830EmitFlush(pScrn);
-}
-
-static void
-I830GetNextScanlineColorExpandBuffer(ScrnInfoPtr pScrn)
-{
-    I830Ptr pI830 = I830PTR(pScrn);
-    XAAInfoRecPtr infoPtr = pI830->AccelInfoRec;
-
-    if (pI830->nextColorExpandBuf == pI830->NumScanlineColorExpandBuffers)
-	I830Sync(pScrn);
-
-    infoPtr->ScanlineColorExpandBuffers[0] =
-	pI830->ScanlineColorExpandBuffers[pI830->nextColorExpandBuf];
-
-    if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)
-	ErrorF("using color expand buffer %d\n", pI830->nextColorExpandBuf);
-
-    pI830->nextColorExpandBuf++;
-}
-
-static void
-I830SetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
-					       int fg, int bg, int rop,
-					       unsigned int planemask)
-{
-    I830Ptr pI830 = I830PTR(pScrn);
-
-    if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)
-	ErrorF("I830SetupForScanlineScreenToScreenColorExpand %d %d %x %x\n",
-	       fg, bg, rop, planemask);
-
-    /* Fill out register values */
-    if (IS_I965G(pI830) && I830CheckTiling(pScrn)) {
-	pI830->BR[13] = (pScrn->displayWidth * pI830->cpp) >> 2;
-    } else {
-	pI830->BR[13] = (pScrn->displayWidth * pI830->cpp);
-    }
-    pI830->BR[13] |= XAAGetCopyROP(rop) << 16;
-    if (bg == -1)
-	pI830->BR[13] |= (1 << 29);
-
-    switch (pScrn->bitsPerPixel) {
-    case 8:
-	break;
-    case 16:
-	pI830->BR[13] |= (1 << 24);
-	break;
-    case 32:
-	pI830->BR[13] |= ((1 << 25) | (1 << 24));
-	break;
-    }
-
-    pI830->BR[18] = bg;
-    pI830->BR[19] = fg;
-
-    I830GetNextScanlineColorExpandBuffer(pScrn);
-}
-
-static void
-I830SubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
-						 int x, int y,
-						 int w, int h, int skipleft)
-{
-    I830Ptr pI830 = I830PTR(pScrn);
-
-    if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)
-	ErrorF("I830SubsequentScanlineCPUToScreenColorExpandFill "
-	       "%d,%d %dx%x %d\n", x, y, w, h, skipleft);
-
-    /* Fill out register values */
-    pI830->BR[9] = (pI830->front_buffer->offset +
-		    (y * pScrn->displayWidth + x) * pI830->cpp);
-    pI830->BR[11] = ((1 << 16) | w);
-}
-
-static void
-I830SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno)
-{
-    I830Ptr pI830 = I830PTR(pScrn);
-    unsigned int tiled = I830CheckTiling(pScrn);
-
-    pI830->BR[12] = (pI830->AccelInfoRec->ScanlineColorExpandBuffers[0] -
-		     pI830->FbBase);
-
-    if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)
-	ErrorF("I830SubsequentColorExpandScanline %d (addr %x)\n",
-	       bufno, pI830->BR[12]);
-
-    {
-	BEGIN_BATCH(8);
-
-	if (pScrn->bitsPerPixel == 32) {
-	    OUT_BATCH(XY_MONO_SRC_BLT_CMD | XY_MONO_SRC_BLT_WRITE_ALPHA |
-		      tiled << 11 | XY_MONO_SRC_BLT_WRITE_RGB);
-	} else {
-	    OUT_BATCH(XY_MONO_SRC_BLT_CMD | tiled << 11);
-	}
-	OUT_BATCH(pI830->BR[13]);
-	OUT_BATCH(0);			/* x1 = 0, y1 = 0 */
-	OUT_BATCH(pI830->BR[11]);		/* x2 = w, y2 = 1 */
-	OUT_BATCH(pI830->BR[9]);		/* dst addr */
-	OUT_BATCH(pI830->BR[12]);		/* src addr */
-	OUT_BATCH(pI830->BR[18]);		/* bg */
-	OUT_BATCH(pI830->BR[19]);		/* fg */
-
-	ADVANCE_BATCH();
-    }
-
-    /* Advance to next scanline.
-     */
-    pI830->BR[9] += pScrn->displayWidth * pI830->cpp;
-    I830GetNextScanlineColorExpandBuffer(pScrn);
-
-    if (IS_I965G(pI830))
-      I830EmitFlush(pScrn);
-}
-
-#if DO_SCANLINE_IMAGE_WRITE
-static void
-I830SetupForScanlineImageWrite(ScrnInfoPtr pScrn, int rop,
-			       unsigned int planemask, int trans_color,
-			       int bpp, int depth)
-{
-    I830Ptr pI830 = I830PTR(pScrn);
-
-    if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)
-	ErrorF("I830SetupForScanlineImageWrite %x %x\n", rop, planemask);
-
-    /* Fill out register values */
-    if (IS_I965G(pI830) && I830CheckTiling(pScrn)) {
-	pI830->BR[13] = (pScrn->displayWidth * pI830->cpp) >> 2;
-    } else {
-	pI830->BR[13] = (pScrn->displayWidth * pI830->cpp);
-    }
-    pI830->BR[13] |= XAAGetCopyROP(rop) << 16;
-
-    switch (pScrn->bitsPerPixel) {
-    case 8:
-	break;
-    case 16:
-	pI830->BR[13] |= (1 << 24);
-	break;
-    case 32:
-	pI830->BR[13] |= ((1 << 25) | (1 << 24));
-	break;
-    }
-
-    I830GetNextScanlineColorExpandBuffer(pScrn);
-}
-
-static void
-I830SubsequentScanlineImageWriteRect(ScrnInfoPtr pScrn, int x, int y,
-				     int w, int h, int skipleft)
-{
-    I830Ptr pI830 = I830PTR(pScrn);
-
-    if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)
-	ErrorF("I830SubsequentScanlineImageWriteRect "
-	       "%d,%d %dx%x %d\n", x, y, w, h, skipleft);
-
-    /* Fill out register values */
-    pI830->BR[9] = (pI830->front_buffer->offset +
-		    (y * pScrn->displayWidth + x) * pI830->cpp);
-    pI830->BR[11] = ((1 << 16) | w);
-}
-
-static void
-I830SubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno)
-{
-    I830Ptr pI830 = I830PTR(pScrn);
-    unsigned int tiled = I830CheckTiling(pScrn);
-
-    pI830->BR[12] = (pI830->AccelInfoRec->ScanlineColorExpandBuffers[0] -
-		     pI830->FbBase);
-
-    if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)
-	ErrorF("I830SubsequentImageWriteScanline %d (addr %x)\n",
-	       bufno, pI830->BR[12]);
-
-    {
-	BEGIN_BATCH(8);
-
-	if (pScrn->bitsPerPixel == 32) {
-	    OUT_BATCH(XY_SRC_COPY_BLT_CMD | XY_SRC_COPY_BLT_WRITE_ALPHA |
-		      tiled << 11 | XY_SRC_COPY_BLT_WRITE_RGB);
-	} else {
-	    OUT_BATCH(XY_SRC_COPY_BLT_CMD | tiled << 11);
-	}
-	OUT_BATCH(pI830->BR[13]);
-	OUT_BATCH(0);				/* x1 = 0, y1 = 0 */
-	OUT_BATCH(pI830->BR[11]);		/* x2 = w, y2 = 1 */
-	OUT_BATCH(pI830->BR[9]);			/* dst addr */
-	OUT_BATCH(0);				/* source origin (0,0) */
-	OUT_BATCH(pI830->BR[11] & 0xffff);	/* source pitch */
-	OUT_BATCH(pI830->BR[12]);		/* src addr */
-
-	ADVANCE_BATCH();
-    }
-
-    /* Advance to next scanline.
-     */
-    pI830->BR[9] += pScrn->displayWidth * pI830->cpp;
-    I830GetNextScanlineColorExpandBuffer(pScrn);
-}
-#endif /* DO_SCANLINE_IMAGE_WRITE */
-/* Support for multiscreen */
-
-/**
- * Special case acceleration for Render acceleration of rotation operations
- * by xf86Rotate.c
- */
-static void
-i830_xaa_composite(CARD8	op,
-		   PicturePtr	pSrc,
-		   PicturePtr	pMask,
-		   PicturePtr	pDst,
-		   INT16	xSrc,
-		   INT16	ySrc,
-		   INT16	xMask,
-		   INT16	yMask,
-		   INT16	xDst,
-		   INT16	yDst,
-		   CARD16	width,
-		   CARD16	height)
-{
-    ScreenPtr pScreen = pDst->pDrawable->pScreen;
-    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
-    I830Ptr pI830 = I830PTR(pScrn);
-    xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
-    PictureScreenPtr ps;
-    PixmapPtr pSrcPixmap, pDstPixmap;
-    RegionRec region;
-    BoxPtr pbox;
-    int nbox;
-    int	i;
-
-    /* Throw out cases that aren't going to be our rotation first */
-    if (pMask != NULL || op != PictOpSrc || pSrc->pDrawable == NULL)
-	goto fallback;
-
-    if (pSrc->pDrawable->type != DRAWABLE_WINDOW ||
-	pDst->pDrawable->type != DRAWABLE_PIXMAP)
-    {
-	goto fallback;
-    }
-    pSrcPixmap = (*pScreen->GetWindowPixmap) ((WindowPtr) pSrc->pDrawable);
-    pDstPixmap = (PixmapPtr)pDst->pDrawable;
-
-    /* Check if the dest is one of our shadow pixmaps */
-    for (i = 0; i < xf86_config->num_crtc; i++) {
-	xf86CrtcPtr crtc = xf86_config->crtc[i];
-
-	if (crtc->rotatedPixmap == pDstPixmap)
-	    break;
-    }
-    if (i == xf86_config->num_crtc)
-	goto fallback;
-
-    if (pSrcPixmap != pScreen->GetScreenPixmap(pScreen))
-	goto fallback;
-
-    /* OK, so we've got a Render operation on one of our shadow pixmaps, with
-     * the source being the real framebuffer.  We know that both of these are
-     * in framebuffer, with no x/y offsets, i.e. normal pixmaps like our EXA-
-     * based Render acceleration code expects.
-     */
-    assert(pSrcPixmap->drawable.x == 0);
-    assert(pSrcPixmap->drawable.y == 0);
-    assert(pDstPixmap->drawable.x == 0);
-    assert(pDstPixmap->drawable.y == 0);
-
-    if (!miComputeCompositeRegion (&region, pSrc, NULL, pDst,
-				   xSrc, ySrc, 0, 0, xDst, yDst,
-				   width, height))
-	return;
-
-    if (!pI830->xaa_check_composite(op, pSrc, NULL, pDst)) {
-	REGION_UNINIT(pScreen, &region);
-	goto fallback;
-    }
-
-    if (!pI830->xaa_prepare_composite(op, pSrc, NULL, pDst,
-				      pSrcPixmap, NULL, pDstPixmap))
-    {
-	REGION_UNINIT(pScreen, &region);
-	goto fallback;
-    }
-
-    nbox = REGION_NUM_RECTS(&region);
-    pbox = REGION_RECTS(&region);
-
-    xSrc -= xDst;
-    ySrc -= yDst;
-
-    while (nbox--)
-    {
-	pI830->xaa_composite(pDstPixmap,
-			     pbox->x1 + xSrc,
-			     pbox->y1 + ySrc,
-			     0, 0,
-			     pbox->x1,
-			     pbox->y1,
-			     pbox->x2 - pbox->x1,
-			     pbox->y2 - pbox->y1);
-	pbox++;
-    }
-
-    REGION_UNINIT(pDst->pDrawable->pScreen, &region);
-
-    pI830->xaa_done_composite(pDstPixmap);
-    i830MarkSync(pScrn);
-
-    return;
-
-fallback:
-    /* Fallback path: Call down to the next level (XAA) */
-    ps = GetPictureScreenIfSet(pScreen);
-
-    ps->Composite = pI830->saved_composite;
-
-    ps->Composite(op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, xDst, yDst,
-		  width, height);
-
-    pI830->saved_composite = ps->Composite;
-    ps->Composite = i830_xaa_composite;
-}
commit 30c226eeb35f034c3ddb881e77454051dc210298
Author: Eric Anholt <eric at anholt.net>
Date:   Thu Jan 22 17:54:49 2009 -0800

    Remove DRI1 support.
    
    This was blocked on wide distribution of X Server 1.6 (now in the current or
    next version of major distributions) and solutions for a couple of significant
    architectural problems (vblank sync and frontbuffer rendering, which we now
    have code or good plans for).
    
    This includes disabling XVMC which is DRI1-only currently.

diff --git a/configure.ac b/configure.ac
index 8dd04d5..18fe983 100644
--- a/configure.ac
+++ b/configure.ac
@@ -70,10 +70,10 @@ AC_ARG_ENABLE(video-debug, AC_HELP_STRING([--enable-video-debug],
               [VIDEO_DEBUG="$enableval"],
               [VIDEO_DEBUG=no])
 
-AC_ARG_ENABLE(xvmc, AC_HELP_STRING([--disable-xvmc],
-                                  [Disable XvMC support [[default=auto]]]),
-              [XVMC="$enableval"],
-              [XVMC=auto])
+dnl AC_ARG_ENABLE(xvmc, AC_HELP_STRING([--disable-xvmc],
+dnl                                   [Disable XvMC support [[default=auto]]]),
+dnl               [XVMC="$enableval"],
+dnl               [XVMC=auto])
 
 # Checks for extensions
 XORG_DRIVER_CHECK_EXT(XINERAMA, xineramaproto)
diff --git a/src/i830.h b/src/i830.h
index 26f4bda..e362d24 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -65,21 +65,18 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include <pciaccess.h>
 #endif
 
-#ifdef XF86DRI
 #include "xf86drm.h"
 #include "sarea.h"
 #define _XF86DRI_SERVER_
 #include "dri.h"
 #include "GL/glxint.h"
 #include "i830_dri.h"
-#endif
 #include "intel_bufmgr.h"
 #include "i915_drm.h"
 
 #ifdef I830_USE_EXA
 #include "exa.h"
 Bool I830EXAInit(ScreenPtr pScreen);
-unsigned long long I830TexOffsetStart(PixmapPtr pPix);
 #endif
 
 #ifdef I830_USE_UXA
@@ -106,18 +103,6 @@ typedef struct _I830OutputRec I830OutputRec, *I830OutputPtr;
 #include "i830_sdvo.h"
 #include "i2c_vid.h"
 
-/*
- * The mode handling is based upon the VESA driver written by
- * Paulo César Pereira de Andrade <pcpa at conectiva.com.br>.
- */
-
-#ifdef XF86DRI
-#define I830_MM_MINPAGES 512
-#define I830_MM_MAXSIZE  (32*1024)
-#define I830_KERNEL_MM  (1 << 0) /* Initialize the kernel memory manager*/
-#define I830_KERNEL_TEX (1 << 1) /* Allocate texture memory pool */
-#endif
-
 #ifdef XvMCExtension
 #ifdef ENABLE_XVMC
 #define INTEL_XVMC 1
@@ -361,7 +346,6 @@ typedef enum accel_method {
 enum dri_type {
     DRI_DISABLED,
     DRI_NONE,
-    DRI_XF86DRI,
     DRI_DRI2
 };
 
@@ -445,22 +429,10 @@ typedef struct _I830Rec {
 
    i830_memory *power_context;
 
-#ifdef XF86DRI
-   i830_memory *back_buffer;
-   i830_memory *depth_buffer;
-   i830_memory *textures;		/**< Compatibility texture memory */
    i830_memory *memory_manager;		/**< DRI memory manager aperture */
-   i830_memory *hw_status;		/* for G33 hw status page alloc */
-
-   int TexGranularity;
-   int drmMinor;
-   Bool allocate_classic_textures;
 
    Bool can_resize;
 
-   Bool want_vblank_interrupts;
-#endif
-
    Bool need_mi_flush;
 
    Bool tiling;
@@ -575,18 +547,9 @@ typedef struct _I830Rec {
 
    enum dri_type directRenderingType;	/* DRI enabled this generation. */
 
-#ifdef XF86DRI
    Bool directRenderingOpen;
-   int LockHeld;
-   DRIInfoPtr pDRIInfo;
    int drmSubFD;
-   int numVisualConfigs;
-   __GLXvisualConfig *pVisualConfigs;
-   I830ConfigPrivPtr pVisualConfigsPriv;
-   drm_handle_t buffer_map;
-   drm_handle_t ring_map;
    char deviceName[64];
-#endif
 
    /* Broken-out options. */
    OptionInfoPtr Options;
@@ -779,26 +742,8 @@ i830_pipe_a_require_activate (ScrnInfoPtr scrn);
 void
 i830_pipe_a_require_deactivate (ScrnInfoPtr scrn);
 
-#ifdef XF86DRI
-extern Bool I830Allocate3DMemory(ScrnInfoPtr pScrn, const int flags);
-extern void I830SetupMemoryTiling(ScrnInfoPtr pScrn);
-extern Bool I830DRIScreenInit(ScreenPtr pScreen);
-extern Bool I830DRIDoMappings(ScreenPtr pScreen);
-extern Bool I830DRIResume(ScreenPtr pScreen);
-extern void I830DRICloseScreen(ScreenPtr pScreen);
-extern Bool I830DRIFinishScreenInit(ScreenPtr pScreen);
-extern void I830DRIUnlock(ScrnInfoPtr pScrn);
-extern Bool I830DRILock(ScrnInfoPtr pScrn);
-extern Bool I830DRISetVBlankInterrupt (ScrnInfoPtr pScrn, Bool on);
-extern Bool i830_update_dri_buffers(ScrnInfoPtr pScrn);
-extern Bool I830DRISetHWS(ScrnInfoPtr pScrn);
-extern Bool I830DRIInstIrqHandler(ScrnInfoPtr pScrn);
-#endif
-
-#ifdef DRI2
 Bool I830DRI2ScreenInit(ScreenPtr pScreen);
 void I830DRI2CloseScreen(ScreenPtr pScreen);
-#endif
 
 #ifdef XF86DRM_MODE
 extern Bool drmmode_pre_init(ScrnInfoPtr pScrn, int fd, int cpp);
diff --git a/src/i830_accel.c b/src/i830_accel.c
index cae36dc..12bb5a2 100644
--- a/src/i830_accel.c
+++ b/src/i830_accel.c
@@ -137,12 +137,6 @@ I830WaitLpRing(ScrnInfoPtr pScrn, int n, int timeout_millis)
 	 else
 	     i830_dump_error_state(pScrn);
 	 ErrorF("space: %d wanted %d\n", ring->space, n);
-#ifdef XF86DRI
-	 if (pI830->directRenderingType == DRI_XF86DRI) {
-	    DRIUnlock(screenInfo.screens[pScrn->scrnIndex]);
-	    DRICloseScreen(screenInfo.screens[pScrn->scrnIndex]);
-	 }
-#endif
 #ifdef I830_USE_XAA
 	 pI830->AccelInfoRec = NULL;	/* Stops recursive behavior */
 #endif
@@ -180,14 +174,6 @@ I830Sync(ScrnInfoPtr pScrn)
    if (pI830->accel == ACCEL_NONE || !pScrn->vtSema || !pI830->batch_bo)
        return;
 
-#ifdef XF86DRI
-   /* VT switching tries to do this.
-    */
-   if (!pI830->LockHeld && pI830->directRenderingType == DRI_XF86DRI) {
-      return;
-   }
-#endif
-
    I830EmitFlush(pScrn);
 
    intel_batch_flush(pScrn, TRUE);
@@ -241,35 +227,6 @@ I830EmitFlush(ScrnInfoPtr pScrn)
    }
 }
 
-Bool
-I830SelectBuffer(ScrnInfoPtr pScrn, int buffer)
-{
-   I830Ptr pI830 = I830PTR(pScrn);
-
-   switch (buffer) {
-#ifdef XF86DRI
-   case I830_SELECT_BACK:
-      pI830->bufferOffset = pI830->back_buffer->offset;
-      if (pI830->back_buffer->tiling == TILE_YMAJOR)
-	 return FALSE;
-      break;
-   case I830_SELECT_DEPTH:
-      pI830->bufferOffset = pI830->depth_buffer->offset;
-      if (pI830->depth_buffer->tiling == TILE_YMAJOR)
-	 return FALSE;
-      break;
-#endif
-   default:
-   case I830_SELECT_FRONT:
-      pI830->bufferOffset = pScrn->fbOffset;
-      break;
-   }
-
-   if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)
-      ErrorF("I830SelectBuffer %d --> offset %x\n",
-	     buffer, pI830->bufferOffset);
-   return TRUE;
-}
 
 #if (ALWAYS_SYNC || ALWAYS_FLUSH)
 void
diff --git a/src/i830_display.c b/src/i830_display.c
index 847dc22..c8e94ff 100644
--- a/src/i830_display.c
+++ b/src/i830_display.c
@@ -698,7 +698,6 @@ i830PipeSetBase(xf86CrtcPtr crtc, int x, int y)
     ScrnInfoPtr pScrn = crtc->scrn;
     I830Ptr pI830 = I830PTR(pScrn);
     I830CrtcPrivatePtr	intel_crtc = crtc->driver_private;
-    int pipe = intel_crtc->pipe;
     int plane = intel_crtc->plane;
     unsigned long Start, Offset, Stride;
     int dspbase = (plane == 0 ? DSPABASE : DSPBBASE);
@@ -737,30 +736,6 @@ i830PipeSetBase(xf86CrtcPtr crtc, int x, int y)
 	OUTREG(dspbase, Start + Offset);
 	POSTING_READ(dspbase);
     }
-
-#ifdef XF86DRI
-    if (pI830->directRenderingType == DRI_XF86DRI) {
-	drmI830Sarea *sPriv = (drmI830Sarea *) DRIGetSAREAPrivate(pScrn->pScreen);
-
-	if (!sPriv)
-	    return;
-
-	switch (pipe) {
-	case 0:
-	    sPriv->pipeA_x = x;
-	    sPriv->pipeA_y = y;
-	    break;
-	case 1:
-	    sPriv->pipeB_x = x;
-	    sPriv->pipeB_y = y;
-	    break;
-	default:
-	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-		       "Can't update pipe %d in SAREA\n", pipe);
-	    break;
-	}
-    }
-#endif
 }
 
 /*
@@ -1062,7 +1037,7 @@ i830_use_fb_compression(xf86CrtcPtr crtc)
     return TRUE;
 }
 
-#if defined(DRM_IOCTL_MODESET_CTL) && (defined(XF86DRI) || defined(DRI2))
+#if defined(DRM_IOCTL_MODESET_CTL)
 static void i830_modeset_ctl(xf86CrtcPtr crtc, int pre)
 {
     ScrnInfoPtr pScrn = crtc->scrn;
@@ -1094,7 +1069,7 @@ static void i830_modeset_ctl(xf86CrtcPtr crtc, int dpms_state)
 {
     return;
 }
-#endif /* DRM_IOCTL_MODESET_CTL && (XF86DRI || DRI2) */
+#endif /* DRM_IOCTL_MODESET_CTL */
 
 static void
 i830_disable_vga_plane (xf86CrtcPtr crtc)
@@ -1286,54 +1261,20 @@ i830_crtc_dpms(xf86CrtcPtr crtc, int mode)
     }
 
     intel_crtc->dpms_mode = mode;
-
-#ifdef XF86DRI
-    if (pI830->directRenderingType == DRI_XF86DRI) {
-	drmI830Sarea *sPriv = (drmI830Sarea *) DRIGetSAREAPrivate(pScrn->pScreen);
-	Bool enabled = crtc->enabled && mode != DPMSModeOff;
-
-	I830DRISetVBlankInterrupt (pScrn, TRUE);
-
-	if (!sPriv)
-	    return;
-
-	switch (pipe) {
-	case 0:
-	    sPriv->pipeA_w = enabled ? crtc->mode.HDisplay : 0;
-	    sPriv->pipeA_h = enabled ? crtc->mode.VDisplay : 0;
-	    break;
-	case 1:
-	    sPriv->pipeB_w = enabled ? crtc->mode.HDisplay : 0;
-	    sPriv->pipeB_h = enabled ? crtc->mode.VDisplay : 0;
-	    break;
-	default:
-	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-		       "Can't update pipe %d in SAREA\n", pipe);
-	    break;
-	}
-    }
-#endif
 }
 
 static Bool
 i830_crtc_lock (xf86CrtcPtr crtc)
 {
-   /* Sync the engine before mode switch */
-   i830WaitSync(crtc->scrn);
+    /* Sync the engine before mode switch */
+    i830WaitSync(crtc->scrn);
 
-#ifdef XF86DRI
-    return I830DRILock(crtc->scrn);
-#else
     return FALSE;
-#endif
 }
 
 static void
 i830_crtc_unlock (xf86CrtcPtr crtc)
 {
-#ifdef XF86DRI
-    I830DRIUnlock (crtc->scrn);
-#endif
 }
 
 static void
@@ -1368,11 +1309,6 @@ i830_crtc_commit (xf86CrtcPtr crtc)
     /* Reenable FB compression if possible */
     if (i830_use_fb_compression(crtc))
 	i830_enable_fb_compression(crtc);
-
-#ifdef XF86DRI
-    /* Tell DRI1 the news about new output config */
-    i830_update_dri_buffers(crtc->scrn);
-#endif
 }
 
 void
@@ -1919,10 +1855,7 @@ i830_crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode,
     OUTREG(dspcntr_reg, dspcntr);
     /* Flush the plane changes */
     i830PipeSetBase(crtc, x, y);
-#ifdef XF86DRI
-   I830DRISetVBlankInterrupt (pScrn, TRUE);
-#endif
-    
+
     i830WaitForVblank(pScrn);
 }
 
diff --git a/src/i830_dri.c b/src/i830_dri.c
index 93bb340..745162d 100644
--- a/src/i830_dri.c
+++ b/src/i830_dri.c
@@ -89,11 +89,9 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 #include "i915_drm.h"
 
-#include "dristruct.h"
-
-#ifdef DRI2
 #include "dri2.h"
 
+#ifdef DRI2
 #if DRI2INFOREC_VERSION >= 1
 #define USE_DRI2_1_1_0
 #endif
@@ -101,1438 +99,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 extern XF86ModuleData dri2ModuleData;
 #endif
 
-static Bool I830InitVisualConfigs(ScreenPtr pScreen);
-static Bool I830CreateContext(ScreenPtr pScreen, VisualPtr visual,
-			      drm_context_t hwContext, void *pVisualConfigPriv,
-			      DRIContextType contextStore);
-static void I830DestroyContext(ScreenPtr pScreen, drm_context_t hwContext,
-			       DRIContextType contextStore);
-static void I830DRISwapContext(ScreenPtr pScreen, DRISyncType syncType,
-			       DRIContextType readContextType,
-			       void *readContextStore,
-			       DRIContextType writeContextType,
-			       void *writeContextStore);
-static void I830DRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index);
-static void I830DRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg,
-			       RegionPtr prgnSrc, CARD32 index);
-
-static void I830DRITransitionTo2d(ScreenPtr pScreen);
-static void I830DRITransitionTo3d(ScreenPtr pScreen);
-
-#if (DRIINFO_MAJOR_VERSION > 5 || \
-     (DRIINFO_MAJOR_VERSION == 5 && DRIINFO_MINOR_VERSION >= 4))
-#define DRI_DRIVER_FRAMEBUFFER_MAP 1
-#else
-#define DRI_DRIVER_FRAMEBUFFER_MAP 0
-#endif
-
-extern void GlxSetVisualConfigs(int nconfigs,
-				__GLXvisualConfig * configs,
-				void **configprivs);
-
-static Bool
-I830CleanupDma(ScrnInfoPtr pScrn)
-{
-   I830Ptr pI830 = I830PTR(pScrn);
-   drmI830Init info;
-
-   memset(&info, 0, sizeof(drmI830Init));
-   info.func = I830_CLEANUP_DMA;
-
-   if (drmCommandWrite(pI830->drmSubFD, DRM_I830_INIT,
-		       &info, sizeof(drmI830Init))) {
-      xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "I830 Dma Cleanup Failed\n");
-      return FALSE;
-   }
-
-   return TRUE;
-}
-
-static Bool
-I830InitDma(ScrnInfoPtr pScrn)
-{
-   I830Ptr pI830 = I830PTR(pScrn);
-   I830RingBuffer *ring = &pI830->ring;
-   I830DRIPtr pI830DRI = (I830DRIPtr) pI830->pDRIInfo->devPrivate;
-   drmI830Init info;
-
-   memset(&info, 0, sizeof(drmI830Init));
-   info.func = I830_INIT_DMA;
-
-   /* Initialize fields that are used in the absence of GEM */
-   if (!pI830->memory_manager && !pI830->use_drm_mode) {
-       info.ring_start = ring->mem->offset + pI830->LinearAddr;
-       info.ring_end = ring->mem->end + pI830->LinearAddr;
-       info.ring_size = ring->mem->size;
-
-       /* Not used as of the middle of GEM development. */
-       info.mmio_offset = (unsigned int)pI830DRI->regs;
-
-       /* Not used as of before GEM development */
-       info.front_offset = pI830->front_buffer->offset;
-       info.back_offset = pI830->back_buffer->offset;
-       info.depth_offset = pI830->depth_buffer->offset;
-       info.pitch = pScrn->displayWidth;
-       info.back_pitch = pScrn->displayWidth;
-       info.depth_pitch = pScrn->displayWidth;
-       info.w = pScrn->virtualX;
-       info.h = pScrn->virtualY;
-   }
-
-
-   info.sarea_priv_offset = sizeof(XF86DRISAREARec);
-
-   /* This should probably have been moved alongside offset/pitch in the sarea.
-    */
-   info.cpp = pI830->cpp;
-
-   if (drmCommandWrite(pI830->drmSubFD, DRM_I830_INIT,
-		       &info, sizeof(drmI830Init))) {
-      xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-		 "I830 Dma Initialization Failed\n");
-      return FALSE;
-   }
-
-   return TRUE;
-}
-
-static Bool
-I830ResumeDma(ScrnInfoPtr pScrn)
-{
-   I830Ptr pI830 = I830PTR(pScrn);
-   drmI830Init info;
-
-   memset(&info, 0, sizeof(drmI830Init));
-   info.func = I830_RESUME_DMA;
-
-   if (drmCommandWrite(pI830->drmSubFD, DRM_I830_INIT,
-		       &info, sizeof(drmI830Init))) {
-      xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "I830 Dma Resume Failed\n");
-      return FALSE;
-   }
-
-   return TRUE;
-}
-
-static Bool
-I830SetParam(ScrnInfoPtr pScrn, int param, int value)
-{
-   I830Ptr pI830 = I830PTR(pScrn);
-   drmI830SetParam sp;
-
-   memset(&sp, 0, sizeof(sp));
-   sp.param = param;
-   sp.value = value;
-
-   if (drmCommandWrite(pI830->drmSubFD, DRM_I830_SETPARAM, &sp, sizeof(sp))) {
-      xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "I830 SetParam Failed\n");
-      return FALSE;
-   }
-
-   return TRUE;
-}
-
-Bool
-I830DRISetHWS(ScrnInfoPtr pScrn)
-{
-    I830Ptr pI830 = I830PTR(pScrn);
-    drmI830HWS hws;
-
-    hws.addr = pI830->hw_status->offset;
-
-    if (drmCommandWrite(pI830->drmSubFD, DRM_I830_HWS_PAGE_ADDR,
-		&hws, sizeof(drmI830HWS))) {
-	xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-		"hw status page initialization Failed\n");
-	return FALSE;
-    }
-    return TRUE;
-}
-
-static Bool
-I830InitVisualConfigs(ScreenPtr pScreen)
-{
-   ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
-   I830Ptr pI830 = I830PTR(pScrn);
-   int numConfigs = 0;
-   __GLXvisualConfig *pConfigs = NULL;
-   I830ConfigPrivPtr pI830Configs = NULL;
-   I830ConfigPrivPtr *pI830ConfigPtrs = NULL;
-   int accum, stencil, db, depth;
-   int i;
-
-   switch (pScrn->bitsPerPixel) {
-   case 8:
-   case 24:
-      break;
-
-   case 16:
-      numConfigs = 8;
-
-      pConfigs =
-	    (__GLXvisualConfig *) xcalloc(sizeof(__GLXvisualConfig),
-					  numConfigs);
-      if (!pConfigs)
-	 return FALSE;
-
-      pI830Configs =
-	    (I830ConfigPrivPtr) xcalloc(sizeof(I830ConfigPrivRec),
-					numConfigs);
-      if (!pI830Configs) {
-	 xfree(pConfigs);
-	 return FALSE;
-      }
-
-      pI830ConfigPtrs =
-	    (I830ConfigPrivPtr *) xcalloc(sizeof(I830ConfigPrivPtr),
-					  numConfigs);
-      if (!pI830ConfigPtrs) {
-	 xfree(pConfigs);
-	 xfree(pI830Configs);
-	 return FALSE;
-      }
-
-      for (i = 0; i < numConfigs; i++)
-	 pI830ConfigPtrs[i] = &pI830Configs[i];
-
-      i = 0;
-      depth = 1;
-      for (accum = 0; accum <= 1; accum++) {
-	 for (stencil = 0; stencil <= 1; stencil++) {
-	    for (db = 1; db >= 0; db--) {
-	       pConfigs[i].vid = -1;
-	       pConfigs[i].class = -1;
-	       pConfigs[i].rgba = TRUE;
-	       pConfigs[i].redSize = 5;
-	       pConfigs[i].greenSize = 6;
-	       pConfigs[i].blueSize = 5;
-	       pConfigs[i].alphaSize = 0;
-	       pConfigs[i].redMask = 0x0000F800;
-	       pConfigs[i].greenMask = 0x000007E0;
-	       pConfigs[i].blueMask = 0x0000001F;
-	       pConfigs[i].alphaMask = 0;
-	       if (accum) {
-		  pConfigs[i].accumRedSize = 16;
-		  pConfigs[i].accumGreenSize = 16;
-		  pConfigs[i].accumBlueSize = 16;
-		  pConfigs[i].accumAlphaSize = 0;
-	       } else {
-		  pConfigs[i].accumRedSize = 0;
-		  pConfigs[i].accumGreenSize = 0;
-		  pConfigs[i].accumBlueSize = 0;
-		  pConfigs[i].accumAlphaSize = 0;
-	       }
-	       pConfigs[i].doubleBuffer = db ? TRUE : FALSE;
-	       pConfigs[i].stereo = FALSE;
-	       pConfigs[i].bufferSize = 16;
-	       if (depth)
-		  pConfigs[i].depthSize = 16;
-	       else
-		  pConfigs[i].depthSize = 0;
-	       if (stencil)
-		  pConfigs[i].stencilSize = 8;
-	       else
-		  pConfigs[i].stencilSize = 0;
-	       pConfigs[i].auxBuffers = 0;
-	       pConfigs[i].level = 0;
-	       if (stencil || accum)
-		  pConfigs[i].visualRating = GLX_SLOW_VISUAL_EXT;
-	       else
-		  pConfigs[i].visualRating = GLX_NONE_EXT;
-	       pConfigs[i].transparentPixel = GLX_NONE_EXT;
-	       pConfigs[i].transparentRed = 0;
-	       pConfigs[i].transparentGreen = 0;
-	       pConfigs[i].transparentBlue = 0;
-	       pConfigs[i].transparentAlpha = 0;
-	       pConfigs[i].transparentIndex = 0;
-	       i++;
-	    }
-	 }
-      }
-      assert(i == numConfigs);
-      break;
-
-   case 32:
-      numConfigs = 8;
-
-      pConfigs = (__GLXvisualConfig *) xcalloc(sizeof(__GLXvisualConfig),
-					       numConfigs);
-      if (!pConfigs) {
-	 return FALSE;
-      }
-
-      pI830Configs = (I830ConfigPrivPtr) xcalloc(sizeof(I830ConfigPrivRec),
-						 numConfigs);
-      if (!pI830Configs) {
-	 xfree(pConfigs);
-	 return FALSE;
-      }
-
-      pI830ConfigPtrs = (I830ConfigPrivPtr *)
-	    xcalloc(sizeof(I830ConfigPrivPtr), numConfigs);
-      if (!pI830ConfigPtrs) {
-	 xfree(pConfigs);
-	 xfree(pI830Configs);
-	 return FALSE;
-      }
-
-      for (i = 0; i < numConfigs; i++) {
-	 pI830ConfigPtrs[i] = &pI830Configs[i];
-      }
-
-      i = 0;
-      for (accum = 0; accum <= 1; accum++) {
-	 for (depth = 1; depth >= 0; depth--) {	/* and stencil */
-	    for (db = 1; db >= 0; db--) {
-	       pConfigs[i].vid = -1;
-	       pConfigs[i].class = -1;
-	       pConfigs[i].rgba = TRUE;
-	       pConfigs[i].redSize = 8;
-	       pConfigs[i].greenSize = 8;
-	       pConfigs[i].blueSize = 8;
-	       pConfigs[i].alphaSize = 8;
-	       pConfigs[i].redMask = 0x00FF0000;
-	       pConfigs[i].greenMask = 0x0000FF00;
-	       pConfigs[i].blueMask = 0x000000FF;
-	       pConfigs[i].alphaMask = 0xFF000000;
-	       if (accum) {
-		  pConfigs[i].accumRedSize = 16;
-		  pConfigs[i].accumGreenSize = 16;
-		  pConfigs[i].accumBlueSize = 16;
-		  pConfigs[i].accumAlphaSize = 16;
-	       } else {
-		  pConfigs[i].accumRedSize = 0;
-		  pConfigs[i].accumGreenSize = 0;
-		  pConfigs[i].accumBlueSize = 0;
-		  pConfigs[i].accumAlphaSize = 0;
-	       }
-	       if (db) {
-		  pConfigs[i].doubleBuffer = TRUE;
-	       } else {
-		  pConfigs[i].doubleBuffer = FALSE;
-	       }
-	       pConfigs[i].stereo = FALSE;
-	       pConfigs[i].bufferSize = 32;
-	       if (depth) {
-		  pConfigs[i].depthSize = 24;
-		  pConfigs[i].stencilSize = 8;
-	       } else {
-		  pConfigs[i].depthSize = 0;
-		  pConfigs[i].stencilSize = 0;
-	       }
-	       pConfigs[i].auxBuffers = 0;
-	       pConfigs[i].level = 0;
-	       if (accum) {
-		  pConfigs[i].visualRating = GLX_SLOW_VISUAL_EXT;
-	       } else {
-		  pConfigs[i].visualRating = GLX_NONE_EXT;
-	       }
-	       pConfigs[i].transparentPixel = GLX_NONE_EXT;
-	       pConfigs[i].transparentRed = 0;
-	       pConfigs[i].transparentGreen = 0;
-	       pConfigs[i].transparentBlue = 0;
-	       pConfigs[i].transparentAlpha = 0;
-	       pConfigs[i].transparentIndex = 0;
-	       i++;
-	    }
-	 }
-      }
-      if (i != numConfigs) {
-	 xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-		    "[drm] Incorrect initialization of visuals\n");
-	 return FALSE;
-      }
-      break;
-
-   }
-   pI830->numVisualConfigs = numConfigs;
-   pI830->pVisualConfigs = pConfigs;
-   pI830->pVisualConfigsPriv = pI830Configs;
-   GlxSetVisualConfigs(numConfigs, pConfigs, (void **)pI830ConfigPtrs);
-   return TRUE;
-}
-
-static Bool
-I830CheckDRIAvailable(ScrnInfoPtr pScrn)
-{
-   /* Hardware 3D rendering only implemented for 16bpp and 32 bpp */
-   if (((pScrn->bitsPerPixel / 8) != 2 && pScrn->depth != 16) &&
-       (pScrn->bitsPerPixel / 8) != 4) {
-      xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-		 "[drm] Direct rendering only supported in 16 and 32 bpp modes\n");
-      return FALSE;
-   }
-
-   /* Check that the GLX, DRI, and DRM modules have been loaded by testing
-    * for known symbols in each module. */
-   if (!xf86LoaderCheckSymbol("GlxSetVisualConfigs")) {
-      xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-		 "[dri] %s failed: glx not loaded\n", __FUNCTION__);
-      return FALSE;
-   }
-   if (!xf86LoaderCheckSymbol("DRIScreenInit")) {
-      xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-		 "[dri] %s failed: dri not loaded\n", __FUNCTION__);
-      return FALSE;
-   }
-   if (!xf86LoaderCheckSymbol("drmAvailable")) {
-      xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-		 "[dri] %s failed: libdrm not loaded\n", __FUNCTION__);
-      return FALSE;
-   }
-   if (!xf86LoaderCheckSymbol("DRIQueryVersion")) {
-      xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-		 "[dri] %s failed (libdri.a too old)\n", __FUNCTION__);
-      return FALSE;
-   }
-
-   /* Check the DRI version */
-   {
-      int major, minor, patch;
-
-      DRIQueryVersion(&major, &minor, &patch);
-      if (major != DRIINFO_MAJOR_VERSION || minor < DRIINFO_MINOR_VERSION ||
-	  major < 5) {
-	 xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-		    "[dri] %s failed because of a version mismatch.\n"
-		    "[dri] libDRI version is %d.%d.%d but version %d.%d.x is needed.\n"
-		    "[dri] Disabling DRI.\n",
-		    "I830CheckDRIAvailable", major, minor, patch,
-		     DRIINFO_MAJOR_VERSION, DRIINFO_MINOR_VERSION);
-	 return FALSE;
-      }
-   }
-
-   return TRUE;
-}
-
-Bool
-I830DRIScreenInit(ScreenPtr pScreen)
-{
-   ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
-   I830Ptr pI830 = I830PTR(pScrn);
-   DRIInfoPtr pDRIInfo;
-   I830DRIPtr pI830DRI;
-
-   DPRINTF(PFX, "I830DRIScreenInit\n");
-
-   if (!I830CheckDRIAvailable(pScrn))
-      return FALSE;
-
-   pDRIInfo = DRICreateInfoRec();
-   if (!pDRIInfo) {
-      xf86DrvMsg(pScreen->myNum, X_ERROR,
-		 "[dri] DRICreateInfoRec failed. Disabling DRI.\n");
-      return FALSE;
-   }
-
-   pI830->pDRIInfo = pDRIInfo;
-   pI830->LockHeld = 0;
-
-   pDRIInfo->drmDriverName = "i915";
-   if (IS_I965G(pI830))
-      pDRIInfo->clientDriverName = "i965";
-   else
-      pDRIInfo->clientDriverName = "i915";
-
-   if (xf86LoaderCheckSymbol("DRICreatePCIBusID")) {
-      pDRIInfo->busIdString = DRICreatePCIBusID(pI830->PciInfo);
-   } else {
-      pDRIInfo->busIdString = xalloc(64);
-      sprintf(pDRIInfo->busIdString, "PCI:%d:%d:%d",
-#if XSERVER_LIBPCIACCESS
-	      ((pI830->PciInfo->domain << 8) | pI830->PciInfo->bus),
-	      pI830->PciInfo->dev, pI830->PciInfo->func
-#else
-	      ((pciConfigPtr) pI830->PciInfo->thisCard)->busnum,
-	      ((pciConfigPtr) pI830->PciInfo->thisCard)->devnum,
-	      ((pciConfigPtr) pI830->PciInfo->thisCard)->funcnum
-#endif
-	      );
-   }
-   pDRIInfo->ddxDriverMajorVersion = I830_MAJOR_VERSION;
-   pDRIInfo->ddxDriverMinorVersion = I830_MINOR_VERSION;
-   pDRIInfo->ddxDriverPatchVersion = I830_PATCHLEVEL;
-   pDRIInfo->ddxDrawableTableEntry = I830_MAX_DRAWABLES;
-
-   if (SAREA_MAX_DRAWABLES < I830_MAX_DRAWABLES)
-      pDRIInfo->maxDrawableTableEntry = SAREA_MAX_DRAWABLES;
-   else
-      pDRIInfo->maxDrawableTableEntry = I830_MAX_DRAWABLES;
-
-   if (sizeof(XF86DRISAREARec) + sizeof(drmI830Sarea) > SAREA_MAX) {
-      xf86DrvMsg(pScreen->myNum, X_ERROR,
-		 "[dri] Data does not fit in SAREA\n");
-      return FALSE;
-   }
-   /* This is a hack for now.  We have to have more than a 4k page here
-    * because of the size of the state.  However, the state should be
-    * in a per-context mapping.  This will be added in the Mesa 3.5 port
-    * of the I830 driver.
-    */
-   pDRIInfo->SAREASize = SAREA_MAX;
-
-   if (!(pI830DRI = (I830DRIPtr) xcalloc(sizeof(I830DRIRec), 1))) {
-      DRIDestroyInfoRec(pI830->pDRIInfo);
-      pI830->pDRIInfo = NULL;
-      return FALSE;
-   }
-   pDRIInfo->devPrivate = pI830DRI;
-   pDRIInfo->devPrivateSize = sizeof(I830DRIRec);
-   pDRIInfo->contextSize = sizeof(I830DRIContextRec);
-
-   pDRIInfo->CreateContext = I830CreateContext;
-   pDRIInfo->DestroyContext = I830DestroyContext;
-   pDRIInfo->SwapContext = I830DRISwapContext;
-   pDRIInfo->InitBuffers = I830DRIInitBuffers;
-   pDRIInfo->MoveBuffers = I830DRIMoveBuffers;
-   pDRIInfo->bufferRequests = DRI_ALL_WINDOWS;
-
-#if DRIINFO_MAJOR_VERSION > 5 || \
-    (DRIINFO_MAJOR_VERSION == 5 && DRIINFO_MINOR_VERSION >= 3)
-      if (pI830->accel == ACCEL_EXA)
-	 pDRIInfo->texOffsetStart = I830TexOffsetStart;
-#endif
-
-#if DRI_DRIVER_FRAMEBUFFER_MAP
-   /* DRI version is high enough that we can get the DRI code to not
-    * try to manage the framebuffer.
-    */
-   pDRIInfo->frameBufferPhysicalAddress = 0;
-   pDRIInfo->frameBufferSize = 0;
-   pDRIInfo->frameBufferStride = 0;
-   pDRIInfo->dontMapFrameBuffer = TRUE;
-#else
-   /* Supply a dummy mapping info required by DRI setup.
-    */
-   pDRIInfo->frameBufferPhysicalAddress = (char *) pI830->LinearAddr;
-   pDRIInfo->frameBufferSize = GTT_PAGE_SIZE;
-   pDRIInfo->frameBufferStride = 1;
-#endif
-
-   pDRIInfo->TransitionTo2d = I830DRITransitionTo2d;
-   pDRIInfo->TransitionTo3d = I830DRITransitionTo3d;
-
-   /* do driver-independent DRI screen initialization here */
-   if (!DRIScreenInit(pScreen, pDRIInfo, &pI830->drmSubFD)) {
-      xf86DrvMsg(pScreen->myNum, X_ERROR,
-		 "[dri] DRIScreenInit failed. Disabling DRI.\n");
-      xfree(pDRIInfo->devPrivate);
-      pDRIInfo->devPrivate = NULL;
-      DRIDestroyInfoRec(pI830->pDRIInfo);
-      pI830->pDRIInfo = NULL;
-      return FALSE;
-   }
-
-   /* Now, nuke dri.c's dummy frontbuffer map setup if we did that. */
-   if (pDRIInfo->frameBufferSize != 0) {
-       int tmp;
-       drm_handle_t fb_handle;
-       void *ptmp;
-
-       /* With the compat method, it will continue to report
-	* the wrong map out of GetDeviceInfo, which will break AIGLX.
-	*/
-       DRIGetDeviceInfo(pScreen, &fb_handle, &tmp, &tmp, &tmp, &tmp, &ptmp);
-       drmRmMap(pI830->drmSubFD, fb_handle);
-
-       xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
-		  "Removed DRI frontbuffer mapping in compatibility mode.\n");
-       xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
-		  "DRIGetDeviceInfo will report incorrect frontbuffer "
-		  "handle.\n");
-   }
-
-   /* Check the i915 DRM versioning */
-   {
-      drmVersionPtr version;
-
-      /* Check the DRM lib version.
-       * drmGetLibVersion was not supported in version 1.0, so check for
-       * symbol first to avoid possible crash or hang.
-       */
-      if (xf86LoaderCheckSymbol("drmGetLibVersion")) {
-	 version = drmGetLibVersion(pI830->drmSubFD);
-      } else
-      {
-	 /* drmlib version 1.0.0 didn't have the drmGetLibVersion
-	  * entry point.  Fake it by allocating a version record
-	  * via drmGetVersion and changing it to version 1.0.0
-	  */
-	 version = drmGetVersion(pI830->drmSubFD);
-	 version->version_major = 1;
-	 version->version_minor = 0;
-	 version->version_patchlevel = 0;
-      }
-
-#define REQ_MAJ 1
-#define REQ_MIN 1
-      if (version) {
-	 if (version->version_major != REQ_MAJ ||
-	     version->version_minor < REQ_MIN) {
-	    /* incompatible drm library version */
-	    xf86DrvMsg(pScreen->myNum, X_ERROR,
-		       "[dri] I830DRIScreenInit failed because of a version mismatch.\n"
-		       "[dri] libdrm.a module version is %d.%d.%d but version %d.%d.x is needed.\n"
-		       "[dri] Disabling DRI.\n",
-		       version->version_major,
-		       version->version_minor, version->version_patchlevel,
-		       REQ_MAJ, REQ_MIN);
-	    drmFreeVersion(version);
-	    I830DRICloseScreen(pScreen);
-	    return FALSE;
-	 }
-	 drmFreeVersion(version);
-      }
-
-      /* Check the i915 DRM version */
-      version = drmGetVersion(pI830->drmSubFD);
-      if (version) {
-	 if (version->version_major != 1 || version->version_minor < 3) {
-	    /* incompatible drm version */
-	    xf86DrvMsg(pScreen->myNum, X_ERROR,
-		       "[dri] %s failed because of a version mismatch.\n"
-		       "[dri] i915 kernel module version is %d.%d.%d but version 1.3 or greater is needed.\n"
-		       "[dri] Disabling DRI.\n",
-		       "I830DRIScreenInit",
-		       version->version_major,
-		       version->version_minor, version->version_patchlevel);
-	    I830DRICloseScreen(pScreen);
-	    drmFreeVersion(version);
-	    return FALSE;
-	 }
-	 /* Check whether the kernel module attached to the device isn't the
-	  * one we expected (meaning it's the old i830 module).
-	  */
-	 if (strncmp(version->name, pDRIInfo->drmDriverName,
-		     strlen(pDRIInfo->drmDriverName)))
-	 {
-	    xf86DrvMsg(pScreen->myNum, X_WARNING,
-		       "Detected i830 kernel module.  The i915 kernel module "
-		       "is required for DRI.  Aborting.\n");
-	    I830DRICloseScreen(pScreen);
-	    drmFreeVersion(version);
-	    return FALSE;
-	 }
-	 pI830->drmMinor = version->version_minor;
-	 drmFreeVersion(version);
-      }
-   }
-
-   return TRUE;
-}
-
-static void
-I830InitTextureHeap(ScrnInfoPtr pScrn)
-{
-   I830Ptr pI830 = I830PTR(pScrn);
-   drmI830MemInitHeap drmHeap;
-
-   if (pI830->textures == NULL)
-       return;
-
-   /* Start up the simple memory manager for agp space */
-   drmHeap.region = I830_MEM_REGION_AGP;
-   drmHeap.start  = 0;
-   drmHeap.size   = pI830->textures->size;
-
-   if (drmCommandWrite(pI830->drmSubFD, DRM_I830_INIT_HEAP,
-			  &drmHeap, sizeof(drmHeap))) {
-      xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-		    "[drm] Failed to initialized agp heap manager\n");
-   } else {
-      xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-		    "[drm] Initialized kernel agp heap manager, %ld\n",
-		    pI830->textures->size);
-
-      I830SetParam(pScrn, I830_SETPARAM_TEX_LRU_LOG_GRANULARITY, 
-		   pI830->TexGranularity);
-   }
-}
-
-/*
- * Map registers & ring buffer
- */
-static Bool
-I830DRIMapHW(ScreenPtr pScreen)
-{
-   ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
-   I830Ptr pI830 = I830PTR(pScrn);
-   DRIInfoPtr pDRIInfo = pI830->pDRIInfo;
-   I830DRIPtr pI830DRI = pDRIInfo->devPrivate;
-
-   /* Kernel deals with direct hw access in this case */
-   if (pI830->use_drm_mode)
-       return TRUE;
-
-   DPRINTF(PFX, "I830DRIMapHW\n");
-   pI830DRI->regsSize = I830_REG_SIZE;
-   if (drmAddMap(pI830->drmSubFD, (drm_handle_t)pI830->MMIOAddr,
-		 pI830DRI->regsSize, DRM_REGISTERS, 0,
-		 (drmAddress) &pI830DRI->regs) < 0) {
-      xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] drmAddMap(regs) failed\n");
-      DRICloseScreen(pScreen);
-      return FALSE;
-   }
-   xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Registers = 0x%08x\n",
-	      (int)pI830DRI->regs);
-
-   if (!pI830->memory_manager) {
-       if (drmAddMap(pI830->drmSubFD,
-		     (drm_handle_t)pI830->ring.mem->offset +
-		     pI830->LinearAddr,
-		     pI830->ring.mem->size, DRM_AGP, 0,
-		     (drmAddress) &pI830->ring_map) < 0) {
-	   xf86DrvMsg(pScreen->myNum, X_ERROR,
-		      "[drm] drmAddMap(ring_map) failed. Disabling DRI\n");
-	   DRICloseScreen(pScreen);
-	   return FALSE;
-       }
-       xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] ring buffer = 0x%08x\n",
-		  (int)pI830->ring_map);
-   }
-
-   return TRUE;
-}
-
-/**
- * Sets up mappings for static, lifetime-fixed allocations, and inital SAREA
- * setup.
- */
-Bool
-I830DRIDoMappings(ScreenPtr pScreen)
-{
-   ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
-   I830Ptr pI830 = I830PTR(pScrn);
-   DRIInfoPtr pDRIInfo = pI830->pDRIInfo;
-   I830DRIPtr pI830DRI = pDRIInfo->devPrivate;
-   drmI830Sarea *sarea = (drmI830Sarea *) DRIGetSAREAPrivate(pScreen);
-
-   if (!I830DRIMapHW(pScreen)) {
-       DRICloseScreen(pScreen);
-       return FALSE;
-   }
-
-   if (!I830InitDma(pScrn)) {
-      DRICloseScreen(pScreen);
-      return FALSE;
-   }
-
-   if (pI830->memory_manager == NULL)
-       intel_bufmgr_fake_set_last_dispatch(pI830->bufmgr,
-					   (volatile unsigned int *)
-					   &sarea->last_dispatch);
-
-   /* init to zero to be safe */
-   sarea->front_handle = 0;
-   sarea->back_handle = 0;
-   sarea->depth_handle = 0;
-   sarea->tex_handle = 0;
-
-   /* Assign pScreen */
-   pScrn->pScreen = pScreen;
-
-   /* Need to initialize pScreen now to let RandR know. */
-   pScrn->pScreen->width = pScrn->virtualX;
-   pScrn->pScreen->height = pScrn->virtualY;
-
-   /* If we are using the kernel memory manager, we have to delay SAREA and
-    * mapping setup until our buffers are pinned at EnterVT, losing the
-    * opportunity to fail cleanly early on.
-    */
-   if (pI830->memory_manager == NULL) {
-      if (!i830_update_dri_buffers(pScrn)) {
-	 /* screen mappings probably failed */
-	 xf86DrvMsg(pScreen->myNum, X_ERROR,
-		    "[drm] drmAddMap(screen mappings) failed. "
-		    "Disabling DRI\n");
-	 DRICloseScreen(pScreen);
-	 return FALSE;
-      }
-   }
-
-   if (pI830->allocate_classic_textures)
-      I830InitTextureHeap(pScrn);
-
-   if (DEVICE_ID(pI830->PciInfo) != PCI_CHIP_845_G &&
-       DEVICE_ID(pI830->PciInfo) != PCI_CHIP_I830_M) {
-      I830SetParam(pScrn, I830_SETPARAM_USE_MI_BATCHBUFFER_START, 1 );
-   }
-
-   pI830DRI = (I830DRIPtr) pI830->pDRIInfo->devPrivate;
-   pI830DRI->deviceID = DEVICE_ID(pI830->PciInfo);
-   pI830DRI->width = pScrn->virtualX;
-   pI830DRI->height = pScrn->virtualY;
-   pI830DRI->mem = pScrn->videoRam * 1024;
-   pI830DRI->cpp = pI830->cpp;
-
-   pI830DRI->bitsPerPixel = pScrn->bitsPerPixel;
-
-   pI830DRI->sarea_priv_offset = sizeof(XF86DRISAREARec);
-
-   if (!(I830InitVisualConfigs(pScreen))) {
-      xf86DrvMsg(pScreen->myNum, X_ERROR,
-		 "[dri] I830InitVisualConfigs failed. Disabling DRI\n");
-      DRICloseScreen(pScreen);
-      return FALSE;
-   }
-
-   xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] visual configs initialized\n");
-   pI830->pDRIInfo->driverSwapMethod = DRI_HIDE_X_CONTEXT;
-
-   return TRUE;
-}
-
-Bool
-I830DRIInstIrqHandler(ScrnInfoPtr pScrn)
-{
-   I830Ptr pI830 = I830PTR(pScrn);
-   I830DRIPtr pI830DRI = (I830DRIPtr) pI830->pDRIInfo->devPrivate;
-
-   pI830DRI->irq = drmGetInterruptFromBusID(pI830->drmSubFD,
-#if XSERVER_LIBPCIACCESS
-					       ((pI830->PciInfo->domain << 8) |
-						pI830->PciInfo->bus),
-					       pI830->PciInfo->dev,
-					       pI830->PciInfo->func
-#else
-					       ((pciConfigPtr) pI830->
-						PciInfo->thisCard)->busnum,
-					       ((pciConfigPtr) pI830->
-						PciInfo->thisCard)->devnum,
-					       ((pciConfigPtr) pI830->
-						PciInfo->thisCard)->funcnum
-#endif
-					       );
-
-   if (drmCtlInstHandler(pI830->drmSubFD, pI830DRI->irq)) {
-       xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-	       "[drm] failure adding irq handler\n");
-       pI830DRI->irq = 0;
-       return FALSE;
-   } else
-       xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-	       "[drm] dma control initialized, using IRQ %d\n",
-	       pI830DRI->irq);
-
-   return TRUE;
-}
-
-Bool
-I830DRIResume(ScreenPtr pScreen)
-{
-   ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
-   I830Ptr pI830 = I830PTR(pScrn);
-
-   DPRINTF(PFX, "I830DRIResume\n");
-
-   I830ResumeDma(pScrn);
-
-   if (!pI830->memory_manager)
-       I830DRIInstIrqHandler(pScrn);
-
-   return TRUE;
-}
-
-void
-I830DRICloseScreen(ScreenPtr pScreen)
-{
-   ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
-   I830Ptr pI830 = I830PTR(pScrn);
-   I830DRIPtr pI830DRI = (I830DRIPtr) pI830->pDRIInfo->devPrivate;
-
-   DPRINTF(PFX, "I830DRICloseScreen\n");
-
-   if (!pI830->memory_manager && pI830DRI->irq) {
-       drmCtlUninstHandler(pI830->drmSubFD);
-       pI830DRI->irq = 0;
-   }
-
-   I830CleanupDma(pScrn);
-
-   DRICloseScreen(pScreen);
-
-   if (pI830->pDRIInfo) {
-      if (pI830->pDRIInfo->devPrivate) {
-	 xfree(pI830->pDRIInfo->devPrivate);
-	 pI830->pDRIInfo->devPrivate = NULL;
-      }
-      DRIDestroyInfoRec(pI830->pDRIInfo);
-      pI830->pDRIInfo = NULL;
-   }
-   if (pI830->pVisualConfigs)
-      xfree(pI830->pVisualConfigs);
-   if (pI830->pVisualConfigsPriv)
-      xfree(pI830->pVisualConfigsPriv);
-   pI830->directRenderingType = DRI_NONE;
-}
-
-static Bool
-I830CreateContext(ScreenPtr pScreen, VisualPtr visual,
-		  drm_context_t hwContext, void *pVisualConfigPriv,
-		  DRIContextType contextStore)
-{
-   return TRUE;
-}
-
-static void
-I830DestroyContext(ScreenPtr pScreen, drm_context_t hwContext,
-		   DRIContextType contextStore)
-{
-}
-
-Bool
-I830DRIFinishScreenInit(ScreenPtr pScreen)
-{
-   DPRINTF(PFX, "I830DRIFinishScreenInit\n");
-
-   if (!DRIFinishScreenInit(pScreen))
-      return FALSE;
-
-   /* move irq initialize later in EnterVT, as then we
-    * would finish binding possible hw status page, which
-    * requires irq ctrl ioctl not be called that early.
-    */
-   return TRUE;
-}
-
-static void
-I830DRISwapContext(ScreenPtr pScreen, DRISyncType syncType,
-		   DRIContextType oldContextType, void *oldContext,
-		   DRIContextType newContextType, void *newContext)
-{
-   ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
-   I830Ptr pI830 = I830PTR(pScrn);
-
-   if (syncType == DRI_3D_SYNC &&
-       oldContextType == DRI_2D_CONTEXT && newContextType == DRI_2D_CONTEXT) {
-
-      if (I810_DEBUG & DEBUG_VERBOSE_DRI)
-	 ErrorF("i830DRISwapContext (in)\n");
-
-      pI830->last_3d = LAST_3D_OTHER;
-
-      if (!pScrn->vtSema)
-     	 return;
-      pI830->LockHeld = 1;
-      if (!pI830->memory_manager)
-	  i830_refresh_ring(pScrn);
-
-   } else if (syncType == DRI_2D_SYNC &&
-	      oldContextType == DRI_NO_CONTEXT &&
-	      newContextType == DRI_2D_CONTEXT) {
-      if (I810_DEBUG & DEBUG_VERBOSE_DRI)
-	 ErrorF("i830DRISwapContext (out)\n");
-
-      if (!pScrn->vtSema)
-     	 return;
-      pI830->LockHeld = 0;
-   } else if (I810_DEBUG & DEBUG_VERBOSE_DRI)
-      ErrorF("i830DRISwapContext (other)\n");
-}
-
-static void
-I830DRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index)
-{
-   ScreenPtr pScreen = pWin->drawable.pScreen;
-   ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
-   BoxPtr pbox;
-   int nbox;
-   int buffer, first_buffer, last_buffer;
-
-   if (I810_DEBUG & DEBUG_VERBOSE_DRI)
-      ErrorF("I830DRIInitBuffers\n");
-
-   first_buffer = I830_SELECT_BACK;
-   last_buffer = I830_SELECT_DEPTH;
-
-   for (buffer = first_buffer; buffer <= last_buffer; buffer++) {
-      pbox = REGION_RECTS(prgn);
-      nbox = REGION_NUM_RECTS(prgn);
-
-      if (!I830SelectBuffer(pScrn, buffer))
-	 continue;
-
-      if (buffer == I830_SELECT_DEPTH) {
-	 switch (pScrn->bitsPerPixel) {
-	 case 16:
-	    I830SetupForSolidFill(pScrn, 0xffff, GXcopy, -1);
-	    break;
-	 case 32:
-	    I830SetupForSolidFill(pScrn, 0xffffff, GXcopy, -1);
-	    break;
-	 }
-      } else
-	 I830SetupForSolidFill(pScrn, 0, GXcopy, -1);
-      while (nbox--) {
-	 I830SubsequentSolidFillRect(pScrn, pbox->x1, pbox->y1,
-				     pbox->x2 - pbox->x1, pbox->y2 - pbox->y1);
-	 pbox++;
-      }
-   }
-
-   I830SelectBuffer(pScrn, I830_SELECT_FRONT);
-   i830MarkSync(pScrn);
-}
-
-/* This routine is a modified form of XAADoBitBlt with the calls to
- * ScreenToScreenBitBlt built in. My routine has the prgnSrc as source
- * instead of destination. My origin is upside down so the ydir cases
- * are reversed.
- */
-static void
-I830DRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg,
-		   RegionPtr prgnSrc, CARD32 index)
-{
-   ScreenPtr pScreen = pParent->drawable.pScreen;
-   ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
-   BoxPtr pboxTmp, pboxNext, pboxBase;
-   DDXPointPtr pptTmp, pptNew2 = NULL;
-   int xdir, ydir;
-
-#if 0
-   int screenwidth = pScrn->virtualX;
-   int screenheight = pScrn->virtualY;
-#else
-   int screenwidth = pScreen->width;
-   int screenheight = pScreen->height;
-#endif
-
-   BoxPtr pbox = REGION_RECTS(prgnSrc);
-   int nbox = REGION_NUM_RECTS(prgnSrc);
-
-   BoxPtr pboxNew1 = NULL;
-   BoxPtr pboxNew2 = NULL;
-   DDXPointPtr pptNew1 = NULL;
-   DDXPointPtr pptSrc = &ptOldOrg;
-
-   int dx = pParent->drawable.x - ptOldOrg.x;
-   int dy = pParent->drawable.y - ptOldOrg.y;
-   int buffer, first_buffer, last_buffer;
-
-   /* If the copy will overlap in Y, reverse the order */
-   if (dy > 0) {
-      ydir = -1;
-
-      if (nbox > 1) {
-	 /* Keep ordering in each band, reverse order of bands */
-	 pboxNew1 = (BoxPtr) xalloc(sizeof(BoxRec) * nbox);
-	 if (!pboxNew1)
-	    return;
-	 pptNew1 = (DDXPointPtr) xalloc(sizeof(DDXPointRec) * nbox);
-	 if (!pptNew1) {
-	    xfree(pboxNew1);
-	    return;
-	 }
-	 pboxBase = pboxNext = pbox + nbox - 1;
-	 while (pboxBase >= pbox) {
-	    while ((pboxNext >= pbox) && (pboxBase->y1 == pboxNext->y1))
-	       pboxNext--;
-	    pboxTmp = pboxNext + 1;
-	    pptTmp = pptSrc + (pboxTmp - pbox);
-	    while (pboxTmp <= pboxBase) {
-	       *pboxNew1++ = *pboxTmp++;
-	       *pptNew1++ = *pptTmp++;
-	    }
-	    pboxBase = pboxNext;
-	 }
-	 pboxNew1 -= nbox;
-	 pbox = pboxNew1;
-	 pptNew1 -= nbox;
-	 pptSrc = pptNew1;
-      }
-   } else {
-      /* No changes required */
-      ydir = 1;
-   }
-
-   /* If the regions will overlap in X, reverse the order */
-   if (dx > 0) {
-      xdir = -1;
-
-      if (nbox > 1) {
-	 /*reverse orderof rects in each band */
-	 pboxNew2 = (BoxPtr) xalloc(sizeof(BoxRec) * nbox);
-	 pptNew2 = (DDXPointPtr) xalloc(sizeof(DDXPointRec) * nbox);
-	 if (!pboxNew2 || !pptNew2) {
-	    if (pptNew2)
-	       xfree(pptNew2);
-	    if (pboxNew2)
-	       xfree(pboxNew2);
-	    if (pboxNew1) {
-	       xfree(pptNew1);
-	       xfree(pboxNew1);
-	    }
-	    return;
-	 }
-	 pboxBase = pboxNext = pbox;
-	 while (pboxBase < pbox + nbox) {
-	    while ((pboxNext < pbox + nbox) && (pboxNext->y1 == pboxBase->y1))
-	       pboxNext++;
-	    pboxTmp = pboxNext;
-	    pptTmp = pptSrc + (pboxTmp - pbox);
-	    while (pboxTmp != pboxBase) {
-	       *pboxNew2++ = *--pboxTmp;
-	       *pptNew2++ = *--pptTmp;
-	    }
-	    pboxBase = pboxNext;
-	 }
-	 pboxNew2 -= nbox;
-	 pbox = pboxNew2;
-	 pptNew2 -= nbox;
-	 pptSrc = pptNew2;
-      }
-   } else {
-      /* No changes are needed */
-      xdir = 1;
-   }
-
-   /* SelectBuffer isn't really a good concept for the i810.
-    */
-   I830EmitFlush(pScrn);
-   first_buffer = I830_SELECT_BACK;
-   last_buffer = I830_SELECT_DEPTH;
-
-   for (buffer = first_buffer; buffer <= last_buffer; buffer++) {
-      if (!I830SelectBuffer(pScrn, buffer))
-	 continue;
-      I830SetupForScreenToScreenCopy(pScrn, xdir, ydir, GXcopy, -1, -1);
-      pbox = REGION_RECTS(prgnSrc);
-      nbox = REGION_NUM_RECTS(prgnSrc);
-      for (; nbox--; pbox++) {
-
-	 int x1 = pbox->x1;
-	 int y1 = pbox->y1;
-	 int destx = x1 + dx;
-	 int desty = y1 + dy;
-	 int w = pbox->x2 - x1 + 1;
-	 int h = pbox->y2 - y1 + 1;
-
-	 if (destx < 0)
-	    x1 -= destx, w += destx, destx = 0;
-	 if (desty < 0)
-	    y1 -= desty, h += desty, desty = 0;
-	 if (destx + w > screenwidth)
-	    w = screenwidth - destx;
-	 if (desty + h > screenheight)
-	    h = screenheight - desty;
-	 if (w <= 0)
-	    continue;
-	 if (h <= 0)
-	    continue;
-
-	 if (I810_DEBUG & DEBUG_VERBOSE_DRI)
-	    ErrorF("MoveBuffers %d,%d %dx%d dx: %d dy: %d\n",
-		   x1, y1, w, h, dx, dy);
-
-	 I830SubsequentScreenToScreenCopy(pScrn, x1, y1, destx, desty, w, h);
-      }
-   }
-
-   I830SelectBuffer(pScrn, I830_SELECT_FRONT);
-   I830EmitFlush(pScrn);
-
-   if (pboxNew2) {
-      xfree(pptNew2);
-      xfree(pboxNew2);
-   }
-   if (pboxNew1) {
-      xfree(pptNew1);
-      xfree(pboxNew1);
-   }
-   i830MarkSync(pScrn);
-}
-
-static void
-I830DRITransitionTo3d(ScreenPtr pScreen)
-{
-   ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
-   I830Ptr pI830 = I830PTR(pScrn);
-
-   pI830->want_vblank_interrupts = TRUE;
-   I830DRISetVBlankInterrupt(pScrn, TRUE);
-}
-
-static void
-I830DRITransitionTo2d(ScreenPtr pScreen)
-{
-   ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
-   I830Ptr pI830 = I830PTR(pScrn);
-
-   pI830->want_vblank_interrupts = FALSE;
-   I830DRISetVBlankInterrupt(pScrn, FALSE);
-}
-
-static int
-i830_name_buffer (ScrnInfoPtr pScrn, i830_memory *mem)
-{
-    if (mem && mem->bo)
-    {
-	if (!mem->gem_name)
-	{
-	    int ret;
-	    ret = dri_bo_flink(mem->bo, &mem->gem_name);
-	    if (ret != 0)
-	    {
-		xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-			   "[drm] failed to name buffer %d\n", -errno);
-		return -1;
-	    }
-	}
-	return mem->gem_name;
-    }
-    return -1;
-}
-
-/**
- * Update the SAREA fields with current buffer information.
- *
- * Most of the SAREA fields are already updated by i830_do_addmap().
- *
- * This does include other SAREA initialization which will actually be constant
- * over the lifetime of the server.
- */
-static void
-i830_update_sarea(ScrnInfoPtr pScrn, drmI830Sarea *sarea)
-{
-   ScreenPtr pScreen = pScrn->pScreen;
-   I830Ptr pI830 = I830PTR(pScrn);
-
-   if (pI830->directRenderingType == DRI_DRI2)
-       return;
-
-   sarea->width = pScreen->width;
-   sarea->height = pScreen->height;
-   sarea->pitch = pScrn->displayWidth;
-   sarea->virtualX = pScrn->virtualX;
-   sarea->virtualY = pScrn->virtualY;
-
-   sarea->front_tiled = (pI830->front_buffer->tiling != TILE_NONE);
-   sarea->back_tiled = (pI830->back_buffer->tiling != TILE_NONE);
-   sarea->depth_tiled = (pI830->depth_buffer->tiling != TILE_NONE);
-   sarea->rotated_tiled = FALSE;
-
-   sarea->log_tex_granularity = pI830->TexGranularity;
-
-   sarea->front_bo_handle = i830_name_buffer (pScrn, pI830->front_buffer);
-   sarea->back_bo_handle = i830_name_buffer (pScrn, pI830->back_buffer);
-   sarea->depth_bo_handle = i830_name_buffer (pScrn, pI830->depth_buffer);
-
-   /* The rotation is now handled entirely by the X Server, so just leave the
-    * DRI unaware.
-    */
-   sarea->rotation = 0;
-   sarea->rotated_offset = -1;
-   sarea->rotated_size = 0;
-   sarea->rotated_pitch = pScrn->displayWidth;
-}
-
-/**
- * Updates the DRI mapping for the given i830_memory struct, with the given
- * flags.
- */
-static int
-i830_do_addmap(ScrnInfoPtr pScrn, i830_memory *mem,
-	       drm_handle_t *sarea_handle, int *sarea_size, int *sarea_offset)
-{
-    I830Ptr pI830 = I830PTR(pScrn);
-    int size = mem->size;
-
-    if (mem == pI830->front_buffer) {
-	/* Workaround for XAA pixmap cache: Don't use front_buffer->size
-	 * and instead, calculate the visible frontbuffer size and round to
-	 * avoid irritating the assertions of older DRI drivers.
-	 */
-	size = ROUND_TO_PAGE(pScrn->displayWidth * pScrn->virtualY *
-			     pI830->cpp);
-    }
-
-    if (*sarea_handle != 0 &&
-	(*sarea_size != size || *sarea_offset != mem->offset))
-    {
-	drmRmMap(pI830->drmSubFD, *sarea_handle);
-	*sarea_handle = 0;
-	*sarea_size = 0;
-	*sarea_offset = 0;
-    }
-
-    if (*sarea_handle == 0) {
-	int ret;
-
-	ret = drmAddMap(pI830->drmSubFD,
-			(drm_handle_t)(mem->offset + pI830->LinearAddr),
-			size, DRM_AGP, 0,
-			(drmAddress) sarea_handle);
-	if (ret == 0) {
-	    xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-		       "[drm] mapped %s at 0x%08lx, handle = 0x%08x\n",
-		       mem->name, mem->offset + pI830->LinearAddr,
-		       (int)*sarea_handle);
-	    *sarea_size = size;
-	    *sarea_offset = mem->offset;
-	} else {
-	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-		       "[drm] failed to map %s at 0x%08lx\n",
-		       mem->name, mem->offset + pI830->LinearAddr);
-	    return FALSE;
-	}
-    }
-
-    return TRUE;
-}
-
-/**
- * Updates the DRM mappings with the current buffer information.
- *
- * Some old DRI drivers may be unprepared for buffers actually moving at
- * runtime, which would likely result in bus errors on software fallbacks or
- * hangs or misrendering on hardware rendering.
- */
-static Bool
-i830_update_dri_mappings(ScrnInfoPtr pScrn, drmI830Sarea *sarea)
-{
-   I830Ptr pI830 = I830PTR(pScrn);
-
-   if (!i830_do_addmap(pScrn, pI830->front_buffer, &sarea->front_handle,
-		       &sarea->front_size, &sarea->front_offset)) {
-       xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Disabling DRI.\n");
-       return FALSE;
-   }
-
-   if (!i830_do_addmap(pScrn, pI830->back_buffer, &sarea->back_handle,
-		       &sarea->back_size, &sarea->back_offset)) {
-       xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Disabling DRI.\n");
-       return FALSE;
-   }
-
-   sarea->third_handle = 0;
-   sarea->third_offset = 0;
-   sarea->third_size = 0;
-
-   if (!i830_do_addmap(pScrn, pI830->depth_buffer, &sarea->depth_handle,
-		       &sarea->depth_size, &sarea->depth_offset)) {
-       xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Disabling DRI.\n");
-       return FALSE;
-   }
-
-   if (pI830->allocate_classic_textures) {
-       if (!i830_do_addmap(pScrn, pI830->textures, &sarea->tex_handle,
-			   &sarea->tex_size, &sarea->tex_offset)) {
-	   xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Disabling DRI.\n");
-	   return FALSE;
-       }
-   }
-
-   return TRUE;
-}
-
-static void
-i830_update_screen_private(ScrnInfoPtr pScrn, drmI830Sarea *sarea)
-{
-   I830Ptr pI830 = I830PTR(pScrn);
-
-   pI830->pDRIInfo->frameBufferPhysicalAddress = (char *) pI830->LinearAddr;
-   pI830->pDRIInfo->frameBufferStride = pScrn->displayWidth * pI830->cpp;
-   pI830->pDRIInfo->frameBufferSize = sarea->front_size;
-#if DRI_DRIVER_FRAMEBUFFER_MAP
-   pI830->pDRIInfo->hFrameBuffer = sarea->front_handle;
-#endif
-}
-
-/**
- * Update the SAREA fields, DRI mappings, and screen info passed through the
- * protocol.
- *
- * This gets called both at startup and after any of the buffers might have
- * been relocated.
- */
-Bool
-i830_update_dri_buffers(ScrnInfoPtr pScrn)
-{
-   ScreenPtr pScreen = pScrn->pScreen;
-   I830Ptr pI830 = I830PTR(pScrn);
-   drmI830Sarea *sarea;
-   Bool success;
-
-   if (pI830->directRenderingType != DRI_XF86DRI)
-       return TRUE;
-
-   sarea = (drmI830Sarea *) DRIGetSAREAPrivate(pScreen);
-
-   success = i830_update_dri_mappings(pScrn, sarea);
-   if (!success)
-       return FALSE;
-   i830_update_sarea(pScrn, sarea);
-   i830_update_screen_private(pScrn, sarea);
-
-   return TRUE;
-}
-
-Bool
-I830DRISetVBlankInterrupt (ScrnInfoPtr pScrn, Bool on)
-{
-    I830Ptr pI830 = I830PTR(pScrn);
-    xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
-    drmI830VBlankPipe pipe;
-
-    /* If we have no 3d running, then don't bother enabling the vblank
-     * interrupt.
-     */
-    if (!pI830->want_vblank_interrupts)
-	on = FALSE;
-
-    if (pI830->directRenderingType == DRI_XF86DRI && pI830->drmMinor >= 5) {
-	if (on) {
-	    if (xf86_config->num_crtc > 1 && xf86_config->crtc[1]->enabled)
-		if (pI830->drmMinor >= 6)
-		    pipe.pipe = DRM_I830_VBLANK_PIPE_A | DRM_I830_VBLANK_PIPE_B;
-		else
-		    pipe.pipe = DRM_I830_VBLANK_PIPE_B;
-	    else
-		pipe.pipe = DRM_I830_VBLANK_PIPE_A;
-	} else {
-	    pipe.pipe = 0;
-	}
-	if (drmCommandWrite(pI830->drmSubFD, DRM_I830_SET_VBLANK_PIPE,
-			    &pipe, sizeof (pipe))) {
-	    return FALSE;
-	}
-    }
-
-    return TRUE;
-}
-
-Bool
-I830DRILock(ScrnInfoPtr pScrn)
-{
-   I830Ptr pI830 = I830PTR(pScrn);
-
-   if (pI830->directRenderingType == DRI_XF86DRI && !pI830->LockHeld) {
-      DRILock(screenInfo.screens[pScrn->scrnIndex], 0);
-      pI830->LockHeld = 1;
-      if (!pI830->memory_manager)
-	  i830_refresh_ring(pScrn);
-      return TRUE;
-   }
-   else
-      return FALSE;
-}
-
-
-
-void
-I830DRIUnlock(ScrnInfoPtr pScrn)
-{
-   I830Ptr pI830 = I830PTR(pScrn);
-
-   if (pI830->directRenderingType == DRI_XF86DRI && pI830->LockHeld) {
-      DRIUnlock(screenInfo.screens[pScrn->scrnIndex]);
-      pI830->LockHeld = 0;
-   }
-}
-
-#ifdef DRI2
-
 typedef struct {
     PixmapPtr pPixmap;
     unsigned int attachment;
@@ -1901,5 +467,3 @@ void I830DRI2CloseScreen(ScreenPtr pScreen)
     DRI2CloseScreen(pScreen);
     pI830->directRenderingType = DRI_NONE;
 }
-
-#endif
diff --git a/src/i830_driver.c b/src/i830_driver.c
index e0dbe77..f8373a8 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -206,11 +206,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "i830_hwmc.h"
 #endif
 
-#ifdef XF86DRI
-#include "dri.h"
 #include <sys/ioctl.h>
 #include "i915_drm.h"
-#endif
 
 #ifdef XF86DRM_MODE
 #include <xf86drmMode.h>
@@ -1624,7 +1621,6 @@ I830AccelMethodInit(ScrnInfoPtr pScrn)
     if (!xf86ReturnOptValBool(pI830->Options, OPTION_DRI, TRUE))
 	pI830->directRenderingType = DRI_DISABLED;
 
-#ifdef XF86DRI
     if (pI830->accel == ACCEL_NONE) {
 	xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "DRI is disabled because it "
 		"needs 2D acceleration.\n");
@@ -1634,7 +1630,6 @@ I830AccelMethodInit(ScrnInfoPtr pScrn)
 		"runs only at depths 16 and 24.\n");
 	pI830->directRenderingType = DRI_DISABLED;
     }
-#endif /* XF86DRI */
 
     I830MapMMIO(pScrn);
 
@@ -1664,12 +1659,8 @@ I830AccelMethodInit(ScrnInfoPtr pScrn)
 
     SaveHWState(pScrn);
     pI830->can_resize = FALSE;
-    if (pI830->accel == ACCEL_UXA && pI830->directRenderingType != DRI_XF86DRI)
+    if (pI830->accel == ACCEL_UXA)
 	pI830->can_resize = TRUE;
-#if !defined(DRI2) && defined(XF86DRI)
-    /* Disable resizing so that DRI1 can initialize and give us GEM support. */
-    pI830->can_resize = FALSE;
-#endif
 
     xf86DrvMsg(pScrn->scrnIndex, X_INFO,
 	       "Resizable framebuffer: %s (%d %d)\n",
@@ -1711,7 +1702,7 @@ I830DrmModeInit(ScrnInfoPtr pScrn)
     }
 
     pI830->can_resize = FALSE;
-    if (pI830->accel == ACCEL_UXA && pI830->directRenderingType != DRI_XF86DRI)
+    if (pI830->accel == ACCEL_UXA)
 	pI830->can_resize = TRUE;
 
     xf86DrvMsg(pScrn->scrnIndex, X_INFO,
@@ -1741,7 +1732,6 @@ I830DrmModeInit(ScrnInfoPtr pScrn)
     }
 
     pI830->directRenderingType = DRI_NONE;
-    pI830->allocate_classic_textures = FALSE;
 
     i830_init_bufmgr(pScrn);
 #endif
@@ -1973,23 +1963,11 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
        xf86SetOperatingState(resVgaMem, pI830->pEnt->index, ResDisableOpr);
    }
 
-#if defined(XF86DRI)
-   /* Load the dri module if requested. */
-   if (xf86ReturnOptValBool(pI830->Options, OPTION_DRI, FALSE) &&
-       pI830->directRenderingType != DRI_DISABLED) {
-      if (xf86LoadSubModule(pScrn, "dri")) {
-	 xf86LoaderReqSymLists(I810driSymbols, I810drmSymbols, NULL);
-      }
-   }
-#endif
-
-#if defined(DRI2)
    /* Load the dri2 module if requested. */
    if (xf86ReturnOptValBool(pI830->Options, OPTION_DRI, FALSE) &&
        pI830->directRenderingType != DRI_DISABLED) {
        xf86LoadSubModule(pScrn, "dri2");
    }
-#endif
 
    pI830->preinit = FALSE;
 
@@ -2265,9 +2243,6 @@ RestoreHWState(ScrnInfoPtr pScrn)
 
    DPRINTF(PFX, "RestoreHWState\n");
 
-#ifdef XF86DRI
-   I830DRISetVBlankInterrupt (pScrn, FALSE);
-#endif
    /* Disable outputs */
    for (i = 0; i < xf86_config->num_output; i++) {
       xf86OutputPtr   output = xf86_config->output[i];
@@ -2579,16 +2554,6 @@ IntelEmitInvarientState(ScrnInfoPtr pScrn)
    if (pI830->accel == ACCEL_NONE)
       return;
 
-#ifdef XF86DRI
-   if (pI830->directRenderingType == DRI_XF86DRI) {
-      drmI830Sarea *sarea = DRIGetSAREAPrivate(pScrn->pScreen);
-
-      /* Mark that the X Server was the last holder of the context */
-      if (sarea)
-	 sarea->ctxOwner = DRIGetContext(pScrn->pScreen);
-   }
-#endif
-
    /* If we've emitted our state since the last clobber by another client,
     * skip it.
     */
@@ -2635,10 +2600,8 @@ I830BlockHandler(int i,
 	* fashion.
 	*/
        intel_batch_flush(pScrn, flushed);
-#ifdef XF86DRI
        if (pI830->memory_manager)
 	 drmCommandNone(pI830->drmSubFD, DRM_I915_GEM_THROTTLE);
-#endif
 
        pI830->need_mi_flush = FALSE;
     }
@@ -2700,7 +2663,6 @@ i830_try_memory_allocation(ScrnInfoPtr pScrn)
 {
     I830Ptr pI830 = I830PTR(pScrn);
     Bool tiled = pI830->tiling;
-    Bool xf86dri = pI830->directRenderingType == DRI_XF86DRI;
 
     xf86DrvMsg(pScrn->scrnIndex, X_INFO,
 	    "Attempting memory allocation with %stiled buffers.\n",
@@ -2713,9 +2675,6 @@ i830_try_memory_allocation(ScrnInfoPtr pScrn)
 	if (!i830_allocate_pwrctx(pScrn))
 	    goto failed;
 
-    if (xf86dri && !i830_allocate_3d_memory(pScrn))
-	goto failed;
-
     xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%siled allocation successful.\n",
 	    tiled ? "T" : "Unt");
     return TRUE;
@@ -2780,18 +2739,6 @@ i830_memory_init(ScrnInfoPtr pScrn)
 		"disabled\n");
     pI830->fb_compression = FALSE;
 
-    /* Try again, but leave DRI enabled */
-    if (pI830->directRenderingType == DRI_XF86DRI) {
-	if (i830_try_memory_allocation(pScrn))
-	    return TRUE;
-	else {
-	    i830_reset_allocations(pScrn);
-	    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Couldn't allocate 3D memory, "
-		    "disabling DRI.\n");
-	    pI830->directRenderingType = DRI_NONE;
-	}
-    }
-
     if (i830_try_memory_allocation(pScrn))
 	return TRUE;
 
@@ -2901,9 +2848,7 @@ I830SwapPipes(ScrnInfoPtr pScrn)
     *       alone in that case.
     * Also make sure the DRM can handle the swap.
     */
-   if (I830LVDSPresent(pScrn) && !IS_I965GM(pI830) && !IS_GM45(pI830) &&
-       (pI830->directRenderingType != DRI_XF86DRI ||
-	(pI830->directRenderingType == DRI_XF86DRI && pI830->drmMinor >= 10))) {
+   if (I830LVDSPresent(pScrn) && !IS_I965GM(pI830) && !IS_GM45(pI830)) {
        xf86DrvMsg(pScrn->scrnIndex, X_INFO, "adjusting plane->pipe mappings "
 		  "to allow for framebuffer compression\n");
        for (c = 0; c < config->num_crtc; c++) {
@@ -3008,14 +2953,6 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
        pI830->directRenderingType = DRI_DRI2;
 #endif
 
-#ifdef XF86DRI
-   /* If DRI hasn't been explicitly disabled, try to initialize it.
-    * It will be used by the memory allocator.
-    */
-   if (!pI830->can_resize && pI830->directRenderingType == DRI_NONE && I830DRIScreenInit(pScreen))
-       pI830->directRenderingType = DRI_XF86DRI;
-#endif
-
    /* Enable tiling by default */
    pI830->tiling = TRUE;
 
@@ -3115,32 +3052,8 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
    }
    i830_init_bufmgr(pScrn);
 
-#ifdef XF86DRI
-   /*
-    * Setup DRI after visuals have been established, but before fbScreenInit
-    * is called.   fbScreenInit will eventually call into the drivers
-    * InitGLXVisuals call back.
-    */
-   if (pI830->directRenderingType == DRI_XF86DRI) {
-      if (pI830->accel == ACCEL_NONE) {
-	 xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "DRI is disabled because it "
-		    "needs 2D acceleration.\n");
-	 pI830->directRenderingType = DRI_NONE;
-      }
-   }
-
-   if (pI830->directRenderingType == DRI_XF86DRI &&
-       !I830DRIDoMappings(pScreen))
-       pI830->directRenderingType = DRI_NONE;
-
-   /* If we failed for any reason, free DRI memory. */
-   if (pI830->directRenderingType != DRI_XF86DRI &&
-       pI830->back_buffer != NULL)
-       i830_free_3d_memory(pScrn);
-
    if (!pI830->use_drm_mode)
        I830SwapPipes(pScrn);
-#endif
 
    pScrn->fbOffset = pI830->front_buffer->offset;
 
@@ -3219,15 +3132,6 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
       xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
 		 "Hardware cursor initialization failed\n");
 
-#ifdef XF86DRI
-   /* Must be called before EnterVT, so we can acquire the DRI lock when
-    * binding our memory.
-    */
-   if (pI830->directRenderingType == DRI_XF86DRI &&
-       !I830DRIFinishScreenInit(pScreen))
-       pI830->directRenderingType = DRI_NONE;
-#endif
-
    /* Must force it before EnterVT, so we are in control of VT and
     * later memory should be bound when allocating, e.g rotate_mem */
    pScrn->vtSema = TRUE;
@@ -3263,9 +3167,8 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
 #ifdef I830_XV
 #ifdef INTEL_XVMC
     pI830->XvMCEnabled = FALSE;
-    from =  (pI830->directRenderingType == DRI_XF86DRI &&
-	     xf86GetOptValBool(pI830->Options, OPTION_XVMC,
-			       &pI830->XvMCEnabled)) ? X_CONFIG : X_DEFAULT;
+    from =  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
@@ -3277,13 +3180,8 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
    /* Setup 3D engine, needed for rotation too */
    IntelEmitInvarientState(pScrn);
 
-#if defined(XF86DRI) || defined(DRI2)
+#if defined(DRI2)
    switch (pI830->directRenderingType) {
-   case DRI_XF86DRI:
-      pI830->directRenderingOpen = TRUE;
-      xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-		 "direct rendering: XF86DRI Enabled\n");
-      break;
    case DRI_DRI2:
       pI830->directRenderingOpen = TRUE;
       xf86DrvMsg(pScrn->scrnIndex, X_INFO, "direct rendering: DRI2 Enabled\n");
@@ -3374,17 +3272,6 @@ I830LeaveVT(int scrnIndex, int flags)
 
    i830SetHotkeyControl(pScrn, HOTKEY_BIOS_SWITCH);
 
-#ifdef XF86DRI
-   if (pI830->directRenderingOpen &&
-       pI830->directRenderingType == DRI_XF86DRI) {
-      DRILock(screenInfo.screens[pScrn->scrnIndex], 0);
-
-      if (!pI830->memory_manager) {
-	  I830DRISetVBlankInterrupt (pScrn, FALSE);
-	  drmCtlUninstHandler(pI830->drmSubFD);
-      }
-   }
-#endif
 
 #ifndef HAVE_FREE_SHADOW
    for (o = 0; o < config->num_crtc; o++) {
@@ -3426,7 +3313,6 @@ I830LeaveVT(int scrnIndex, int flags)
 
    i830_unbind_all_memory(pScrn);
 
-#ifdef XF86DRI
    if (pI830->memory_manager && !pI830->use_drm_mode) {
       int ret;
 
@@ -3437,7 +3323,6 @@ I830LeaveVT(int scrnIndex, int flags)
       if (ret != 0)
 	 FatalError("DRM_I915_LEAVEVT failed: %s\n", strerror(ret));
    }
-#endif /* XF86DRI */
 
    if ((pI830->accel == ACCEL_EXA || pI830->accel == ACCEL_UXA) && IS_I965G(pI830))
       gen4_render_state_cleanup(pScrn);
@@ -3445,12 +3330,10 @@ I830LeaveVT(int scrnIndex, int flags)
    if (pI830->AccelInfoRec)
       pI830->AccelInfoRec->NeedToSync = FALSE;
 
-#ifdef XF86DRI
    ret = drmDropMaster(pI830->drmSubFD);
    if (ret)
       xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
 		 "drmDropMaster failed: %s\n", strerror(errno));
-#endif
 }
 
 /*
@@ -3466,7 +3349,6 @@ I830EnterVT(int scrnIndex, int flags)
 
    DPRINTF(PFX, "Enter VT\n");
 
-#ifdef XF86DRI
    ret = drmSetMaster(pI830->drmSubFD);
    if (ret) {
       if (errno == EINVAL) {
@@ -3478,7 +3360,6 @@ I830EnterVT(int scrnIndex, int flags)
 		    "drmSetMaster failed: %s\n", strerror(errno));
       }
    }
-#endif
 
    /*
     * Only save state once per server generation since that's what most
@@ -3512,7 +3393,6 @@ I830EnterVT(int scrnIndex, int flags)
    if (!pI830->use_drm_mode)
        i830_disable_render_standby(pScrn);
 
-#ifdef XF86DRI
    if (pI830->memory_manager && !pI830->use_drm_mode) {
       int ret;
 
@@ -3523,7 +3403,6 @@ I830EnterVT(int scrnIndex, int flags)
       if (ret != 0)
 	 FatalError("DRM_I915_ENTERVT failed: %s\n", strerror(ret));
    }
-#endif /* XF86DRI */
 
    if (!i830_bind_all_memory(pScrn))
       return FALSE;
@@ -3575,54 +3454,6 @@ I830EnterVT(int scrnIndex, int flags)
        i830DescribeOutputConfiguration(pScrn);
    }
 
-#ifdef XF86DRI
-   if (pI830->directRenderingType == DRI_XF86DRI) {
-       /* HW status is fixed, we need to set it up before any drm
-	* operation which accessing that page, like irq install, etc.
-	*/
-       if (pI830->starting && !pI830->memory_manager) {
-	   if (pI830->hw_status != NULL && !I830DRISetHWS(pScrn)) {
-		   xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-			   "Fail to setup hardware status page.\n");
-		   I830DRICloseScreen(pScrn->pScreen);
-		   return FALSE;
-	   }
-	   if (!pI830->memory_manager && !I830DRIInstIrqHandler(pScrn)) {
-	       I830DRICloseScreen(pScrn->pScreen);
-	       return FALSE;
-	   }
-       }
-
-      /* Update buffer offsets in sarea and mappings, since buffer offsets
-       * may have changed.
-       */
-      if (!i830_update_dri_buffers(pScrn))
-	 FatalError("i830_update_dri_buffers() failed\n");
-
-      I830DRISetVBlankInterrupt (pScrn, TRUE);
-
-      if (!pI830->starting) {
-         ScreenPtr pScreen = pScrn->pScreen;
-         drmI830Sarea *sarea = (drmI830Sarea *) DRIGetSAREAPrivate(pScreen);
-         int i;
-
-	 I830DRIResume(screenInfo.screens[scrnIndex]);
-
-	 if (!pI830->memory_manager)
-	    i830_refresh_ring(pScrn);
-	 I830Sync(pScrn);
-
-	 sarea->texAge++;
-	 for(i = 0; i < I830_NR_TEX_REGIONS+1 ; i++)
-	    sarea->texList[i].age = sarea->texAge;
-
-	 DPRINTF(PFX, "calling dri unlock\n");
-	 DRIUnlock(screenInfo.screens[pScrn->scrnIndex]);
-      }
-      pI830->LockHeld = 0;
-   }
-#endif
-
    /* Set the hotkey to just notify us.  We could check its results
     * periodically and attempt to do something, but it seems like we basically
     * never get results when we should, and this should all be better handled
@@ -3717,20 +3548,10 @@ I830CloseScreen(int scrnIndex, ScreenPtr pScreen)
    dri_bufmgr_destroy(pI830->bufmgr);
    pI830->bufmgr = NULL;
 
-#ifdef XF86DRI
-   if (pI830->directRenderingOpen &&
-       pI830->directRenderingType == DRI_XF86DRI) {
-      pI830->directRenderingOpen = FALSE;
-      I830DRICloseScreen(pScreen);
-   }
-#endif
-
-#ifdef DRI2
    if (pI830->directRenderingOpen && pI830->directRenderingType == DRI_DRI2) {
       pI830->directRenderingOpen = FALSE;
       I830DRI2CloseScreen(pScreen);
    }
-#endif
 
    xf86GARTCloseScreen(scrnIndex);
 
diff --git a/src/i830_exa.c b/src/i830_exa.c
index 2f74d14..e88d260 100644
--- a/src/i830_exa.c
+++ b/src/i830_exa.c
@@ -737,8 +737,6 @@ I830EXAInit(ScreenPtr pScreen)
 	}
     }
 
-    I830SelectBuffer(pScrn, I830_SELECT_FRONT);
-
     return TRUE;
 }
 
@@ -1043,26 +1041,8 @@ i830_uxa_init (ScreenPtr pScreen)
     pScreen->CreatePixmap = i830_uxa_create_pixmap;
     pScreen->DestroyPixmap = i830_uxa_destroy_pixmap;
 
-    I830SelectBuffer(scrn, I830_SELECT_FRONT);
-
     uxa_set_fallback_debug(pScreen, i830->fallback_debug);
 
     return TRUE;
 }
 #endif /* I830_USE_UXA */
-
-#ifdef XF86DRI
-
-#ifndef ExaOffscreenMarkUsed
-extern void ExaOffscreenMarkUsed(PixmapPtr);
-#endif
-
-unsigned long long
-I830TexOffsetStart(PixmapPtr pPix)
-{
-    exaMoveInPixmap(pPix);
-    ExaOffscreenMarkUsed(pPix);
-
-    return exaGetPixmapOffset(pPix);
-}
-#endif
diff --git a/src/i830_memory.c b/src/i830_memory.c
index 760e07c..14b52ed 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -107,9 +107,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 #include "i830.h"
 #include "i810_reg.h"
-#ifdef XF86DRI
 #include "i915_drm.h"
-#endif
 
 #define ALIGN(i,m)    (((i) + (m) - 1) & ~((m) - 1))
 
@@ -225,7 +223,6 @@ i830_bind_memory(ScrnInfoPtr pScrn, i830_memory *mem)
     if (mem == NULL || mem->bound)
 	return TRUE;
 
-#ifdef XF86DRI
     if (mem->bo != NULL) {
 	if (dri_bo_pin(mem->bo, mem->alignment) != 0) {
 	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
@@ -238,7 +235,6 @@ i830_bind_memory(ScrnInfoPtr pScrn, i830_memory *mem)
 	mem->offset = mem->bo->offset;
 	mem->end = mem->offset + mem->size;
     }
-#endif
 
     if (!mem->bound) {
 	if (!pI830->gtt_acquired)
@@ -274,7 +270,6 @@ i830_unbind_memory(ScrnInfoPtr pScrn, i830_memory *mem)
 	!pI830->kernel_exec_fencing)
 	i830_clear_tiling(pScrn, mem->fence_nr);
 
-#ifdef XF86DRI
     if (mem->bo != NULL) {
 	if (dri_bo_unpin(mem->bo) == 0) {
 	    mem->bound = FALSE;
@@ -286,7 +281,6 @@ i830_unbind_memory(ScrnInfoPtr pScrn, i830_memory *mem)
 	    return FALSE;
 	}
     }
-#endif
 
     if (mem->key == -1 || xf86UnbindGARTMemory(pScrn->scrnIndex, mem->key)) {
 	mem->bound = FALSE;
@@ -305,7 +299,6 @@ i830_free_memory(ScrnInfoPtr pScrn, i830_memory *mem)
     /* Free any AGP memory. */
     i830_unbind_memory(pScrn, mem);
 
-#ifdef XF86DRI
     if (mem->bo != NULL) {
 	I830Ptr pI830 = I830PTR(pScrn);
 	dri_bo_unreference (mem->bo);
@@ -323,7 +316,6 @@ i830_free_memory(ScrnInfoPtr pScrn, i830_memory *mem)
 	xfree(mem);
 	return;
     }
-#endif
 	    /* Disconnect from the list of allocations */
     if (mem->prev != NULL)
 	mem->prev->next = mem->next;
@@ -352,14 +344,12 @@ i830_reset_allocations(ScrnInfoPtr pScrn)
     while (pI830->memory_list->next->next != NULL) {
 	i830_memory *mem = pI830->memory_list->next;
 
-#ifdef XF86DRI
 	/* Don't reset BO allocator, which we set up at init. */
 	if (pI830->memory_manager == mem) {
 	    mem = mem->next;
 	    if (mem->next == NULL)
 		break;
 	}
-#endif	
 
 	i830_free_memory(pScrn, mem);
     }
@@ -383,30 +373,10 @@ i830_reset_allocations(ScrnInfoPtr pScrn)
     pI830->exa_offscreen = NULL;
     pI830->overlay_regs = NULL;
     pI830->power_context = NULL;
-#ifdef XF86DRI
-    pI830->back_buffer = NULL;
-    pI830->depth_buffer = NULL;
-    pI830->textures = NULL;
-#endif
     pI830->ring.mem = NULL;
     pI830->fake_bufmgr_mem = NULL;
 }
 
-void
-i830_free_3d_memory(ScrnInfoPtr pScrn)
-{
-    I830Ptr pI830 = I830PTR(pScrn);
-
-#ifdef XF86DRI
-    i830_free_memory(pScrn, pI830->back_buffer);
-    pI830->back_buffer = NULL;
-    i830_free_memory(pScrn, pI830->depth_buffer);
-    pI830->depth_buffer = NULL;
-    i830_free_memory(pScrn, pI830->textures);
-    pI830->textures = NULL;
-#endif
-}
-
 /**
  * Initialize's the driver's video memory allocator to allocate in the
  * given range.
@@ -421,13 +391,9 @@ i830_allocator_init(ScrnInfoPtr pScrn, unsigned long offset, unsigned long size)
 {
     I830Ptr pI830 = I830PTR(pScrn);
     i830_memory *start, *end;
-#ifdef XF86DRI
-    int dri_major, dri_minor, dri_patch;
     struct drm_i915_getparam gp;
     struct drm_i915_setparam sp;
     int has_gem;
-    int has_dri;
-#endif
 
     start = xcalloc(1, sizeof(*start));
     if (start == NULL)
@@ -464,18 +430,9 @@ i830_allocator_init(ScrnInfoPtr pScrn, unsigned long offset, unsigned long size)
 
     pI830->memory_list = start;
 
-#ifdef XF86DRI
     has_gem = FALSE;
-    has_dri = FALSE;
-    
-    if (pI830->directRenderingType == DRI_XF86DRI &&
-	xf86LoaderCheckSymbol ("DRIQueryVersion"))
-    {
-	DRIQueryVersion(&dri_major, &dri_minor, &dri_patch);
-	has_dri = TRUE;
-    }
 
-    if (pI830->directRenderingType >= DRI_XF86DRI)
+    if (pI830->directRenderingType >= DRI_DRI2)
     {
 	has_gem = FALSE;
 	gp.param = I915_PARAM_HAS_GEM;
@@ -490,10 +447,7 @@ i830_allocator_init(ScrnInfoPtr pScrn, unsigned long offset, unsigned long size)
      * 5.4 or newer so we can rely on the lock being held after DRIScreenInit,
      * rather than after DRIFinishScreenInit.
      */
-    if ((pI830->directRenderingType == DRI_XF86DRI && has_gem && has_dri &&
-	(dri_major > 5 || (dri_major == 5 && dri_minor >= 4))) ||
-	(pI830->directRenderingType == DRI_DRI2 && has_gem))
-    {
+    if (pI830->directRenderingType == DRI_DRI2 && has_gem) {
 	int mmsize;
 
 	/* Take over all of the graphics aperture minus enough to for
@@ -562,10 +516,7 @@ i830_allocator_init(ScrnInfoPtr pScrn, unsigned long offset, unsigned long size)
 	    i830_free_memory(pScrn, pI830->memory_manager);
 	    pI830->memory_manager = NULL;
 	}
-    } else {
-	pI830->allocate_classic_textures = TRUE;
     }
-#endif /* XF86DRI */
 
     return TRUE;
 }
@@ -580,7 +531,6 @@ i830_allocator_fini(ScrnInfoPtr pScrn)
 
     /* The memory manager is more special */
     if (pI830->memory_manager) {
-	 /* XXX drmMMTakedown(pI830->drmSubFD, DRM_BO_MEM_TT);*/
 	 i830_free_memory(pScrn, pI830->memory_manager);
 	 pI830->memory_manager = NULL;
     }
@@ -798,7 +748,6 @@ i830_allocate_agp_memory(ScrnInfoPtr pScrn, i830_memory *mem, int flags)
     return TRUE;
 }
 
-#ifdef XF86DRI
 static i830_memory *
 i830_allocate_memory_bo(ScrnInfoPtr pScrn, const char *name,
 			unsigned long size, unsigned long pitch,
@@ -886,7 +835,6 @@ i830_allocate_memory_bo(ScrnInfoPtr pScrn, const char *name,
 
     return mem;
 }
-#endif /* XF86DRI */
 
 /* Allocates video memory at the given size, pitch, alignment and tile format.
  *
@@ -913,9 +861,7 @@ i830_allocate_memory(ScrnInfoPtr pScrn, const char *name,
 		     enum tile_format tile_format)
 {
     i830_memory *mem;
-#ifdef XF86DRI
     I830Ptr pI830 = I830PTR(pScrn);
-#endif
 
     /* Manage tile alignment and size constraints */
     if (tile_format != TILE_NONE) {
@@ -935,14 +881,12 @@ i830_allocate_memory(ScrnInfoPtr pScrn, const char *name,
 	size = i830_get_fence_size(pI830, size);
 	alignment = i830_get_fence_alignment(pI830, size);
     }
-#ifdef XF86DRI
     if (pI830->use_drm_mode || (pI830->memory_manager &&
 				!(flags & NEED_PHYSICAL_ADDR) &&
 				!(flags & NEED_LIFETIME_FIXED)))
     {
 	return i830_allocate_memory_bo(pScrn, name, size, pitch, alignment, flags, tile_format);
     } else
-#endif /* XF86DRI */
     {
 	mem = i830_allocate_aperture(pScrn, name, size, pitch, alignment, flags, tile_format);
 	if (mem == NULL)
@@ -1517,167 +1461,6 @@ i830_allocate_2d_memory(ScrnInfoPtr pScrn)
     return TRUE;
 }
 
-#ifdef XF86DRI
-static unsigned int
-myLog2(unsigned int n)
-{
-    unsigned int log2 = 1;
-
-    while (n > 1) {
-	n >>= 1;
-	log2++;
-    }
-    return log2;
-}
-
-static Bool
-i830_allocate_backbuffer(ScrnInfoPtr pScrn, i830_memory **buffer,
-			 const char *name)
-{
-    I830Ptr pI830 = I830PTR(pScrn);
-    unsigned int pitch = pScrn->displayWidth * pI830->cpp;
-    unsigned long size;
-    int height;
-    enum tile_format tile_format = TILE_NONE;;
-
-    if (pI830->rotation & (RR_Rotate_0 | RR_Rotate_180))
-	height = pScrn->virtualY;
-    else
-	height = pScrn->virtualX;
-
-    /* Try to allocate on the best tile-friendly boundaries. */
-    if (pI830->tiling && IsTileable(pScrn, pitch))
-    {
-	size = ROUND_TO_PAGE(pitch * ALIGN(height, 16));
-	tile_format = TILE_XMAJOR;
-    }
-    else
-    {
-	size = ROUND_TO_PAGE(pitch * height);
-	tile_format = TILE_NONE;
-    }
-    *buffer = i830_allocate_memory(pScrn, name, size, pitch,
-				   GTT_PAGE_SIZE,
-				   ALIGN_BOTH_ENDS |
-				   ALLOW_SHARING,
-				   tile_format);
-
-    if (*buffer == NULL) {
-	xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
-		   "Failed to allocate %s space.\n", name);
-	return FALSE;
-    }
-
-    return TRUE;
-}
-
-static Bool
-i830_allocate_depthbuffer(ScrnInfoPtr pScrn)
-{
-    I830Ptr pI830 = I830PTR(pScrn);
-    unsigned long size;
-    unsigned int pitch = pScrn->displayWidth * pI830->cpp;
-    int height;
-    int flags;
-    enum tile_format tile_format = TILE_NONE;
-
-    height = pScrn->virtualY;
-
-    /* First try allocating it tiled */
-    flags = ALLOW_SHARING;
-    if (pI830->tiling && IsTileable(pScrn, pitch))
-    {
-	/* The 965 requires that the depth buffer be in Y Major format, while
-	 * the rest appear to fail when handed that format.
-	 */
-	tile_format = IS_I965G(pI830) ? TILE_YMAJOR: TILE_XMAJOR;
-	height = ALIGN(height, 16);
-	flags |= ALIGN_BOTH_ENDS;
-    }
-    size = ROUND_TO_PAGE(pitch * height);
-
-    pI830->depth_buffer =
-	    i830_allocate_memory(pScrn, "depth buffer", size, pitch,
-				 GTT_PAGE_SIZE, flags, tile_format);
-
-    if (pI830->depth_buffer == NULL) {
-	xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
-		   "Failed to allocate depth buffer space.\n");
-	return FALSE;
-    }
-
-    return TRUE;
-}
-
-static Bool
-i830_allocate_texture_memory(ScrnInfoPtr pScrn)
-{
-    I830Ptr pI830 = I830PTR(pScrn);
-    unsigned long size;
-    int i;
-
-    if (pI830->allocate_classic_textures) {
-	/* XXX: auto-sizing */
-	size = MB(32);
-	i = myLog2(size / I830_NR_TEX_REGIONS);
-	if (i < I830_LOG_MIN_TEX_REGION_SIZE)
-	    i = I830_LOG_MIN_TEX_REGION_SIZE;
-	pI830->TexGranularity = i;
-	/* Truncate size */
-	size >>= i;
-	size <<= i;
-	if (size < KB(512)) {
-	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-		       "Less than 512 kBytes for texture space (real %ld"
-		       "kBytes).\n",
-		       size / 1024);
-	    return FALSE;
-	}
-	/* Now that the DRM uses the sarea to get the offsets of the buffers,
-	 * and we update the classic DRM mappings and the sarea contents on
-	 * changes, the NEED_LIFETIME_FIXED is no longer true and should be
-	 * made conditional on DRM version.
-	 */
-	pI830->textures = i830_allocate_memory(pScrn, "classic textures", size,
-					       PITCH_NONE,
-					       GTT_PAGE_SIZE,
-					       ALLOW_SHARING |
-					       NEED_LIFETIME_FIXED,
-					       TILE_NONE);
-	if (pI830->textures == NULL) {
-	    xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
-		       "Failed to allocate texture space.\n");
-	    return FALSE;
-	}
-    }
-
-    return TRUE;
-}
-
-static Bool
-i830_allocate_hwstatus(ScrnInfoPtr pScrn)
-{
-    I830Ptr pI830 = I830PTR(pScrn);
-    int flags;
-
-    /* The current DRM will leak the HWS mapping if we update the address
-     * after init (at best), so allocate it fixed for its lifetime
-     * (i.e. not through buffer objects).
-     */
-    flags = NEED_LIFETIME_FIXED;
-    if (HWS_NEED_NONSTOLEN(pI830))
-	    flags |= NEED_NON_STOLEN;
-    pI830->hw_status = i830_allocate_memory(pScrn, "HW status",
-	    HWSTATUS_PAGE_SIZE, PITCH_NONE, GTT_PAGE_SIZE, flags,
-					    TILE_NONE);
-    if (pI830->hw_status == NULL) {
-	xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
-		"Failed to allocate hw status page.\n");
-	return FALSE;
-    }
-    return TRUE;
-}
-
 Bool
 i830_allocate_pwrctx(ScrnInfoPtr pScrn)
 {
@@ -1699,31 +1482,6 @@ i830_allocate_pwrctx(ScrnInfoPtr pScrn)
     return TRUE;
 }
 
-Bool
-i830_allocate_3d_memory(ScrnInfoPtr pScrn)
-{
-    I830Ptr pI830 = I830PTR(pScrn);
-
-    DPRINTF(PFX, "i830_allocate_3d_memory\n");
-
-    if (!pI830->memory_manager && HWS_NEED_GFX(pI830)) {
-	if (!i830_allocate_hwstatus(pScrn))
-	    return FALSE;
-    }
-
-    if (!i830_allocate_backbuffer(pScrn, &pI830->back_buffer, "back buffer"))
-	return FALSE;
-
-    if (!i830_allocate_depthbuffer(pScrn))
-	return FALSE;
-
-    if (!i830_allocate_texture_memory(pScrn))
-	return FALSE;
-
-    return TRUE;
-}
-#endif
-
 /**
  * Sets up tiled surface registers ("fences") for the hardware.
  *
diff --git a/src/i830_xaa.c b/src/i830_xaa.c
index ede7cc2..a118055 100644
--- a/src/i830_xaa.c
+++ b/src/i830_xaa.c
@@ -249,27 +249,7 @@ I830CheckTiling(ScrnInfoPtr pScrn)
 {
    I830Ptr pI830 = I830PTR(pScrn);
 
-   if (pI830->bufferOffset == pI830->front_buffer->offset &&
-       pI830->front_buffer->tiling != TILE_NONE)
-   {
-       return TRUE;
-   }
-#ifdef XF86DRI
-   if (pI830->back_buffer != NULL &&
-       pI830->bufferOffset == pI830->back_buffer->offset &&
-       pI830->back_buffer->tiling != TILE_NONE)
-   {
-       return TRUE;
-   }
-   if (pI830->depth_buffer != NULL &&
-       pI830->bufferOffset == pI830->depth_buffer->offset &&
-       pI830->depth_buffer->tiling != TILE_NONE)
-   {
-       return TRUE;
-   }
-#endif
-
-   return FALSE;
+   return pI830->front_buffer->tiling != TILE_NONE;
 }
 
 void
@@ -331,7 +311,7 @@ I830SubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h)
 	}
 	OUT_BATCH(pI830->BR[13]);
 	OUT_BATCH((h << 16) | (w * pI830->cpp));
-	OUT_BATCH(pI830->bufferOffset + (y * pScrn->displayWidth + x) *
+	OUT_BATCH(pI830->front_buffer->offset + (y * pScrn->displayWidth + x) *
 		  pI830->cpp);
 	OUT_BATCH(pI830->BR[16]);
 	OUT_BATCH(0);
@@ -409,10 +389,10 @@ I830SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int src_x1, int src_y1,
 	OUT_BATCH(pI830->BR[13]);
 	OUT_BATCH((dst_y1 << 16) | (dst_x1 & 0xffff));
 	OUT_BATCH((dst_y2 << 16) | (dst_x2 & 0xffff));
-	OUT_BATCH(pI830->bufferOffset);
+	OUT_BATCH(pI830->front_buffer->offset);
 	OUT_BATCH((src_y1 << 16) | (src_x1 & 0xffff));
 	OUT_BATCH(pI830->BR[13] & 0xFFFF);
-	OUT_BATCH(pI830->bufferOffset);
+	OUT_BATCH(pI830->front_buffer->offset);
 
 	ADVANCE_BATCH();
     }
@@ -490,7 +470,7 @@ I830SubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, int pattx, int patty,
 	OUT_BATCH(pI830->BR[13]);
 	OUT_BATCH((y1 << 16) | x1);
 	OUT_BATCH((y2 << 16) | x2);
-	OUT_BATCH(pI830->bufferOffset);
+	OUT_BATCH(pI830->front_buffer->offset);
 	OUT_BATCH(pI830->BR[18]);		/* bg */
 	OUT_BATCH(pI830->BR[19]);		/* fg */
 	OUT_BATCH(pI830->BR[16]);		/* pattern data */
@@ -571,7 +551,7 @@ I830SubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
 	       "%d,%d %dx%x %d\n", x, y, w, h, skipleft);
 
     /* Fill out register values */
-    pI830->BR[9] = (pI830->bufferOffset +
+    pI830->BR[9] = (pI830->front_buffer->offset +
 		    (y * pScrn->displayWidth + x) * pI830->cpp);
     pI830->BR[11] = ((1 << 16) | w);
 }
@@ -662,7 +642,7 @@ I830SubsequentScanlineImageWriteRect(ScrnInfoPtr pScrn, int x, int y,
 	       "%d,%d %dx%x %d\n", x, y, w, h, skipleft);
 
     /* Fill out register values */
-    pI830->BR[9] = (pI830->bufferOffset +
+    pI830->BR[9] = (pI830->front_buffer->offset +
 		    (y * pScrn->displayWidth + x) * pI830->cpp);
     pI830->BR[11] = ((1 << 16) | w);
 }
commit 47591334a183881704a121ae06ebc2fadebe6f73
Author: Eric Anholt <eric at anholt.net>
Date:   Fri Apr 17 13:54:47 2009 -0700

    Remove pre-server-1.5 support.

diff --git a/configure.ac b/configure.ac
index ae5278c..8dd04d5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -83,14 +83,7 @@ XORG_DRIVER_CHECK_EXT(XF86DRI, xextproto x11)
 XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto)
 
 # Checks for pkg-config packages
-PKG_CHECK_MODULES(XORG, [xorg-server >= 1.3 xproto fontsproto $REQUIRED_MODULES])
-
-PKG_CHECK_MODULES(SERVER_1_5, [xorg-server >= 1.5],
-			      [SERVER_1_5=yes], [SERVER_1_5=no])
-
-if test "$SERVER_1_5" = yes; then
-   AC_DEFINE(SERVER_1_5, 1, [Building against server 1.5])
-fi
+PKG_CHECK_MODULES(XORG, [xorg-server >= 1.6 xproto fontsproto $REQUIRED_MODULES])
 
 sdkdir=$(pkg-config --variable=sdkdir xorg-server)
 drm_cflags=$(pkg-config --cflags libdrm)
diff --git a/src/i830.h b/src/i830.h
index 9b99110..26f4bda 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -936,10 +936,6 @@ i830_get_transformed_coordinates_3d(int x, int y, PictTransformPtr transform,
 
 void i830_enter_render(ScrnInfoPtr);
 
-#ifndef SERVER_1_5
-Bool xf86MonitorIsHDMI(xf86MonPtr mon);
-#endif
-
 static inline void
 i830_wait_ring_idle(ScrnInfoPtr pScrn)
 {
diff --git a/src/i830_exa.c b/src/i830_exa.c
index 9896d43..2f74d14 100644
--- a/src/i830_exa.c
+++ b/src/i830_exa.c
@@ -83,18 +83,6 @@ const int I830PatternROP[16] =
 static int uxa_pixmap_index;
 #endif
 
-#ifndef SERVER_1_5
-static inline void *dixLookupPrivate(DevUnion **privates, int *key)
-{
-    return (*privates)[*key].ptr;
-}
-
-static inline void dixSetPrivate(DevUnion **privates, int *key, void *val)
-{
-    (*privates)[*key].ptr = val;
-}
-#endif
-
 /**
  * Returns whether a given pixmap is tiled or not.
  *
@@ -919,11 +907,7 @@ i830_uxa_create_pixmap (ScreenPtr screen, int w, int h, int depth, unsigned usag
     if (w > 32767 || h > 32767)
 	return NullPixmap;
 
-#ifdef SERVER_1_5
     pixmap = fbCreatePixmap (screen, 0, 0, depth, usage);
-#else
-    pixmap = fbCreatePixmap (screen, 0, 0, depth);
-#endif
 
     if (w && h)
     {
@@ -968,18 +952,6 @@ i830_uxa_create_pixmap (ScreenPtr screen, int w, int h, int depth, unsigned usag
     return pixmap;
 }
 
-
-#ifndef SERVER_1_5
-static PixmapPtr
-i830_uxa_server_14_create_pixmap (ScreenPtr screen, int w, int h, int depth)
-{
-    /* For server pre-1.6, we're never allocating DRI2 buffers, so no need for
-     * a hint.
-     */
-    return i830_uxa_create_pixmap(screen, w, h, depth, 0);
-}
-#endif
-
 static Bool
 i830_uxa_destroy_pixmap (PixmapPtr pixmap)
 {
@@ -1012,13 +984,8 @@ i830_uxa_init (ScreenPtr pScreen)
     ScrnInfoPtr scrn = xf86Screens[pScreen->myNum];
     I830Ptr i830 = I830PTR(scrn);
 
-#ifdef SERVER_1_5
     if (!dixRequestPrivate(&uxa_pixmap_index, 0))
 	return FALSE;
-#else
-    if (!AllocatePixmapPrivate(pScreen, uxa_pixmap_index, 0))
-	return FALSE;
-#endif
 
     i830->uxa_driver = uxa_driver_alloc();
     if (i830->uxa_driver == NULL) {
@@ -1073,11 +1040,7 @@ i830_uxa_init (ScreenPtr pScreen)
 	return FALSE;
     }
 
-#ifdef SERVER_1_5
     pScreen->CreatePixmap = i830_uxa_create_pixmap;
-#else
-    pScreen->CreatePixmap = i830_uxa_server_14_create_pixmap;
-#endif
     pScreen->DestroyPixmap = i830_uxa_destroy_pixmap;
 
     I830SelectBuffer(scrn, I830_SELECT_FRONT);
diff --git a/uxa/uxa-accel.c b/uxa/uxa-accel.c
index e322054..a225a4d 100644
--- a/uxa/uxa-accel.c
+++ b/uxa/uxa-accel.c
@@ -977,69 +977,6 @@ out:
     return ret;
 }
 
-#ifndef SERVER_1_5
-void
-uxa_paint_window(WindowPtr pWin, RegionPtr pRegion, int what)
-{
-    ScreenPtr       screen = pWin->drawable.pScreen;
-    uxa_screen_t    *uxa_screen = uxa_get_screen(screen);
-    DDXPointRec     zeros = { 0, 0 };
-
-    if (REGION_NIL(pRegion))
-	return;
-
-    if (uxa_screen->swappedOut) {
-	uxa_check_paint_window(pWin, pRegion, what);
-	return;
-    }
-
-    switch (what) {
-    case PW_BACKGROUND:
-	switch (pWin->backgroundState) {
-	case None:
-	    return;
-	case ParentRelative:
-	    do {
-		pWin = pWin->parent;
-	    } while (pWin->backgroundState == ParentRelative);
-	    (*pWin->drawable.pScreen->PaintWindowBackground)(pWin, pRegion,
-							     what);
-	    return;
-	case BackgroundPixel:
-	    if (uxa_fill_region_solid(&pWin->drawable, pRegion,
-				      pWin->background.pixel,
-				      FB_ALLONES, GXcopy))
-		return;
-	    break;
-	case BackgroundPixmap:
-	    if (uxa_fill_region_tiled(&pWin->drawable, pRegion,
-				      pWin->background.pixmap,
-				      &zeros, FB_ALLONES, GXcopy))
-		return;
-	    break;
-	}
-	break;
-    case PW_BORDER:
-	if (pWin->borderIsPixel) {
-	    if (uxa_fill_region_solid(&pWin->drawable, pRegion,
-				      pWin->border.pixel,
-				      FB_ALLONES, GXcopy))
-		return;
-	    break;
-	} else {
-	    if (uxa_fill_region_tiled(&pWin->drawable, pRegion,
-				      pWin->border.pixmap,
-				      &zeros, FB_ALLONES, GXcopy))
-		return;
-	    break;
-	}
-	break;
-    }
-
-    uxa_check_paint_window(pWin, pRegion, what);
-}
-#endif /* !SERVER_1_5 */
-
 /**
  * Accelerates GetImage for solid ZPixmap downloads from framebuffer memory.
  *
diff --git a/uxa/uxa-glyphs.c b/uxa/uxa-glyphs.c
index 3cb03f5..af5f587 100644
--- a/uxa/uxa-glyphs.c
+++ b/uxa/uxa-glyphs.c
@@ -50,8 +50,6 @@
 
 #include "mipict.h"
 
-#ifdef SERVER_1_5
-
 #if DEBUG_GLYPH_CACHE
 #define DBG_GLYPH_CACHE(a) ErrorF a
 #else
@@ -873,5 +871,3 @@ uxa_glyphs (CARD8 	 op,
 	(*pScreen->DestroyPixmap) (pMaskPixmap);
     }
 }
-
-#endif /* SERVER_1_5 */
diff --git a/uxa/uxa-priv.h b/uxa/uxa-priv.h
index 3b3a350..3d2b776 100644
--- a/uxa/uxa-priv.h
+++ b/uxa/uxa-priv.h
@@ -139,10 +139,6 @@ typedef struct {
     CloseScreenProcPtr 		 SavedCloseScreen;
     GetImageProcPtr 		 SavedGetImage;
     GetSpansProcPtr 		 SavedGetSpans;
-#ifndef SERVER_1_5
-    PaintWindowBackgroundProcPtr SavedPaintWindowBackground;
-    PaintWindowBorderProcPtr	 SavedPaintWindowBorder;
-#endif
     CreatePixmapProcPtr 	 SavedCreatePixmap;
     DestroyPixmapProcPtr 	 SavedDestroyPixmap;
     CopyWindowProcPtr 		 SavedCopyWindow;
@@ -181,12 +177,8 @@ extern int uxa_screen_index;
 static inline uxa_screen_t *
 uxa_get_screen(ScreenPtr screen)
 {
-#ifdef SERVER_1_5
     return (uxa_screen_t *)dixLookupPrivate(&screen->devPrivates,
 					    &uxa_screen_index);
-#else
-    return screen->devPrivates[uxa_screen_index].ptr;
-#endif
 }
 
 /** Align an offset to an arbitrary alignment */
diff --git a/uxa/uxa-render.c b/uxa/uxa-render.c
index edbf0d8..b377bf5 100644
--- a/uxa/uxa-render.c
+++ b/uxa/uxa-render.c
@@ -818,13 +818,8 @@ uxa_create_alpha_picture (ScreenPtr     pScreen,
 	    return 0;
     }
 
-#ifdef SERVER_1_5
     pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height,
 					pPictFormat->depth, 0);
-#else
-    pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height,
-					pPictFormat->depth);
-#endif
     if (!pPixmap)
 	return 0;
     pGC = GetScratchGC (pPixmap->drawable.depth, pScreen);
diff --git a/uxa/uxa-unaccel.c b/uxa/uxa-unaccel.c
index f63c03b..8f86468 100644
--- a/uxa/uxa-unaccel.c
+++ b/uxa/uxa-unaccel.c
@@ -336,24 +336,6 @@ uxa_check_get_spans (DrawablePtr pDrawable,
     }
 }
 
-#ifndef SERVER_1_5
-void
-uxa_check_paint_window (WindowPtr pWin, RegionPtr pRegion, int what)
-{
-    ScreenPtr screen = pWin->drawable.pScreen;
-
-    UXA_FALLBACK(("from %p (%c)\n", pWin,
-		  uxa_drawable_location (&pWin->drawable)));
-    if (uxa_prepare_access (&pWin->drawable, UXA_ACCESS_RW)) {
-	if (uxa_prepare_access_window (pWin)) {
-	    fbPaintWindow (pWin, pRegion, what);
-	    uxa_finish_access_window (pWin);
-	}
-	uxa_finish_access(&pWin->drawable);
-    }
-}
-#endif
-
 void
 uxa_check_composite (CARD8      op,
                    PicturePtr pSrc,
diff --git a/uxa/uxa.c b/uxa/uxa.c
index b51a282..1f2d75b 100644
--- a/uxa/uxa.c
+++ b/uxa/uxa.c
@@ -40,9 +40,6 @@
 #include "uxa.h"
 
 int uxa_screen_index;
-#ifndef SERVER_1_5
-static int uxa_generation;
-#endif
 
 /**
  * uxa_get_drawable_pixmap() returns a backing pixmap for a given drawable.
@@ -370,18 +367,12 @@ uxa_close_screen(int i, ScreenPtr pScreen)
     PictureScreenPtr	ps = GetPictureScreenIfSet(pScreen);
 #endif
 
-#ifdef SERVER_1_5
     uxa_glyphs_fini(pScreen);
-#endif
 
     pScreen->CreateGC = uxa_screen->SavedCreateGC;
     pScreen->CloseScreen = uxa_screen->SavedCloseScreen;
     pScreen->GetImage = uxa_screen->SavedGetImage;
     pScreen->GetSpans = uxa_screen->SavedGetSpans;
-#ifndef SERVER_1_5
-    pScreen->PaintWindowBackground = uxa_screen->SavedPaintWindowBackground;
-    pScreen->PaintWindowBorder = uxa_screen->SavedPaintWindowBorder;
-#endif
     pScreen->CreatePixmap = uxa_screen->SavedCreatePixmap;
     pScreen->DestroyPixmap = uxa_screen->SavedDestroyPixmap;
     pScreen->CopyWindow = uxa_screen->SavedCopyWindow;
@@ -478,15 +469,7 @@ uxa_driver_init(ScreenPtr screen, uxa_driver_t *uxa_driver)
 
     uxa_screen->info = uxa_driver;
 
-#ifdef SERVER_1_5
     dixSetPrivate(&screen->devPrivates, &uxa_screen_index, uxa_screen);
-#else
-    if (uxa_generation != serverGeneration) {
-	uxa_screen_index = AllocateScreenPrivateIndex();
-	uxa_generation = serverGeneration;
-    }
-    screen->devPrivates[uxa_screen_index].ptr = uxa_screen;
-#endif
 
 //    exaDDXDriverInit(screen);
 
@@ -505,14 +488,6 @@ uxa_driver_init(ScreenPtr screen, uxa_driver_t *uxa_driver)
     uxa_screen->SavedGetSpans = screen->GetSpans;
     screen->GetSpans = uxa_check_get_spans;
 
-#ifndef SERVER_1_5
-    uxa_screen->SavedPaintWindowBackground = screen->PaintWindowBackground;
-    screen->PaintWindowBackground = uxa_paint_window;
-
-    uxa_screen->SavedPaintWindowBorder = screen->PaintWindowBorder;
-    screen->PaintWindowBorder = uxa_paint_window;
-#endif /* !SERVER_1_5 */
-
     uxa_screen->SavedCopyWindow = screen->CopyWindow;
     screen->CopyWindow = uxa_copy_window;
 
@@ -530,10 +505,8 @@ uxa_driver_init(ScreenPtr screen, uxa_driver_t *uxa_driver)
         uxa_screen->SavedComposite = ps->Composite;
 	ps->Composite = uxa_composite;
 
-#ifdef SERVER_1_5
 	uxa_screen->SavedGlyphs = ps->Glyphs;
 	ps->Glyphs = uxa_glyphs;
-#endif
 
 	uxa_screen->SavedTriangles = ps->Triangles;
 	ps->Triangles = uxa_triangles;
@@ -554,9 +527,7 @@ uxa_driver_init(ScreenPtr screen, uxa_driver_t *uxa_driver)
     ShmRegisterFuncs(screen, &uxa_shm_funcs);
 #endif
 
-#ifdef SERVER_1_5
     uxa_glyphs_init(screen);
-#endif
 
     LogMessage(X_INFO, "UXA(%d): Driver registered support for the following"
 	       " operations:\n", screen->myNum);
commit 3187c7698b93f1d0e07798e9c42ca2877d55e055
Author: Eric Anholt <eric at anholt.net>
Date:   Mon Apr 27 14:50:54 2009 -0700

    Fix assert at startup with DRI initialiation failure.
    
    In this path, we'd make it to allocator_init -> init_bufmgr without
    GEM and without FbBase being initialized, leading to assertion failure
    to catch this mistake.
    
    Comedy ensued when trying to move just the MapMem up, leading to the rest
    of the commit.  Some day (like tomorrow after I rebase intel-cleanup) I'll
    clean this path up.
    
    Tested with 2 X Servers on 2.6.28 (one gets DRI2, one fails successfully),
    2 UMS X Servers on 2.6.30rc2 (each gets DRI2), and 2 KMS X Servers on
    2.6.30rc2 (success all around).

diff --git a/src/i830_driver.c b/src/i830_driver.c
index cc0f76d..e0dbe77 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -670,9 +670,6 @@ I830MapMem(ScrnInfoPtr pScrn)
    for (i = 2; i < pI830->FbMapSize; i <<= 1) ;
    pI830->FbMapSize = i;
 
-   if (!I830MapMMIO(pScrn))
-      return FALSE;
-
 #if XSERVER_LIBPCIACCESS
    err = pci_device_map_range (device, pI830->LinearAddr, pI830->FbMapSize,
 			       PCI_DEV_MAP_FLAG_WRITABLE | PCI_DEV_MAP_FLAG_WRITE_COMBINE,
@@ -3071,14 +3068,21 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
    if (!pI830->use_drm_mode)
        I830MapMMIO(pScrn);
 
+   /* Need FB mapped to set up the fake bufmgr if we end up doing that
+    * in i830_memory_init() -> i830_allocator_init().
+    */
+   if (!pI830->use_drm_mode) {
+      if (!I830MapMem(pScrn))
+	 return FALSE;
+      pScrn->memPhysBase = (unsigned long)pI830->FbBase;
+   }
+
    if (!i830_memory_init(pScrn)) {
        xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
 	       "Couldn't allocate video memory\n");
        return FALSE;
    }
 
-   I830UnmapMMIO(pScrn);
-
    i830_fixup_mtrrs(pScrn);
 
    pI830->starting = TRUE;
@@ -3109,13 +3113,6 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
 	   pI830->accel = ACCEL_NONE;
       }
    }
-
-   if (!pI830->use_drm_mode) {
-      DPRINTF(PFX, "assert( if(!I830MapMem(pScrn)) )\n");
-      if (!I830MapMem(pScrn))
-	 return FALSE;
-      pScrn->memPhysBase = (unsigned long)pI830->FbBase;
-   }
    i830_init_bufmgr(pScrn);
 
 #ifdef XF86DRI
diff --git a/src/i830_memory.c b/src/i830_memory.c
index 54cee56..760e07c 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -1065,6 +1065,7 @@ i830_allocate_ringbuffer(ScrnInfoPtr pScrn)
     }
 
     pI830->ring.tail_mask = pI830->ring.mem->size - 1;
+    pI830->ring.virtual_start = pI830->FbBase + pI830->ring.mem->offset;
     return TRUE;
 }
 
commit fbaf13c93511547c563129527797fbef8628652e
Author: Eric Anholt <eric at anholt.net>
Date:   Mon Apr 27 16:05:50 2009 -0700

    Don't clear the framebuffer if it isn't currently bound.
    
    This segfault can be triggered in non-KMS memory init before the EnterVT,
    and will happen anyway at EnterVT time.

diff --git a/src/i830_memory.c b/src/i830_memory.c
index 470734e..54cee56 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -1273,7 +1273,7 @@ i830_allocate_framebuffer(ScrnInfoPtr pScrn)
 	return NULL;
     }
 
-    if (!pI830->use_drm_mode && pI830->FbBase)
+    if (!pI830->use_drm_mode && pI830->FbBase && front_buffer->bound)
 	memset (pI830->FbBase + front_buffer->offset, 0, size);
 
     return front_buffer;
commit ab878118b9fb46c437a02f824d29f4a206e7fd80
Author: Eric Anholt <eric at anholt.net>
Date:   Mon Apr 27 16:00:05 2009 -0700

    Don't initialize DRI2 if the fd we get is not master-capable.

diff --git a/src/i830_dri.c b/src/i830_dri.c
index 70b76ae..93bb340 100644
--- a/src/i830_dri.c
+++ b/src/i830_dri.c
@@ -1829,8 +1829,22 @@ Bool I830DRI2ScreenInit(ScreenPtr pScreen)
 	info.fd = pI830->drmSubFD;
 #endif
 
-    if (info.fd < 0)
+    if (info.fd < 0) {
 	info.fd = drmOpen("i915", buf);
+	drmSetVersion sv;
+	int err;
+
+	/* Check that what we opened was a master or a master-capable FD,
+	 * by setting the version of the interface we'll use to talk to it.
+	 * (see DRIOpenDRMMaster() in DRI1)
+	 */
+	sv.drm_di_major = 1;
+	sv.drm_di_minor = 1;
+	sv.drm_dd_major = -1;
+	err = drmSetInterfaceVersion(info.fd, &sv);
+	if (err != 0)
+	    return FALSE;
+    }
 
     if (info.fd < 0) {
 	xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Failed to open DRM device\n");
commit 385ac2197b64574f30620a203e675d8da0e1472f
Author: Eric Anholt <eric at anholt.net>
Date:   Mon Apr 27 15:28:21 2009 -0700

    Fix drmSetMaster/DropMaster error messages.

diff --git a/src/i830_driver.c b/src/i830_driver.c
index b4e1737..cc0f76d 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -3452,7 +3452,7 @@ I830LeaveVT(int scrnIndex, int flags)
    ret = drmDropMaster(pI830->drmSubFD);
    if (ret)
       xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
-		 "drmDropMaster failed: %s\n", strerror(ret));
+		 "drmDropMaster failed: %s\n", strerror(errno));
 #endif
 }
 
@@ -3471,9 +3471,16 @@ I830EnterVT(int scrnIndex, int flags)
 
 #ifdef XF86DRI
    ret = drmSetMaster(pI830->drmSubFD);
-   if (ret)
-      xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
-		 "drmDropMaster failed: %s\n", strerror(ret));
+   if (ret) {
+      if (errno == EINVAL) {
+	 xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+		    "drmSetMaster failed: 2.6.29 or newer kernel required for "
+		    "multi-server DRI\n");
+      } else {
+	 xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+		    "drmSetMaster failed: %s\n", strerror(errno));
+      }
+   }
 #endif
 
    /*
commit 5b05a589efb23b2fc09b06e4271174d922b1ab02
Author: Pierre Willenbrock <pierre at pirsoft.de>
Date:   Sat Apr 25 22:58:20 2009 +0200

    format == 0 means "use default" in I830DRI2CreateBuffer
    
    Reviewed-by: Ian Romanick <idr at freedesktop.org>

diff --git a/src/i830_dri.c b/src/i830_dri.c
index 4ab09c9..70b76ae 100644
--- a/src/i830_dri.c
+++ b/src/i830_dri.c
@@ -1677,7 +1677,7 @@ I830DRI2CreateBuffer(DrawablePtr pDraw, unsigned int attachment,
 	pPixmap = (*pScreen->CreatePixmap)(pScreen,
 					   pDraw->width,
 					   pDraw->height,
-					   format,
+					   (format != 0)?format:pDraw->depth,
 					   hint);
 
     }
commit e55d943126cdd3eac7dfec5f40e794f89dbf038b
Author: Eric Anholt <eric at anholt.net>
Date:   Mon Apr 27 11:18:07 2009 -0700

    Don't try to do anything for I830Sync when VT switched.
    
    Fixes a crash with fake bufmgr and UXA.

diff --git a/src/i830_accel.c b/src/i830_accel.c
index 67f264c..cae36dc 100644
--- a/src/i830_accel.c
+++ b/src/i830_accel.c
@@ -177,7 +177,7 @@ I830Sync(ScrnInfoPtr pScrn)
    if (I810_DEBUG & (DEBUG_VERBOSE_ACCEL | DEBUG_VERBOSE_SYNC))
       ErrorF("I830Sync\n");
 
-   if (pI830->accel == ACCEL_NONE)
+   if (pI830->accel == ACCEL_NONE || !pScrn->vtSema || !pI830->batch_bo)
        return;
 
 #ifdef XF86DRI
commit 9748aa5594a8357754c06dd82108b131260b1a71
Author: Shuang He <shuang.he at intel.com>
Date:   Sat Apr 18 11:48:08 2009 +0800

    Free front buffer bo when X exit
    
    It's needed when KMS or DRI2 is enabled, or there will be memory leak.
    Also fixes a segfault at startup with fake bufmgr.
    
    Signed-off-by: Eric Anholt <eric at anholt.net>

diff --git a/src/i830_driver.c b/src/i830_driver.c
index 276132e..b4e1737 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -3694,6 +3694,12 @@ I830CloseScreen(int scrnIndex, ScreenPtr pScreen)
        pI830->uxa_driver = NULL;
    }
 #endif
+   if (pI830->front_buffer) {
+	i830_set_pixmap_bo(pScreen->GetScreenPixmap(pScreen), NULL);
+	i830_free_memory(pScrn, pI830->front_buffer);
+	pI830->front_buffer = NULL;
+   }
+
    xf86_cursors_fini (pScreen);
 
    i830_allocator_fini(pScrn);
diff --git a/src/i830_exa.c b/src/i830_exa.c
index 5199cef..9896d43 100644
--- a/src/i830_exa.c
+++ b/src/i830_exa.c
@@ -788,7 +788,8 @@ i830_set_pixmap_bo(PixmapPtr pixmap, dri_bo *bo)
 	dri_bo_unreference (old_bo);
 #if I830_USE_UXA
     if (i830->accel == ACCEL_UXA) {
-	dri_bo_reference(bo);
+	if (bo != NULL)
+	    dri_bo_reference(bo);
 	dixSetPrivate(&pixmap->devPrivates, &uxa_pixmap_index, bo);
     }
 #endif
@@ -797,7 +798,8 @@ i830_set_pixmap_bo(PixmapPtr pixmap, dri_bo *bo)
 	struct i830_exa_pixmap_priv *driver_priv =
 	    exaGetPixmapDriverPrivate(pixmap);
 	if (driver_priv) {
-	    dri_bo_reference(bo);
+	    if (bo != NULL)
+		dri_bo_reference(bo);
 	    driver_priv->bo = bo;
 	}
     }
commit b8ca146b060e6f76bf048f1f6cf6ee89d38d015e
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date:   Fri Apr 24 16:03:27 2009 -0700

    Fix UXA to build with Sun compilers (use __func__ instead of __FUNCTION__)
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at sun.com>

diff --git a/src/common.h b/src/common.h
index d27d484..99b4645 100644
--- a/src/common.h
+++ b/src/common.h
@@ -40,7 +40,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define _INTEL_COMMON_H_
 
 /* Provide substitutes for gcc's __FUNCTION__ on other compilers */
-#ifndef __GNUC__
+#if !defined(__GNUC__) && !defined(__FUNCTION__)
 # if defined(__STDC__) && (__STDC_VERSION__>=199901L) /* C99 */
 #  define __FUNCTION__ __func__
 # else
diff --git a/uxa/uxa-priv.h b/uxa/uxa-priv.h
index d1cd341..3b3a350 100644
--- a/uxa/uxa-priv.h
+++ b/uxa/uxa-priv.h
@@ -64,6 +64,16 @@
 #endif
 #include "damage.h"
 
+/* Provide substitutes for gcc's __FUNCTION__ on other compilers */
+#if !defined(__GNUC__) && !defined(__FUNCTION__)
+# if defined(__STDC__) && (__STDC_VERSION__>=199901L) /* C99 */
+#  define __FUNCTION__ __func__
+# else
+#  define __FUNCTION__ ""
+# endif
+#endif
+
+
 /* 1.6 and earlier server compat */
 #ifndef miGetCompositeClip
 #define miCopyRegion fbCopyRegion
commit 5d6f4f6eb7a4dcbe1ce5a134d882e56f958ed2ba
Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Fri Apr 24 12:28:13 2009 -0700

    DRI2: If the SDK supports it, use the DRI2GetBuffersWithFormat interfaces
    
    If DRI2INFOREC_VERSION is defined in the server's dri2.h and has a
    value greater than 1, compile to use the CreateBuffer and
    DestroyBuffer interfaces.  The format parameter parameter to
    CreateBuffer is assumed to be the bits-per-pixel of the buffer.
    
    Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
    Reviewed-by: Kristian Høgsberg <krh at redhat.com>

diff --git a/src/i830_dri.c b/src/i830_dri.c
index cbb0db8..4ab09c9 100644
--- a/src/i830_dri.c
+++ b/src/i830_dri.c
@@ -93,6 +93,12 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 #ifdef DRI2
 #include "dri2.h"
+
+#if DRI2INFOREC_VERSION >= 1
+#define USE_DRI2_1_1_0
+#endif
+
+extern XF86ModuleData dri2ModuleData;
 #endif
 
 static Bool I830InitVisualConfigs(ScreenPtr pScreen);
@@ -1532,6 +1538,7 @@ typedef struct {
     unsigned int attachment;
 } I830DRI2BufferPrivateRec, *I830DRI2BufferPrivatePtr;
 
+#ifndef USE_DRI2_1_1_0
 static DRI2BufferPtr
 I830DRI2CreateBuffers(DrawablePtr pDraw, unsigned int *attachments, int count)
 {
@@ -1615,6 +1622,88 @@ I830DRI2CreateBuffers(DrawablePtr pDraw, unsigned int *attachments, int count)
     return buffers;
 }
 
+#else
+
+static DRI2BufferPtr
+I830DRI2CreateBuffer(DrawablePtr pDraw, unsigned int attachment,
+		     unsigned int format)
+{
+    ScreenPtr pScreen = pDraw->pScreen;
+    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+    I830Ptr pI830 = I830PTR(pScrn);
+    DRI2BufferPtr buffers;
+    dri_bo *bo;
+    I830DRI2BufferPrivatePtr privates;
+    PixmapPtr pPixmap;
+
+    buffers = xcalloc(1, sizeof *buffers);
+    if (buffers == NULL)
+	return NULL;
+    privates = xcalloc(1, sizeof *privates);
+    if (privates == NULL) {
+	xfree(buffers);
+	return NULL;
+    }
+
+    if (attachment == DRI2BufferFrontLeft) {
+	if (pDraw->type == DRAWABLE_PIXMAP)
+	    pPixmap = (PixmapPtr) pDraw;
+	else
+	    pPixmap = (*pScreen->GetWindowPixmap)((WindowPtr) pDraw);
+	pPixmap->refcnt++;
+    } else {
+	unsigned int hint = 0;
+
+	switch (attachment) {
+	case DRI2BufferDepth:
+	case DRI2BufferDepthStencil:
+	    if (SUPPORTS_YTILING(pI830))
+		hint = INTEL_CREATE_PIXMAP_TILING_Y;
+	    else
+		hint = INTEL_CREATE_PIXMAP_TILING_X;
+	    break;
+	case DRI2BufferFakeFrontLeft:
+	case DRI2BufferFakeFrontRight:
+	case DRI2BufferBackLeft:
+	case DRI2BufferBackRight:
+	    hint = INTEL_CREATE_PIXMAP_TILING_X;
+	    break;
+	}
+
+	if (!pI830->tiling ||
+	    (!IS_I965G(pI830) && !pI830->kernel_exec_fencing))
+	    hint = 0;
+
+	pPixmap = (*pScreen->CreatePixmap)(pScreen,
+					   pDraw->width,
+					   pDraw->height,
+					   format,
+					   hint);
+
+    }
+
+
+    buffers->attachment = attachment;
+    buffers->pitch = pPixmap->devKind;
+    buffers->cpp = pPixmap->drawable.bitsPerPixel / 8;
+    buffers->driverPrivate = privates;
+    buffers->format = format;
+    buffers->flags = 0; /* not tiled */
+    privates->pPixmap = pPixmap;
+    privates->attachment = attachment;
+
+    bo = i830_get_pixmap_bo (pPixmap);
+    if (dri_bo_flink(bo, &buffers->name) != 0) {
+	/* failed to name buffer */
+    }
+
+    return buffers;
+}
+
+#endif
+
+#ifndef USE_DRI2_1_1_0
+
 static void
 I830DRI2DestroyBuffers(DrawablePtr pDraw, DRI2BufferPtr buffers, int count)
 {
@@ -1635,6 +1724,24 @@ I830DRI2DestroyBuffers(DrawablePtr pDraw, DRI2BufferPtr buffers, int count)
     }
 }
 
+#else
+
+static void
+I830DRI2DestroyBuffer(DrawablePtr pDraw, DRI2BufferPtr buffer)
+{
+    if (buffer) {
+	I830DRI2BufferPrivatePtr private = buffer->driverPrivate;
+	ScreenPtr pScreen = pDraw->pScreen;
+
+	(*pScreen->DestroyPixmap)(private->pPixmap);
+
+	xfree(private);
+	xfree(buffer);
+    }
+}
+
+#endif
+
 static void
 I830DRI2CopyRegion(DrawablePtr pDraw, RegionPtr pRegion,
 		   DRI2BufferPtr pDstBuffer, DRI2BufferPtr pSrcBuffer)
@@ -1686,12 +1793,28 @@ Bool I830DRI2ScreenInit(ScreenPtr pScreen)
     int i;
     struct stat sbuf;
     dev_t d;
+#ifdef USE_DRI2_1_1_0
+    int dri2_major = 1;
+    int dri2_minor = 0;
+#endif
 
     if (pI830->accel != ACCEL_UXA) {
 	xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "DRI2 requires UXA\n");
 	return FALSE;
     }
 
+#ifdef USE_DRI2_1_1_0
+    if (xf86LoaderCheckSymbol("DRI2Version")) {
+	DRI2Version(& dri2_major, & dri2_minor);
+    }
+
+    if (dri2_minor < 1) {
+	xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+		   "DRI2 requires DRI2 module version 1.1.0 or later\n");
+	return FALSE;
+    }
+#endif
+
     sprintf(buf, "pci:%04x:%02x:%02x.%d",
 	    pI830->PciInfo->domain,
 	    pI830->PciInfo->bus,
@@ -1736,10 +1859,19 @@ Bool I830DRI2ScreenInit(ScreenPtr pScreen)
 
     info.driverName = IS_I965G(pI830) ? "i965" : "i915";
     info.deviceName = p;
-    info.version = 1;
 
+#ifdef USE_DRI2_1_1_0
+    info.version = 2;
+    info.CreateBuffers = NULL;
+    info.DestroyBuffers = NULL;
+    info.CreateBuffer = I830DRI2CreateBuffer;
+    info.DestroyBuffer = I830DRI2DestroyBuffer;
+#else
+    info.version = 1;
     info.CreateBuffers = I830DRI2CreateBuffers;
     info.DestroyBuffers = I830DRI2DestroyBuffers;
+#endif
+
     info.CopyRegion = I830DRI2CopyRegion;
 
     pI830->drmSubFD = info.fd;
commit 106e4b44c5af6552cbd079c4ec34def9dcfb168a
Author: Zhenyu Wang <zhenyu.z.wang at intel.com>
Date:   Fri Apr 24 10:55:09 2009 +0800

    SDVO: switch bus once for i2c transfer
    
    Before sdvo try to get edid by i2c bus, it must do switch control bus to ddc active state from sdvo only state.
    However if current state has been ddc active state, redundant switch operation in our driver will cause error-
    "Unable to write to SDVOCTRL_E for SDVOB Slave 0x70". The patch will do switch control bus only one time during
    whole edid transmission.
    
    It has fixed bug #19937
    
    Signed-off-by: Zhenyu Wang <zhenyu.z.wang at intel.com>
    Tested-by: Ma Ling <ling.ma at intel.com>
    Signed-off-by: Ma Ling <ling.ma at intel.com>

diff --git a/src/i830_sdvo.c b/src/i830_sdvo.c
index a291824..a4c9120 100644
--- a/src/i830_sdvo.c
+++ b/src/i830_sdvo.c
@@ -114,6 +114,9 @@ struct i830_sdvo_priv {
     /* Default 0 for full RGB range 0-255, 1 is for RGB range 16-235 */
     uint32_t broadcast_rgb;
 
+    /** This flag means if we should switch ddc bus before next i2c Start */
+    Bool ddc_bus_switch;
+
     /** State for save/restore */
     /** @{ */
     int save_sdvo_mult;
@@ -1403,7 +1406,10 @@ i830_sdvo_ddc_i2c_start(I2CBusPtr b, int timeout)
     I2CBusPtr		    i2cbus = intel_output->pI2CBus;
     struct i830_sdvo_priv   *dev_priv = intel_output->dev_priv;
 
-    i830_sdvo_set_control_bus_switch(output, dev_priv->ddc_bus);
+    if (dev_priv->ddc_bus_switch) {
+        i830_sdvo_set_control_bus_switch(output, dev_priv->ddc_bus);
+        dev_priv->ddc_bus_switch = FALSE;
+    }
     return i2cbus->I2CStart(i2cbus, timeout);
 }
 
@@ -1414,11 +1420,13 @@ i830_sdvo_ddc_i2c_stop(I2CDevPtr d)
     xf86OutputPtr	    output = d->pI2CBus->DriverPrivate.ptr;
     I830OutputPrivatePtr    intel_output = output->driver_private;
     I2CBusPtr		    i2cbus = intel_output->pI2CBus, savebus;
+    struct i830_sdvo_priv   *dev_priv = intel_output->dev_priv;
 
     savebus = d->pI2CBus;
     d->pI2CBus = i2cbus;
     i2cbus->I2CStop(d);
     d->pI2CBus = savebus;
+    dev_priv->ddc_bus_switch = TRUE;
 }
 
 /**
@@ -1721,7 +1729,6 @@ i830_sdvo_detect(xf86OutputPtr output)
     {
 	xf86MonPtr edid_mon;
 	/* Check EDID in DVI-I case */
-	i830_sdvo_set_control_bus_switch(output, dev_priv->ddc_bus);
 	edid_mon = xf86OutputGetEDID (output, intel_output->pDDCBus);
 	if (edid_mon && !DIGITAL(edid_mon->features.input_type)) {
 	    xfree(edid_mon);
@@ -2199,6 +2206,7 @@ i830_sdvo_init(ScrnInfoPtr pScrn, int output_device)
     ddcbus->I2CStop = i830_sdvo_ddc_i2c_stop;
     ddcbus->I2CAddress = i830_sdvo_ddc_i2c_address;
     ddcbus->DriverPrivate.ptr = output;
+    dev_priv->ddc_bus_switch = TRUE;
     
     if (!xf86I2CBusInit(ddcbus)) 
     {
commit 8f64837e56b2de0fb8a9100d1a844fd3f18d751c
Author: Shaohua Li <shaohua.li at intel.com>
Date:   Mon Feb 23 15:19:25 2009 +0800

    Disable FBC on IGD for UMS
    
    It appears the new chip doesn't support FBC currently.
    
    Signed-off-by: Shaohua Li<shaohua.li at intel.com>
    Signed-off-by: Zhenyu Wang <zhenyu.z.wang at intel.com>

diff --git a/src/i830.h b/src/i830.h
index 5772f1d..9b99110 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -955,6 +955,8 @@ static inline int i830_fb_compression_supported(I830Ptr pI830)
 	return FALSE;
     if (IS_I810(pI830) || IS_I815(pI830) || IS_I830(pI830))
 	return FALSE;
+    if (IS_IGD(pI830))
+	return FALSE;
     /* fbc depends on tiled surface. And we don't support tiled
      * front buffer with XAA now.
      */
commit 7b01aa5cc41620da5bb48f391ff98d9e82572e52
Author: Eric Anholt <eric at anholt.net>
Date:   Wed Apr 22 09:03:21 2009 -0700

    Revert "fix overflow warning on videoRam"
    
    This reverts commit 08ebde4715b87867184d42b60762cd774e151f5c, which was
    apparently untested and broke KMS.

diff --git a/src/i830_driver.c b/src/i830_driver.c
index 2249a99..276132e 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -3000,7 +3000,7 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
    if (pI830->use_drm_mode) {
 #ifdef XF86DRM_MODE
        pI830->stolen_size = 0;
-       pScrn->videoRam = INT_MAX / KB(1);
+       pScrn->videoRam = ~0UL / KB(1);
 #endif
    } else {
        I830AdjustMemory(pScreen);
commit ceb3a2eaf9090d67e4dfcbed188125108ceab78d
Author: Zdenek Kabelac <zdenek.kabelac at gmail.com>
Date:   Tue Apr 21 18:58:23 2009 -0700

    Remember allocated offscreenImages memory for freeing it in CloseScreen()
    
    Signed-off-by: Zdenek Kabelac <zkabelac at redhat.com>
    [anholt: renamed the member to match the variable name]
    Signed-off-by: Eric Anholt <eric at anholt.net>

diff --git a/src/i830.h b/src/i830.h
index b252f56..5772f1d 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -431,6 +431,7 @@ typedef struct _I830Rec {
 #ifdef I830_XV
    /* For Xvideo */
    i830_memory *overlay_regs;
+   void *offscreenImages;          /**< remembered memory block for release */
 #endif
 #ifdef INTEL_XVMC
    /* For XvMC */
diff --git a/src/i830_driver.c b/src/i830_driver.c
index f1ea511..2249a99 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -3700,6 +3700,8 @@ I830CloseScreen(int scrnIndex, ScreenPtr pScreen)
 
 #ifdef I830_XV
    i965_free_video(pScrn);
+   free(pI830->offscreenImages);
+   pI830->offscreenImages = NULL;
 #endif
 
    dri_bufmgr_destroy(pI830->bufmgr);
diff --git a/src/i830_video.c b/src/i830_video.c
index a62d7a1..f73c1f7 100644
--- a/src/i830_video.c
+++ b/src/i830_video.c
@@ -2886,11 +2886,12 @@ I830InitOffscreenImages(ScreenPtr pScreen)
     ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
     I830Ptr pI830 = I830PTR(pScrn);
 
-    /* need to free this someplace */
     if (!(offscreenImages = xalloc(sizeof(XF86OffscreenImageRec)))) {
 	return;
     }
 
+    pI830->offscreenImages = offscreenImages;
+
     offscreenImages[0].image = &Images[0];
     offscreenImages[0].flags = VIDEO_OVERLAID_IMAGES /*| VIDEO_CLIP_TO_VIEWPORT*/;
     offscreenImages[0].alloc_surface = I830AllocateSurface;
commit 701c6bef14b5d464847cc42c5ccb66fdeb157f1a
Author: Zdenek Kabelac <zdenek.kabelac at gmail.com>
Date:   Tue Apr 21 18:53:07 2009 -0700

    free allocated name inside sdvo_destroy
    
    Signed-off-by: Zdenek Kabelac <zkabelac at redhat.com>
    Signed-off-by: Eric Anholt <eric at anholt.net>

diff --git a/src/i830_sdvo.c b/src/i830_sdvo.c
index 41e8e59..a291824 100644
--- a/src/i830_sdvo.c
+++ b/src/i830_sdvo.c
@@ -1912,6 +1912,7 @@ i830_sdvo_destroy (xf86OutputPtr output)
 	xf86DestroyI2CBusRec (intel_output->pDDCBus, FALSE, FALSE);
 	xf86DestroyI2CDevRec (&dev_priv->d, FALSE);
 	xf86DestroyI2CBusRec (dev_priv->d.pI2CBus, TRUE, TRUE);
+	free(dev_priv->name);
 
 	if (output->randr_output) {
 	    RROutputPtr	randr_output = output->randr_output;
commit fe71217ca86eb7ae8081bf3e26d30f2002d27691
Author: Zdenek Kabelac <zdenek.kabelac at gmail.com>
Date:   Tue Apr 21 18:51:02 2009 -0700

    Unreference allocated bos in i965 render error paths
    
    Signed-off-by: Zdenek Kabelac <zkabelac at redhat.com>
    Signed-off-by: Eric Anholt <eric at anholt.net>

diff --git a/src/i965_render.c b/src/i965_render.c
index 704db97..e527f11 100644
--- a/src/i965_render.c
+++ b/src/i965_render.c
@@ -1285,8 +1285,10 @@ i965_prepare_composite(int op, PicturePtr pSrcPicture,
     surface_state_bo = dri_bo_alloc(pI830->bufmgr, "surface_state",
 				    3 * sizeof (brw_surface_state_padded),
 				    4096);
-    if (dri_bo_map(surface_state_bo, 1) != 0)
+    if (dri_bo_map(surface_state_bo, 1) != 0) {
+	dri_bo_unreference(surface_state_bo);
 	return FALSE;
+    }
     /* Set up the state buffer for the destination surface */
     i965_set_picture_surface_state(surface_state_bo, 0,
 				   pDstPicture, pDst, TRUE);
@@ -1305,6 +1307,7 @@ i965_prepare_composite(int op, PicturePtr pSrcPicture,
     binding_table_bo = dri_bo_alloc(pI830->bufmgr, "binding_table",
 				    3 * sizeof(uint32_t), 4096);
     if (dri_bo_map (binding_table_bo, 1) != 0) {
+	dri_bo_unreference(binding_table_bo);
 	dri_bo_unreference(surface_state_bo);
 	return FALSE;
     }
commit b8b6ca830b1fd6956c76a5417462ca55174cb881
Author: Zdenek Kabelac <zdenek.kabelac at gmail.com>
Date:   Tue Apr 21 18:47:03 2009 -0700

    Fix leak of some 965 render state on VT switch.
    
    Signed-off-by: Zdenek Kabelac <zkabelac at redhat.com>
    [anholt: fixed up unneeded != NULL checks]
    Signed-off-by: Eric Anholt <eric at anholt.net>

diff --git a/src/i965_render.c b/src/i965_render.c
index c3df9d2..704db97 100644
--- a/src/i965_render.c
+++ b/src/i965_render.c
@@ -1708,35 +1708,28 @@ gen4_render_state_cleanup(ScrnInfoPtr pScrn)
     I830Ptr pI830 = I830PTR(pScrn);
     struct gen4_render_state *render_state= pI830->gen4_render_state;
     int i, j, k, l, m;
+    gen4_composite_op *composite_op = &render_state->composite_op;
 
-    if (render_state->vertex_buffer_bo) {
-	dri_bo_unreference (render_state->vertex_buffer_bo);
-	render_state->vertex_buffer_bo = NULL;
-    }
+    drm_intel_bo_unreference(composite_op->binding_table_bo);
+    drm_intel_bo_unreference(render_state->vertex_buffer_bo);
 
     drm_intel_bo_unreference(render_state->vs_state_bo);
-    render_state->vs_state_bo = NULL;
     drm_intel_bo_unreference(render_state->sf_state_bo);
-    render_state->sf_state_bo = NULL;
     drm_intel_bo_unreference(render_state->sf_mask_state_bo);
-    render_state->sf_mask_state_bo = NULL;
 
-    for (i = 0; i < WM_KERNEL_COUNT; i++) {
+    for (i = 0; i < WM_KERNEL_COUNT; i++)
 	drm_intel_bo_unreference(render_state->wm_kernel_bo[i]);
-	render_state->wm_kernel_bo[i] = NULL;
-    }
 
     for (i = 0; i < SAMPLER_STATE_FILTER_COUNT; i++)
 	for (j = 0; j < SAMPLER_STATE_EXTEND_COUNT; j++)
 	    for (k = 0; k < SAMPLER_STATE_FILTER_COUNT; k++)
 		for (l = 0; l < SAMPLER_STATE_EXTEND_COUNT; l++)
-		    for (m = 0; m < WM_KERNEL_COUNT; m++) {
+		    for (m = 0; m < WM_KERNEL_COUNT; m++)
 			drm_intel_bo_unreference(render_state->wm_state_bo[m][i][j][k][l]);
-			render_state->wm_state_bo[m][i][j][k][l] = NULL;
-		    }
 
     drm_intel_bo_unreference(render_state->cc_state_bo);
-    render_state->cc_state_bo = NULL;
     drm_intel_bo_unreference(render_state->sip_kernel_bo);
-    render_state->sip_kernel_bo = NULL;
+
+    free(pI830->gen4_render_state);
+    pI830->gen4_render_state = NULL;
 }
commit d7ca870e1ce251d42e3689a8e1e7d080ab1325fb
Author: Albert Damen <albrt at gmx.net>
Date:   Sun Apr 5 16:36:35 2009 +0200

    Fix crash with XV with large virtual display
    
    If a virtual display with width > 2048 is used, the first time
    an XV buffer is needed will result in a BadAlloc error message,
    but the next time X would crash.
    
    Signed-off-by: Eric Anholt <eric at anholt.net>

diff --git a/src/i830_video.c b/src/i830_video.c
index 4ed3047..a62d7a1 100644
--- a/src/i830_video.c
+++ b/src/i830_video.c
@@ -2392,6 +2392,7 @@ I830PutImage(ScrnInfoPtr pScrn,
                 return BadAlloc;
             if (!pPriv->textured && drm_intel_bo_pin(pPriv->buf, 4096) != 0) {
                 drm_intel_bo_unreference(pPriv->buf);
+                pPriv->buf = NULL;
                 xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
                            "Failed to pin xv buffer\n");
                 return BadAlloc;
commit 04ed92e3db8d9fcf2a1089ed433ab67bf0969655
Author: Eric Anholt <eric at anholt.net>
Date:   Tue Apr 21 15:17:31 2009 -0700

    Remove dead xoffset/yoffset from pre-randr.

diff --git a/src/i830.h b/src/i830.h
index 49e08ce..b252f56 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -607,10 +607,6 @@ typedef struct _I830Rec {
    Bool suspended;
    Bool leaving;
 
-   /* fbOffset converted to (x, y). */
-   int xoffset;
-   int yoffset;
-
    unsigned int SaveGeneration;
 
    OsTimerPtr devicesTimer;
diff --git a/src/i830_driver.c b/src/i830_driver.c
index fabf94a..f1ea511 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -3147,9 +3147,6 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
 
    pScrn->fbOffset = pI830->front_buffer->offset;
 
-   pI830->xoffset = (pScrn->fbOffset / pI830->cpp) % pScrn->displayWidth;
-   pI830->yoffset = (pScrn->fbOffset / pI830->cpp) / pScrn->displayWidth;
-
    if (!pI830->use_drm_mode) {
        vgaHWSetMmioFuncs(hwp, pI830->MMIOBase, 0);
        vgaHWGetIOBase(hwp);
@@ -3330,7 +3327,7 @@ i830AdjustFrame(int scrnIndex, int x, int y, int flags)
    xf86CrtcPtr	crtc = output->crtc;
 
    DPRINTF(PFX, "i830AdjustFrame: y = %d (+ %d), x = %d (+ %d)\n",
-	   x, pI830->xoffset, y, pI830->yoffset);
+	   x, crtc->desiredX, y, crtc->desiredY);
 
    if (pI830->use_drm_mode)
       return;
commit ab2c988767aec854d3c1702bee1e5a06bd00870c
Author: Eric Anholt <eric at anholt.net>
Date:   Tue Apr 21 14:53:45 2009 -0700

    Remove dead monitor detect debugger.
    
    watch xrandr works fine.

diff --git a/src/i830_driver.c b/src/i830_driver.c
index 16a8a57..fabf94a 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -3831,42 +3831,6 @@ i830_pipe_to_crtc(ScrnInfoPtr pScrn, int pipe)
    return NULL;
 } 
 
-#if 0
-/**
- * This function is used for testing of the screen detect functions from the
- * periodic timer.
- */
-static void
-i830MonitorDetectDebugger(ScrnInfoPtr pScrn)
-{
-   Bool found_crt;
-   I830Ptr pI830 = I830PTR(pScrn);
-   int start, finish, i;
-
-   if (!pScrn->vtSema)
-      return 1000;
-
-   for (i = 0; i < xf86_config->num_output; i++) {
-      enum output_status ret;
-      char *result;
-
-      start = GetTimeInMillis();
-      ret = pI830->output[i].detect(pScrn, &pI830->output[i]);
-      finish = GetTimeInMillis();
-
-      if (ret == OUTPUT_STATUS_CONNECTED)
-	 result = "connected";
-      else if (ret == OUTPUT_STATUS_DISCONNECTED)
-	 result = "disconnected";
-      else
-	 result = "unknown";
-
-      xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Detected SDVO as %s in %dms\n",
-		 result, finish - start);
-   }
-}
-#endif
-
 void
 i830WaitSync(ScrnInfoPtr pScrn)
 {
commit 928a37041defcca6f57f9452ba62e67524cb4510
Author: Eric Anholt <eric at anholt.net>
Date:   Mon Apr 20 15:46:11 2009 -0700

    Replace a bunch of #ifdef debug flushing/syncing with a single function.
    
    This removes it from a callsite where it would have just resulted in a
    fatalerror.

diff --git a/src/i830.h b/src/i830.h
index f3bf250..49e08ce 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -124,6 +124,9 @@ typedef struct _I830OutputRec I830OutputRec, *I830OutputPtr;
 #endif
 #endif
 
+#define ALWAYS_SYNC 0
+#define ALWAYS_FLUSH 0
+
 typedef struct _I830Rec *I830Ptr;
 
 typedef void (*I830WriteIndexedByteFunc)(I830Ptr pI830, IOADDRESS addr,
@@ -1062,4 +1065,14 @@ enum {
     INTEL_CREATE_PIXMAP_TILING_Y,
 };
 
+#if (ALWAYS_FLUSH | ALWAYS_SYNC)
+void
+i830_debug_sync(ScrnInfoPtr scrn);
+#else
+static inline void
+i830_debug_sync(ScrnInfoPtr scrn)
+{
+}
+#endif
+
 #endif /* _I830_H_ */
diff --git a/src/i830_accel.c b/src/i830_accel.c
index 9f5bcb5..67f264c 100644
--- a/src/i830_accel.c
+++ b/src/i830_accel.c
@@ -271,6 +271,17 @@ I830SelectBuffer(ScrnInfoPtr pScrn, int buffer)
    return TRUE;
 }
 
+#if (ALWAYS_SYNC || ALWAYS_FLUSH)
+void
+i830_debug_sync(ScrnInfoPtr scrn)
+{
+    if (ALWAYS_SYNC)
+	I830Sync(scrn);
+    else
+	intel_batch_flush(scrn, FALSE);
+}
+#endif
+
 /* The following function sets up the supported acceleration. Call it
  * from the FbInit() function in the SVGA driver, or before ScreenInit
  * in a monolithic server.
diff --git a/src/i830_exa.c b/src/i830_exa.c
index 5077540..5199cef 100644
--- a/src/i830_exa.c
+++ b/src/i830_exa.c
@@ -39,9 +39,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include <string.h>
 #include <sys/mman.h>
 
-#define ALWAYS_SYNC		0
-#define ALWAYS_FLUSH		0
-
 const int I830CopyROP[16] =
 {
    ROP_0,               /* GXclear */
@@ -289,16 +286,9 @@ i830_uxa_solid(PixmapPtr pPixmap, int x1, int y1, int x2, int y2)
 static void
 i830_uxa_done_solid(PixmapPtr pPixmap)
 {
-#if ALWAYS_SYNC || ALWAYS_FLUSH
     ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum];
 
-#if ALWAYS_FLUSH
-    intel_batch_flush(pScrn, FALSE);
-#endif
-#if ALWAYS_SYNC
-    I830Sync(pScrn);
-#endif
-#endif
+    i830_debug_sync(pScrn);
 }
 
 /**
@@ -401,16 +391,9 @@ i830_uxa_copy(PixmapPtr pDstPixmap, int src_x1, int src_y1, int dst_x1,
 static void
 i830_uxa_done_copy(PixmapPtr pDstPixmap)
 {
-#if ALWAYS_SYNC || ALWAYS_FLUSH
     ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum];
 
-#if ALWAYS_FLUSH
-    intel_batch_flush(pScrn, FALSE);
-#endif
-#if ALWAYS_SYNC
-    I830Sync(pScrn);
-#endif
-#endif
+    i830_debug_sync(pScrn);
 }
 
 
@@ -422,16 +405,9 @@ i830_uxa_done_copy(PixmapPtr pDstPixmap)
 void
 i830_done_composite(PixmapPtr pDst)
 {
-#if ALWAYS_SYNC || ALWAYS_FLUSH
     ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum];
 
-#if ALWAYS_FLUSH
-    intel_batch_flush(pScrn, FALSE);
-#endif
-#if ALWAYS_SYNC
-    I830Sync(pScrn);
-#endif
-#endif
+    i830_debug_sync(pScrn);
 }
 
 #define xFixedToFloat(val) \
diff --git a/src/i830_render.c b/src/i830_render.c
index 5696fa3..4ca4e33 100644
--- a/src/i830_render.c
+++ b/src/i830_render.c
@@ -345,10 +345,7 @@ i830_texture_setup(PicturePtr pPict, PixmapPtr pPix, int unit)
 	ADVANCE_BATCH();
      }
 
-#ifdef I830DEBUG
-    ErrorF("try to sync to show any errors...");
-    I830Sync(pScrn);
-#endif
+    i830_debug_sync(pScrn);
 
     return TRUE;
 }
@@ -569,10 +566,7 @@ i830_prepare_composite(int op, PicturePtr pSrcPicture,
 	ADVANCE_BATCH();
     }
 
-#ifdef I830DEBUG
-    Error("try to sync to show any errors...");
-    I830Sync(pScrn);
-#endif
+    i830_debug_sync(pScrn);
 
     return TRUE;
 }
diff --git a/src/i965_render.c b/src/i965_render.c
index 5160d95..c3df9d2 100644
--- a/src/i965_render.c
+++ b/src/i965_render.c
@@ -1216,11 +1216,6 @@ i965_emit_composite_state(ScrnInfoPtr pScrn)
 
 	ADVANCE_BATCH();
     }
-
-#ifdef I830DEBUG
-    ErrorF("try to sync to show any errors...\n");
-    I830Sync(pScrn);
-#endif
 }
 
 /**
@@ -1605,10 +1600,7 @@ i965_composite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY,
 
     intel_batch_end_atomic(pScrn);
 
-#ifdef I830DEBUG
-    ErrorF("sync after 3dprimitive\n");
-    I830Sync(pScrn);
-#endif
+    i830_debug_sync(pScrn);
 }
 
 void
commit 1fc93ee184ceefaea9528bb46ae82884c44d9b36
Author: Eric Anholt <eric at anholt.net>
Date:   Mon Apr 20 14:42:31 2009 -0700

    Staticize a bunch of functions and variables in the driver.
    
    This cleans up findstatic.pl output for the i830+ code, which resulted in
    removing some code.  The only odd part of this commit is the
    if (0) i830_sdvo_dump() in i830_sdvo.c -- it tells the compiler that the code
    is used, without using it since we want the code around while debugging.
    It's also in a likely place to ask for the dump, so I think it's OK.

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 7b97a64..b081a7b 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -738,19 +738,19 @@ static int subpixel_conv_table[7] = { 0, SubPixelUnknown,
 				      SubPixelVerticalBGR,
 				      SubPixelNone };
 
-const char *output_names[] = { "None",
-			       "VGA",
-			       "DVI",
-			       "DVI",
-			       "DVI",
-			       "Composite",
-			       "TV",
-			       "LVDS",
-			       "CTV",
-			       "DIN",
-			       "DP",
-			       "HDMI",
-			       "HDMI",
+static const char *output_names[] = { "None",
+				      "VGA",
+				      "DVI",
+				      "DVI",
+				      "DVI",
+				      "Composite",
+				      "TV",
+				      "LVDS",
+				      "CTV",
+				      "DIN",
+				      "DP",
+				      "HDMI",
+				      "HDMI",
 };
 
 
diff --git a/src/i2c_vid.h b/src/i2c_vid.h
index 6c4e95d..e5d5ec1 100644
--- a/src/i2c_vid.h
+++ b/src/i2c_vid.h
@@ -129,8 +129,4 @@ typedef struct _I830I2CVidOutputRec {
     void (*dump_regs)(I2CDevPtr d);
 } I830I2CVidOutputRec, *I830I2CVidOutputPtr;
 
-/* XXX change this name to avoid driver-specific prefix */
-DisplayModePtr
-i830_dvo_get_current_mode (xf86OutputPtr output);
-
 #endif
diff --git a/src/i830.h b/src/i830.h
index e5c0ead..f3bf250 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -783,7 +783,6 @@ i830_pipe_a_require_deactivate (ScrnInfoPtr scrn);
 extern Bool I830Allocate3DMemory(ScrnInfoPtr pScrn, const int flags);
 extern void I830SetupMemoryTiling(ScrnInfoPtr pScrn);
 extern Bool I830DRIScreenInit(ScreenPtr pScreen);
-extern Bool I830CheckDRIAvailable(ScrnInfoPtr pScrn);
 extern Bool I830DRIDoMappings(ScreenPtr pScreen);
 extern Bool I830DRIResume(ScreenPtr pScreen);
 extern void I830DRICloseScreen(ScreenPtr pScreen);
@@ -834,7 +833,6 @@ void i830_free_3d_memory(ScrnInfoPtr pScrn);
 void i830_free_memory(ScrnInfoPtr pScrn, i830_memory *mem);
 extern long I830CheckAvailableMemory(ScrnInfoPtr pScrn);
 Bool i830_allocate_2d_memory(ScrnInfoPtr pScrn);
-Bool i830_allocate_texture_memory(ScrnInfoPtr pScrn);
 Bool i830_allocate_pwrctx(ScrnInfoPtr pScrn);
 Bool i830_allocate_3d_memory(ScrnInfoPtr pScrn);
 void i830_init_bufmgr(ScrnInfoPtr pScrn);
@@ -842,7 +840,6 @@ void i830_init_bufmgr(ScrnInfoPtr pScrn);
 Bool i830_allocate_xvmc_buffer(ScrnInfoPtr pScrn, const char *name,
                                i830_memory **buffer, unsigned long size, int flags);
 #endif
-extern void i830_update_front_offset(ScrnInfoPtr pScrn);
 extern uint32_t i830_create_new_fb(ScrnInfoPtr pScrn, int width, int height,
 				   int *pitch);
 
@@ -856,9 +853,6 @@ i830_pad_drawable_width(int width, int cpp);
 extern Bool I830I2CInit(ScrnInfoPtr pScrn, I2CBusPtr *bus_ptr, int i2c_reg,
 			char *name);
 
-/* return a mask of output indices matching outputs against type_mask */
-int i830_output_clones (ScrnInfoPtr pScrn, int type_mask);
-
 /* i830_display.c */
 Bool
 i830PipeHasType (xf86CrtcPtr crtc, int type);
@@ -883,7 +877,6 @@ Bool i830_bind_all_memory(ScrnInfoPtr pScrn);
 Bool i830_unbind_all_memory(ScrnInfoPtr pScrn);
 unsigned long i830_get_fence_size(I830Ptr pI830, unsigned long size);
 unsigned long i830_get_fence_pitch(I830Ptr pI830, unsigned long pitch, int format);
-unsigned long i830_get_fence_alignment(I830Ptr pI830, unsigned long size);
 
 Bool I830BindAGPMemory(ScrnInfoPtr pScrn);
 Bool I830UnbindAGPMemory(ScrnInfoPtr pScrn);
diff --git a/src/i830_display.c b/src/i830_display.c
index 2a16cc3..847dc22 100644
--- a/src/i830_display.c
+++ b/src/i830_display.c
@@ -245,6 +245,8 @@ intel_find_pll_i8xx_and_i9xx(const intel_limit_t *, xf86CrtcPtr,
 static Bool
 intel_find_pll_g4x(const intel_limit_t *, xf86CrtcPtr,
                    int, int, intel_clock_t *);
+static void
+i830_crtc_load_lut(xf86CrtcPtr crtc);
 
 static const intel_limit_t intel_limits[] = {
     { /* INTEL_LIMIT_I8XX_DVO_DAC */
@@ -1124,7 +1126,7 @@ i830_disable_vga_plane (xf86CrtcPtr crtc)
 
 }
 
-void
+static void
 i830_crtc_enable(xf86CrtcPtr crtc)
 {
     ScrnInfoPtr pScrn = crtc->scrn;
@@ -1926,7 +1928,7 @@ i830_crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode,
 
 
 /** Loads the palette/gamma unit for the CRTC with the prepared values */
-void
+static void
 i830_crtc_load_lut(xf86CrtcPtr crtc)
 {
     ScrnInfoPtr pScrn = crtc->scrn;
diff --git a/src/i830_display.h b/src/i830_display.h
index 0ba196d..24a2717 100644
--- a/src/i830_display.h
+++ b/src/i830_display.h
@@ -33,12 +33,10 @@ void i830WaitForVblank(ScrnInfoPtr pScrn);
 void i830DescribeOutputConfiguration(ScrnInfoPtr pScrn);
 void i830_set_new_crtc_bo(ScrnInfoPtr pScrn);
 void i830_crtc_disable(xf86CrtcPtr crtc, Bool disable_pipe);
-void i830_crtc_enable(xf86CrtcPtr crtc);
 
 xf86CrtcPtr i830GetLoadDetectPipe(xf86OutputPtr output, DisplayModePtr mode, int *dpms_mode);
 void i830ReleaseLoadDetectPipe(xf86OutputPtr output, int dpms_mode);
 void i830_crtc_init(ScrnInfoPtr pScrn, int pipe);
-void i830_crtc_load_lut(xf86CrtcPtr crtc);
 DisplayModePtr i830_crtc_mode_get(ScrnInfoPtr pScrn, xf86CrtcPtr crtc);
 void i830_output_prepare (xf86OutputPtr output);
 void i830_output_commit (xf86OutputPtr output);
diff --git a/src/i830_dri.c b/src/i830_dri.c
index e60af09..cbb0db8 100644
--- a/src/i830_dri.c
+++ b/src/i830_dri.c
@@ -446,7 +446,7 @@ I830InitVisualConfigs(ScreenPtr pScreen)
    return TRUE;
 }
 
-Bool
+static Bool
 I830CheckDRIAvailable(ScrnInfoPtr pScrn)
 {
    /* Hardware 3D rendering only implemented for 16bpp and 32 bpp */
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 905fbea..16a8a57 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -217,7 +217,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #endif
 
 #ifdef I830_USE_EXA
-const char *I830exaSymbols[] = {
+static const char *I830exaSymbols[] = {
     "exaGetVersion",
     "exaDriverInit",
     "exaDriverFini",
@@ -801,7 +801,7 @@ I830LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
    }
 }
 
-void
+static void
 i830_update_front_offset(ScrnInfoPtr pScrn)
 {
    ScreenPtr pScreen = pScrn->pScreen;
@@ -869,7 +869,7 @@ i830CreateScreenResources(ScreenPtr pScreen)
    return TRUE;
 }
 
-int
+static int
 i830_output_clones (ScrnInfoPtr pScrn, int type_mask)
 {
     xf86CrtcConfigPtr	config = XF86_CRTC_CONFIG_PTR (pScrn);
diff --git a/src/i830_dvo.c b/src/i830_dvo.c
index 832c762..a0e8074 100644
--- a/src/i830_dvo.c
+++ b/src/i830_dvo.c
@@ -61,7 +61,7 @@ static const char *ch7017_symbols[] = {
 };
 
 /* driver list */
-struct _I830DVODriver i830_dvo_drivers[] =
+static struct _I830DVODriver i830_dvo_drivers[] =
 {
     {
 	.type = I830_OUTPUT_DVO_TMDS,
@@ -370,7 +370,7 @@ static const xf86OutputFuncsRec i830_dvo_output_funcs = {
  * Other chips with DVO LVDS will need to extend this to deal with the LVDS
  * chip being on DVOB/C and having multiple pipes.
  */
-DisplayModePtr
+static DisplayModePtr
 i830_dvo_get_current_mode (xf86OutputPtr output)
 {
     ScrnInfoPtr		    pScrn = output->scrn;
diff --git a/src/i830_hwmc.c b/src/i830_hwmc.c
index e33a15d..ecefb5b 100644
--- a/src/i830_hwmc.c
+++ b/src/i830_hwmc.c
@@ -35,7 +35,7 @@
 struct intel_xvmc_driver *xvmc_driver;
 
 /* set global current driver for xvmc */
-Bool intel_xvmc_set_driver(struct intel_xvmc_driver *d)
+static Bool intel_xvmc_set_driver(struct intel_xvmc_driver *d)
 {
     if (xvmc_driver) {
 	ErrorF("XvMC driver already set!\n");
diff --git a/src/i830_hwmc.h b/src/i830_hwmc.h
index 72208d5..41f6441 100644
--- a/src/i830_hwmc.h
+++ b/src/i830_hwmc.h
@@ -101,7 +101,6 @@ extern struct intel_xvmc_driver *xvmc_driver;
 extern struct intel_xvmc_driver i915_xvmc_driver;
 extern struct intel_xvmc_driver i965_xvmc_driver;
 
-extern Bool intel_xvmc_set_driver(struct intel_xvmc_driver *);
 extern Bool intel_xvmc_probe(ScrnInfoPtr);
 extern Bool intel_xvmc_driver_init(ScreenPtr, XF86VideoAdaptorPtr);
 extern Bool intel_xvmc_screen_init(ScreenPtr);
diff --git a/src/i830_memory.c b/src/i830_memory.c
index d3138d9..470734e 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -185,7 +185,7 @@ i830_get_fence_pitch(I830Ptr pI830, unsigned long pitch, int format)
  * On some chips, pitch width has to be a power of two tile width, so
  * calculate that here.
  */
-unsigned long
+static unsigned long
 i830_get_fence_alignment(I830Ptr pI830, unsigned long size)
 {
     if (IS_I965G(pI830))
@@ -1608,7 +1608,7 @@ i830_allocate_depthbuffer(ScrnInfoPtr pScrn)
     return TRUE;
 }
 
-Bool
+static Bool
 i830_allocate_texture_memory(ScrnInfoPtr pScrn)
 {
     I830Ptr pI830 = I830PTR(pScrn);
diff --git a/src/i830_sdvo.c b/src/i830_sdvo.c
index 29ccd4e..41e8e59 100644
--- a/src/i830_sdvo.c
+++ b/src/i830_sdvo.c
@@ -126,6 +126,9 @@ struct i830_sdvo_priv {
 
 static Atom broadcast_atom;
 
+static void
+i830_sdvo_dump(ScrnInfoPtr pScrn);
+
 /**
  * Writes the SDVOB or SDVOC with the given value, but always writes both
  * SDVOB and SDVOC to work around apparent hardware issues (according to
@@ -380,7 +383,7 @@ i830_sdvo_read_response(xf86OutputPtr output, void *response, int response_len)
     return status;
 }
 
-int
+static int
 i830_sdvo_get_pixel_multiplier(DisplayModePtr pMode)
 {
     if (pMode->Clock >= 100000)
@@ -1178,6 +1181,9 @@ i830_sdvo_mode_set(xf86OutputPtr output, DisplayModePtr mode,
     }
 
     i830_sdvo_write_sdvox(output, sdvox);
+
+    if (0)
+	i830_sdvo_dump(pScrn);
 }
 
 static void
@@ -1492,7 +1498,7 @@ i830_sdvo_dump_device(xf86OutputPtr output)
     i830_sdvo_dump_hdmi_buf(output);
 }
 
-void
+static void
 i830_sdvo_dump(ScrnInfoPtr pScrn)
 {
     xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
diff --git a/src/i830_sdvo.h b/src/i830_sdvo.h
index 798a88d..607dc5c 100644
--- a/src/i830_sdvo.h
+++ b/src/i830_sdvo.h
@@ -27,9 +27,3 @@
 
 Bool
 i830_sdvo_init(ScrnInfoPtr pScrn, int output_device);
-
-int
-i830_sdvo_get_pixel_multiplier(DisplayModePtr pMode);
-
-void
-i830_sdvo_dump(ScrnInfoPtr pScrn);
diff --git a/src/i830_xaa.c b/src/i830_xaa.c
index 1f82840..ede7cc2 100644
--- a/src/i830_xaa.c
+++ b/src/i830_xaa.c
@@ -92,7 +92,7 @@ static void I830SubsequentScanlineImageWriteRect(ScrnInfoPtr pScrn,
 static void I830SubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno);
 #endif
 
-void
+static void
 i830_xaa_composite(CARD8	op,
 		   PicturePtr	pSrc,
 		   PicturePtr	pMask,
@@ -712,7 +712,7 @@ I830SubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno)
  * Special case acceleration for Render acceleration of rotation operations
  * by xf86Rotate.c
  */
-void
+static void
 i830_xaa_composite(CARD8	op,
 		   PicturePtr	pSrc,
 		   PicturePtr	pMask,
diff --git a/src/i965_render.c b/src/i965_render.c
index c123a36..5160d95 100644
--- a/src/i965_render.c
+++ b/src/i965_render.c
@@ -431,7 +431,7 @@ typedef enum {
 
 #define KERNEL(kernel_enum, kernel, masked) \
     [kernel_enum] = {&kernel, sizeof(kernel), masked}
-struct wm_kernel_info {
+static struct wm_kernel_info {
     void *data;
     unsigned int size;
     Bool has_mask;
commit b2d7928f195f6439ecd140e6280b958b8a1f534b
Author: Eric Anholt <eric at anholt.net>
Date:   Mon Apr 20 14:48:59 2009 -0700

    Use a static inline to replace if (0) to an unused stub function.

diff --git a/src/common.h b/src/common.h
index 8b32a66..d27d484 100644
--- a/src/common.h
+++ b/src/common.h
@@ -55,11 +55,15 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #ifdef I830DEBUG
 #define MARKER() ErrorF("\n### %s:%d: >>> %s <<< ###\n\n", \
 			 __FILE__, __LINE__,__FUNCTION__)
-#define DPRINTF I830DPRINTF_stub
+#define DPRINTF I830DPRINTF
 #else /* #ifdef I830DEBUG */
 #define MARKER()
-/* this is a real ugly hack to get the compiler to optimize the debugging statements into oblivion */
-#define DPRINTF if(0) I830DPRINTF_stub
+#define DPRINTF I830DPRINTF_stub
+static inline void
+I830DPRINTF_stub(const char *filename, int line, const char *function,
+		 const char *fmt, ...)
+{
+}
 #endif /* #ifdef I830DEBUG */
 
 #define KB(x) ((x) * 1024)
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 26afca5..905fbea 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -352,8 +352,8 @@ extern void xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y);
 
 #ifdef I830DEBUG
 void
-I830DPRINTF_stub(const char *filename, int line, const char *function,
-		 const char *fmt, ...)
+I830DPRINTF(const char *filename, int line, const char *function,
+	    const char *fmt, ...)
 {
    va_list ap;
 
@@ -365,13 +365,6 @@ I830DPRINTF_stub(const char *filename, int line, const char *function,
    va_end(ap);
    ErrorF("##############################################\n\n");
 }
-#else /* #ifdef I830DEBUG */
-void
-I830DPRINTF_stub(const char *filename, int line, const char *function,
-		 const char *fmt, ...)
-{
-   /* do nothing */
-}
 #endif /* #ifdef I830DEBUG */
 
 /* Export I830 options to i830 driver where necessary */
commit 093f51646b2f2301c907e14d0ad4b1f80ff60a16
Author: Eric Anholt <eric at anholt.net>
Date:   Mon Apr 20 14:36:52 2009 -0700

    Remove unused i830_output_type_names

diff --git a/src/i830.h b/src/i830.h
index ae7acfe..e5c0ead 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -245,8 +245,6 @@ struct _I830DVODriver {
    pointer modhandle;
 };
 
-extern const char *i830_output_type_names[];
-
 typedef struct _I830CrtcPrivateRec {
     int			    pipe;
     int			    plane;
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 6ec2cdd..26afca5 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -341,15 +341,6 @@ static OptionInfoRec I830Options[] = {
 };
 /* *INDENT-ON* */
 
-const char *i830_output_type_names[] = {
-   "Unused",
-   "Analog",
-   "DVO",
-   "SDVO",
-   "LVDS",
-   "TVOUT",
-};
-
 static void i830AdjustFrame(int scrnIndex, int x, int y, int flags);
 static Bool I830CloseScreen(int scrnIndex, ScreenPtr pScreen);
 static Bool I830EnterVT(int scrnIndex, int flags);
commit c774ef282bfb0c594479bbab3527fe5fda2a8559
Author: Eric Anholt <eric at anholt.net>
Date:   Mon Apr 20 14:29:17 2009 -0700

    Remove dead mono cursor load code.

diff --git a/src/i830_cursor.c b/src/i830_cursor.c
index 43a65cb..e1cf0bf 100644
--- a/src/i830_cursor.c
+++ b/src/i830_cursor.c
@@ -136,19 +136,6 @@ I830CursorInit(ScreenPtr pScreen)
 			       HARDWARE_CURSOR_ARGB));
 }
 
-void
-i830_crtc_load_cursor_image (xf86CrtcPtr crtc, unsigned char *src)
-{
-    I830Ptr		pI830 = I830PTR(crtc->scrn);
-    I830CrtcPrivatePtr	intel_crtc = crtc->driver_private;
-    uint8_t		*pcurs;
-
-    pcurs = pI830->FbBase + intel_crtc->cursor_offset;
-
-    intel_crtc->cursor_is_argb = FALSE;
-    memcpy (pcurs, src, I810_CURSOR_X * I810_CURSOR_Y / 4);
-}
-
 #ifdef ARGB_CURSOR
 void
 i830_crtc_load_cursor_argb (xf86CrtcPtr crtc, CARD32 *image)
diff --git a/src/i830_display.c b/src/i830_display.c
index dd1310f..2a16cc3 100644
--- a/src/i830_display.c
+++ b/src/i830_display.c
@@ -2400,7 +2400,6 @@ static const xf86CrtcFuncsRec i830_crtc_funcs = {
     .set_cursor_position = i830_crtc_set_cursor_position,
     .show_cursor = i830_crtc_show_cursor,
     .hide_cursor = i830_crtc_hide_cursor,
-/*    .load_cursor_image = i830_crtc_load_cursor_image, */
     .load_cursor_argb = i830_crtc_load_cursor_argb,
     .destroy = NULL, /* XXX */
 #if RANDR_13_INTERFACE
commit 75c531b9652b3919ddbf51f8eec804e6bdbb2331
Author: Eric Anholt <eric at anholt.net>
Date:   Fri Apr 17 14:03:39 2009 -0700

    Rename EXA rendering functions to UXA, since we're keeping them post-EXA.

diff --git a/src/i830_exa.c b/src/i830_exa.c
index 39011bc..5077540 100644
--- a/src/i830_exa.c
+++ b/src/i830_exa.c
@@ -202,10 +202,10 @@ I830EXASync(ScreenPtr pScreen, int marker)
 }
 
 /**
- * I830EXAPrepareSolid - prepare for a Solid operation, if possible
+ * Sets up hardware state for a series of solid fills.
  */
 static Bool
-I830EXAPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg)
+i830_uxa_prepare_solid(PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg)
 {
     ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum];
     I830Ptr pI830 = I830PTR(pScrn);
@@ -252,7 +252,7 @@ I830EXAPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg)
 }
 
 static void
-I830EXASolid(PixmapPtr pPixmap, int x1, int y1, int x2, int y2)
+i830_uxa_solid(PixmapPtr pPixmap, int x1, int y1, int x2, int y2)
 {
     ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum];
     I830Ptr pI830 = I830PTR(pScrn);
@@ -287,7 +287,7 @@ I830EXASolid(PixmapPtr pPixmap, int x1, int y1, int x2, int y2)
 }
 
 static void
-I830EXADoneSolid(PixmapPtr pPixmap)
+i830_uxa_done_solid(PixmapPtr pPixmap)
 {
 #if ALWAYS_SYNC || ALWAYS_FLUSH
     ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum];
@@ -306,8 +306,8 @@ I830EXADoneSolid(PixmapPtr pPixmap)
  *   - support planemask using FULL_BLT_CMD?
  */
 static Bool
-I830EXAPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir,
-		   int ydir, int alu, Pixel planemask)
+i830_uxa_prepare_copy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir,
+		      int ydir, int alu, Pixel planemask)
 {
     ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum];
     I830Ptr pI830 = I830PTR(pScrn);
@@ -347,8 +347,8 @@ I830EXAPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir,
 }
 
 static void
-I830EXACopy(PixmapPtr pDstPixmap, int src_x1, int src_y1, int dst_x1,
-	    int dst_y1, int w, int h)
+i830_uxa_copy(PixmapPtr pDstPixmap, int src_x1, int src_y1, int dst_x1,
+	      int dst_y1, int w, int h)
 {
     ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum];
     I830Ptr pI830 = I830PTR(pScrn);
@@ -399,7 +399,7 @@ I830EXACopy(PixmapPtr pDstPixmap, int src_x1, int src_y1, int dst_x1,
 }
 
 static void
-I830EXADoneCopy(PixmapPtr pDstPixmap)
+i830_uxa_done_copy(PixmapPtr pDstPixmap)
 {
 #if ALWAYS_SYNC || ALWAYS_FLUSH
     ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum];
@@ -729,14 +729,14 @@ I830EXAInit(ScreenPtr pScreen)
     pI830->EXADriverPtr->WaitMarker = I830EXASync;
 
     /* Solid fill */
-    pI830->EXADriverPtr->PrepareSolid = I830EXAPrepareSolid;
-    pI830->EXADriverPtr->Solid = I830EXASolid;
-    pI830->EXADriverPtr->DoneSolid = I830EXADoneSolid;
+    pI830->EXADriverPtr->PrepareSolid = i830_uxa_prepare_solid;
+    pI830->EXADriverPtr->Solid = i830_uxa_solid;
+    pI830->EXADriverPtr->DoneSolid = i830_uxa_done_solid;
 
     /* Copy */
-    pI830->EXADriverPtr->PrepareCopy = I830EXAPrepareCopy;
-    pI830->EXADriverPtr->Copy = I830EXACopy;
-    pI830->EXADriverPtr->DoneCopy = I830EXADoneCopy;
+    pI830->EXADriverPtr->PrepareCopy = i830_uxa_prepare_copy;
+    pI830->EXADriverPtr->Copy = i830_uxa_copy;
+    pI830->EXADriverPtr->DoneCopy = i830_uxa_done_copy;
 
     /* Composite */
     if (!IS_I9XX(pI830)) {
@@ -1054,14 +1054,14 @@ i830_uxa_init (ScreenPtr pScreen)
     i830->uxa_driver->uxa_minor = 0;
 
     /* Solid fill */
-    i830->uxa_driver->prepare_solid = I830EXAPrepareSolid;
-    i830->uxa_driver->solid = I830EXASolid;
-    i830->uxa_driver->done_solid = I830EXADoneSolid;
+    i830->uxa_driver->prepare_solid = i830_uxa_prepare_solid;
+    i830->uxa_driver->solid = i830_uxa_solid;
+    i830->uxa_driver->done_solid = i830_uxa_done_solid;
 
     /* Copy */
-    i830->uxa_driver->prepare_copy = I830EXAPrepareCopy;
-    i830->uxa_driver->copy = I830EXACopy;
-    i830->uxa_driver->done_copy = I830EXADoneCopy;
+    i830->uxa_driver->prepare_copy = i830_uxa_prepare_copy;
+    i830->uxa_driver->copy = i830_uxa_copy;
+    i830->uxa_driver->done_copy = i830_uxa_done_copy;
 
     /* Composite */
     if (!IS_I9XX(i830)) {
commit 40dbba5cf710a6e392afca73965aa48fa3953d1f
Author: Eric Anholt <eric at anholt.net>
Date:   Fri Apr 17 15:15:27 2009 -0700

    Remove some dead i830.h struct members.

diff --git a/src/i830.h b/src/i830.h
index f933917..ae7acfe 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -461,18 +461,10 @@ typedef struct _I830Rec {
 
    Bool need_mi_flush;
 
-   Bool NeedRingBufferLow;
    Bool tiling;
    Bool fb_compression;
 
-   int backPitch;
-
    Bool CursorNeedsPhysical;
- 
-   DGAModePtr DGAModes;
-   int numDGAModes;
-   Bool DGAactive;
-   int DGAViewportStatus;
 
    int Chipset;
    unsigned long LinearAddr;
commit 84f69081abaeef8b05cafb64d3102eb2abdf9a8e
Author: Julien Cristau <jcristau at debian.org>
Date:   Thu Apr 16 14:27:15 2009 +0200

    Require xserver 1.3
    
    I don't think anyone tests this against an old server anymore.
    
    Signed-off-by: Eric Anholt <eric at anholt.net>

diff --git a/RELEASING b/RELEASING
index ec67224..9376110 100644
--- a/RELEASING
+++ b/RELEASING
@@ -25,10 +25,6 @@ The process for releasing a new tarball is as follows:
 
 	$ make distcheck
 
-	Note that unlike a regular "make", this will not work unless
-	you pass a valid --with-xserver-source=/path/to/xserver option
-	to configure.
-
 5. Tag the release
 
 	$ git tag -m "Intel <ver> release" <ver>
diff --git a/configure.ac b/configure.ac
index ad1cfcf..ae5278c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -70,11 +70,6 @@ AC_ARG_ENABLE(video-debug, AC_HELP_STRING([--enable-video-debug],
               [VIDEO_DEBUG="$enableval"],
               [VIDEO_DEBUG=no])
 
-AC_ARG_WITH(xserver-source,AC_HELP_STRING([--with-xserver-source=XSERVER_SOURCE],
-					  [Path to X server source tree]),
-			   [ XSERVER_SOURCE="$withval" ],
-			   [ XSERVER_SOURCE="" ])
-
 AC_ARG_ENABLE(xvmc, AC_HELP_STRING([--disable-xvmc],
                                   [Disable XvMC support [[default=auto]]]),
               [XVMC="$enableval"],
@@ -88,7 +83,7 @@ XORG_DRIVER_CHECK_EXT(XF86DRI, xextproto x11)
 XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto)
 
 # Checks for pkg-config packages
-PKG_CHECK_MODULES(XORG, [xorg-server xproto fontsproto $REQUIRED_MODULES])
+PKG_CHECK_MODULES(XORG, [xorg-server >= 1.3 xproto fontsproto $REQUIRED_MODULES])
 
 PKG_CHECK_MODULES(SERVER_1_5, [xorg-server >= 1.5],
 			      [SERVER_1_5=yes], [SERVER_1_5=no])
@@ -129,7 +124,6 @@ if test x$DRI = xauto; then
 fi
 AC_MSG_RESULT([$DRI])
 
-AC_CHECK_HEADER(xf86Modes.h,[XMODES=yes],[XMODES=no],[#include "xorg-server.h"])
 AC_CHECK_DECL(XSERVER_LIBPCIACCESS,
 	      [XSERVER_LIBPCIACCESS=yes],[XSERVER_LIBPCIACCESS=no],
 	      [#include "xorg-server.h"])
@@ -145,49 +139,6 @@ fi
 AM_CONDITIONAL(XSERVER_LIBPCIACCESS, test "x$XSERVER_LIBPCIACCESS" = xyes)
 AM_CONDITIONAL(LIBPCIACCESS,
 	test "x$XSERVER_LIBPCIACCESS" = xyes -o "x$have_libpciaccess" = xyes)
-AM_CONDITIONAL(XMODES, test "x$XMODES" = xno)
-
-if test "x$XSERVER_SOURCE" = x; then
-	if test -d ../../xserver; then
-		XSERVER_SOURCE="`cd ../../xserver && pwd`"
-	fi
-fi
-	
-if test -d "$XSERVER_SOURCE"; then
-	case "$XSERVER_SOURCE" in
-	/*)
-		;;
-	*)
-		XSERVER_SOURCE="`cd $XSERVER_SOURCE && pwd`"
-		;;
-	esac
-	if test -f $srcdir/src/modes/xf86Modes.h; then
-		:
-	else
-		ln -sf $XSERVER_SOURCE/hw/xfree86/modes $srcdir/src/modes
-	fi
-	
-	if test -f $srcdir/src/parser/xf86Parser.h; then
-		:
-	else
-		ln -sf $XSERVER_SOURCE/hw/xfree86/parser $srcdir/src/parser
-	fi
-fi
-
-if test "x$XMODES" = xyes; then
-	AC_MSG_NOTICE([X server has new mode code])
-	AC_DEFINE(XMODES, 1,[X server has built-in mode code])
-	XMODES_CFLAGS=
-else
-	if test -f $srcdir/src/modes/xf86Modes.h -a -f $srcdir/src/parser/xf86Parser.h; then
-		AC_MSG_NOTICE([X server is missing new mode code, using local copy])
-	else
-		AC_MSG_ERROR([Must have X server >= 1.3 source tree for mode setting code. Please specify --with-xserver-source])
-	fi
-	XMODES_CFLAGS='-DXF86_MODES_RENAME -I$(top_srcdir)/src -I$(top_srcdir)/src/modes -I$(top_srcdir)/src/parser'
-fi
-
-AC_SUBST([XMODES_CFLAGS])
 
 SAVE_CPPFLAGS="$CPPFLAGS"
 CPPFLAGS="$CPPFLAGS $XORG_CFLAGS"
diff --git a/src/Makefile.am b/src/Makefile.am
index ad87afc..6ab43fc 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -32,7 +32,7 @@ SUBDIRS = xvmc bios_reader ch7017 ch7xxx ivch sil164 tfp410 $(REGDUMPER)
 
 AM_CFLAGS = @WARN_CFLAGS@ @XORG_CFLAGS@ @DRM_CFLAGS@ @DRI_CFLAGS@ \
 	@PCIACCESS_CFLAGS@ -I$(top_srcdir)/uxa \
-	@XMODES_CFLAGS@ -DI830_XV -DI830_USE_XAA -DI830_USE_EXA -DI830_USE_UXA
+	-DI830_XV -DI830_USE_XAA -DI830_USE_EXA -DI830_USE_UXA
 
 intel_drv_la_LTLIBRARIES = intel_drv.la
 intel_drv_la_LDFLAGS = -module -avoid-version
@@ -42,23 +42,6 @@ if XSERVER_LIBPCIACCESS
 intel_drv_la_LIBADD += @PCIACCESS_LIBS@
 endif
 
-XMODE_SRCS=\
-	 local_xf86Rename.h \
-	 parser/xf86Parser.h \
-	 parser/xf86Optrec.h \
-	 modes/xf86Modes.h \
-	 modes/xf86Modes.c \
-	 modes/xf86cvt.c \
-	 modes/xf86Crtc.h \
-	 modes/xf86Crtc.c \
-	 modes/xf86Cursors.c \
-	 modes/xf86EdidModes.c \
-	 modes/xf86RandR12.c \
-	 modes/xf86RandR12.h \
-	 modes/xf86Rename.h \
-	 modes/xf86Rotate.c \
-	 modes/xf86DiDGA.c
-
 INTEL_DRI_SRCS = \
          i810_dri.c \
          i810_dri.h \
@@ -204,11 +187,6 @@ clean-local:
 	-rm -f $(INTEL_G4B)
 endif
 
-if XMODES
-intel_drv_la_SOURCES += \
-	$(XMODE_SRCS)
-endif
-
 if DRI
 intel_drv_la_SOURCES += \
 	$(INTEL_DRI_SRCS)
diff --git a/src/bios_reader/Makefile.am b/src/bios_reader/Makefile.am
index 9f1c45a..e060633 100644
--- a/src/bios_reader/Makefile.am
+++ b/src/bios_reader/Makefile.am
@@ -1,4 +1,4 @@
-AM_CFLAGS = @WARN_CFLAGS@ @XORG_CFLAGS@ @XMODES_CFLAGS@ @PCIACCESS_CFLAGS@ \
+AM_CFLAGS = @WARN_CFLAGS@ @XORG_CFLAGS@ @PCIACCESS_CFLAGS@ \
 	-DREG_DUMPER
 
 noinst_PROGRAMS = bios_reader  $(BIOS_DUMPER) $(SWF_DUMPER)
diff --git a/src/ch7017/Makefile.am b/src/ch7017/Makefile.am
index fef4d37..48aef60 100644
--- a/src/ch7017/Makefile.am
+++ b/src/ch7017/Makefile.am
@@ -3,7 +3,7 @@
 # -avoid-version prevents gratuitous .0.0.0 version numbers on the end
 # _ladir passes a dummy rpath to libtool so the thing will actually link
 # TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc.
-AM_CFLAGS = @WARN_CFLAGS@ @XMODES_CFLAGS@ @XORG_CFLAGS@ @DRI_CFLAGS@ \
+AM_CFLAGS = @WARN_CFLAGS@ @XORG_CFLAGS@ @DRI_CFLAGS@ \
 	@PCIACCESS_CFLAGS@
 
 ch7017_la_LTLIBRARIES = ch7017.la
diff --git a/src/ch7xxx/Makefile.am b/src/ch7xxx/Makefile.am
index 9f93611..476f84b 100644
--- a/src/ch7xxx/Makefile.am
+++ b/src/ch7xxx/Makefile.am
@@ -3,7 +3,7 @@
 # -avoid-version prevents gratuitous .0.0.0 version numbers on the end
 # _ladir passes a dummy rpath to libtool so the thing will actually link
 # TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc.
-AM_CFLAGS = @WARN_CFLAGS@ @XMODES_CFLAGS@ @XORG_CFLAGS@ @DRI_CFLAGS@ \
+AM_CFLAGS = @WARN_CFLAGS@ @XORG_CFLAGS@ @DRI_CFLAGS@ \
 	@PCIACCESS_CFLAGS@
 
 ch7xxx_la_LTLIBRARIES = ch7xxx.la
diff --git a/src/ivch/Makefile.am b/src/ivch/Makefile.am
index 8b12b09..f9cc116 100644
--- a/src/ivch/Makefile.am
+++ b/src/ivch/Makefile.am
@@ -3,7 +3,7 @@
 # -avoid-version prevents gratuitous .0.0.0 version numbers on the end
 # _ladir passes a dummy rpath to libtool so the thing will actually link
 # TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc.
-AM_CFLAGS = @WARN_CFLAGS@ @XMODES_CFLAGS@ @XORG_CFLAGS@ @DRI_CFLAGS@ \
+AM_CFLAGS = @WARN_CFLAGS@ @XORG_CFLAGS@ @DRI_CFLAGS@ \
 	@PCIACCESS_CFLAGS@
 
 ivch_la_LTLIBRARIES = ivch.la
diff --git a/src/local_xf86Rename.h b/src/local_xf86Rename.h
deleted file mode 100644
index e1e788f..0000000
--- a/src/local_xf86Rename.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright © 2006 Keith Packard
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that copyright
- * notice and this permission notice appear in supporting documentation, and
- * that the name of the copyright holders not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission.  The copyright holders make no representations
- * about the suitability of this software for any purpose.  It is provided "as
- * is" without express or implied warranty.
- *
- * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
- * OF THIS SOFTWARE.
- */
-
-#define XF86NAME(x) intel_##x
diff --git a/src/sil164/Makefile.am b/src/sil164/Makefile.am
index 7b179ab..6d1cf37 100644
--- a/src/sil164/Makefile.am
+++ b/src/sil164/Makefile.am
@@ -3,7 +3,7 @@
 # -avoid-version prevents gratuitous .0.0.0 version numbers on the end
 # _ladir passes a dummy rpath to libtool so the thing will actually link
 # TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc.
-AM_CFLAGS = @WARN_CFLAGS@ @XMODES_CFLAGS@ @XORG_CFLAGS@ @DRI_CFLAGS@ \
+AM_CFLAGS = @WARN_CFLAGS@ @XORG_CFLAGS@ @DRI_CFLAGS@ \
 	@PCIACCESS_CFLAGS@
 
 sil164_la_LTLIBRARIES = sil164.la
diff --git a/src/tfp410/Makefile.am b/src/tfp410/Makefile.am
index 0dbc021..23d9c87 100644
--- a/src/tfp410/Makefile.am
+++ b/src/tfp410/Makefile.am
@@ -3,7 +3,7 @@
 # -avoid-version prevents gratuitous .0.0.0 version numbers on the end
 # _ladir passes a dummy rpath to libtool so the thing will actually link
 # TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc.
-AM_CFLAGS = @WARN_CFLAGS@ @XMODES_CFLAGS@ @XORG_CFLAGS@ @DRI_CFLAGS@ \
+AM_CFLAGS = @WARN_CFLAGS@ @XORG_CFLAGS@ @DRI_CFLAGS@ \
 	@PCIACCESS_CFLAGS@
 
 tfp410_la_LTLIBRARIES = tfp410.la
commit 08ebde4715b87867184d42b60762cd774e151f5c
Author: Zhenyu Wang <zhenyu.z.wang at intel.com>
Date:   Mon Apr 20 09:43:09 2009 +0800

    fix overflow warning on videoRam
    
    Note that pScrn->videoRam is an 'int'.
    
    i830_driver.c: In function ‘I830ScreenInit’:
    i830_driver.c:3019: warning: overflow in implicit constant conversion
    
    Signed-off-by: Wu Fengguang <fengguang.wu at intel.com>

diff --git a/src/i830_driver.c b/src/i830_driver.c
index 6ff5a1d..6ec2cdd 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -3016,7 +3016,7 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
    if (pI830->use_drm_mode) {
 #ifdef XF86DRM_MODE
        pI830->stolen_size = 0;
-       pScrn->videoRam = ~0UL / KB(1);
+       pScrn->videoRam = INT_MAX / KB(1);
 #endif
    } else {
        I830AdjustMemory(pScreen);
commit 5a07ab502fe1e58e7e37fe554fb42d8d2c8c53ec
Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Fri Apr 17 20:59:04 2009 -0700

    DRI2: Respect the src and dst parameters of CopyRegion.
    
    Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>

diff --git a/src/i830_dri.c b/src/i830_dri.c
index 6a32492..e60af09 100644
--- a/src/i830_dri.c
+++ b/src/i830_dri.c
@@ -1529,6 +1529,7 @@ I830DRIUnlock(ScrnInfoPtr pScrn)
 
 typedef struct {
     PixmapPtr pPixmap;
+    unsigned int attachment;
 } I830DRI2BufferPrivateRec, *I830DRI2BufferPrivatePtr;
 
 static DRI2BufferPtr
@@ -1602,6 +1603,7 @@ I830DRI2CreateBuffers(DrawablePtr pDraw, unsigned int *attachments, int count)
 	buffers[i].driverPrivate = &privates[i];
 	buffers[i].flags = 0; /* not tiled */
 	privates[i].pPixmap = pPixmap;
+	privates[i].attachment = attachments[i];
 
 	bo = i830_get_pixmap_bo (pPixmap);
 	if (dri_bo_flink(bo, &buffers[i].name) != 0) {
@@ -1635,13 +1637,17 @@ I830DRI2DestroyBuffers(DrawablePtr pDraw, DRI2BufferPtr buffers, int count)
 
 static void
 I830DRI2CopyRegion(DrawablePtr pDraw, RegionPtr pRegion,
-		   DRI2BufferPtr pDestBuffer, DRI2BufferPtr pSrcBuffer)
+		   DRI2BufferPtr pDstBuffer, DRI2BufferPtr pSrcBuffer)
 {
-    I830DRI2BufferPrivatePtr private = pSrcBuffer->driverPrivate;
+    I830DRI2BufferPrivatePtr srcPrivate = pSrcBuffer->driverPrivate;
+    I830DRI2BufferPrivatePtr dstPrivate = pDstBuffer->driverPrivate;
     ScreenPtr pScreen = pDraw->pScreen;
     ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
     I830Ptr pI830 = I830PTR(pScrn);
-    PixmapPtr pPixmap = private->pPixmap;
+    PixmapPtr pSrcPixmap = (srcPrivate->attachment == DRI2BufferFrontLeft)
+	? (PixmapPtr) pDraw : srcPrivate->pPixmap;
+    PixmapPtr pDstPixmap = (dstPrivate->attachment == DRI2BufferFrontLeft)
+	? (PixmapPtr) pDraw : dstPrivate->pPixmap;
     RegionPtr pCopyClip;
     GCPtr pGC;
 
@@ -1649,9 +1655,9 @@ I830DRI2CopyRegion(DrawablePtr pDraw, RegionPtr pRegion,
     pCopyClip = REGION_CREATE(pScreen, NULL, 0);
     REGION_COPY(pScreen, pCopyClip, pRegion);
     (*pGC->funcs->ChangeClip) (pGC, CT_REGION, pCopyClip, 0);
-    ValidateGC(pDraw, pGC);
-    (*pGC->ops->CopyArea)(&pPixmap->drawable,
-			  pDraw, pGC, 0, 0, pDraw->width, pDraw->height, 0, 0);
+    ValidateGC(&pDstPixmap->drawable, pGC);
+    (*pGC->ops->CopyArea)(&pSrcPixmap->drawable, &pDstPixmap->drawable,
+			  pGC, 0, 0, pDraw->width, pDraw->height, 0, 0);
     FreeScratchGC(pGC);
 
     /* Emit a flush of the rendering cache, or on the 965 and beyond
commit 2e3b95ed0197971e81ab7509245c899e96859d5b
Author: Carl Worth <cworth at cworth.org>
Date:   Wed Apr 15 18:54:19 2009 -0700

    Increment version to 2.7.99.1
    
    This is the number we want for any development snapshots along
    what will eventually become 2.8.0. (Once we get to 'release
    candidates' we'll bump this up to 2.7.99.901.)

diff --git a/configure.ac b/configure.ac
index ae134af..ad1cfcf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,7 +22,7 @@
 
 AC_PREREQ(2.57)
 AC_INIT([xf86-video-intel],
-        2.6.99.1,
+        2.7.99.1,
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
         xf86-video-intel)
 
commit c9e174b31ae3b9a138ae696d563420a841062f57
Author: Carl Worth <cworth at cworth.org>
Date:   Wed Apr 15 18:52:38 2009 -0700

    RELEASING: Note that --with-xserver-source is needed for make distcheck
    
    I was always forgetting this without this reminder.

diff --git a/RELEASING b/RELEASING
index 9376110..ec67224 100644
--- a/RELEASING
+++ b/RELEASING
@@ -25,6 +25,10 @@ The process for releasing a new tarball is as follows:
 
 	$ make distcheck
 
+	Note that unlike a regular "make", this will not work unless
+	you pass a valid --with-xserver-source=/path/to/xserver option
+	to configure.
+
 5. Tag the release
 
 	$ git tag -m "Intel <ver> release" <ver>
commit 73c3be1aa033e8c5c7ee777eb2fd43c19668fa86
Author: Carl Worth <cworth at cworth.org>
Date:   Wed Apr 15 18:18:14 2009 -0700

    README: Fix typos in chipset list, and point to how_to_report_bug web page
    
    Thanks to Gordon Jin for these suggestions.

diff --git a/README b/README
index 8ac6e1f..96db084 100644
--- a/README
+++ b/README
@@ -9,11 +9,10 @@ the X Window System as implemented by X.org. It supports a variety of
 Intel graphics chipsets including:
 
 	i810/i810e/i810-dc100,i815,
-	i830M,845G,852GM,855GM,865M,
+	i830M,845G,852GM,855GM,865G,
 	915G/GM,945G/GM/GME,946GZ
-	G/GM/GME965,
-	G/Q33,G/Q35,G41,G/Q43
-	G/GM/Q45
+	G/GM/GME/Q965,
+	G/Q33,G/Q35,G41,G/Q43,G/GM/Q45
 
 Where to get more information about the driver
 ----------------------------------------------
@@ -39,12 +38,9 @@ xf86-video-intel:
 
 	http://lists.freedesktop.org/mailman/listinfo/intel-gfx
 
-To report bugs encountered with the driver:
+To report bugs encountered with the driver, see:
 
-	http://bugs.freedesktop.org
-
-	Product:	xorg
-	Component:	Driver/intel
+	http://intellinuxgraphics.org/how_to_report_bug.html
 
 To see bugs that are targeted to be fixed in the next release:
 
commit c51dddb724a79a75491369a4c3e8b7b26231e7ac
Author: Carl Worth <cworth at cworth.org>
Date:   Wed Apr 15 18:07:17 2009 -0700

    AUTHORS: Add Robert Lowery to the authors file
    
    Rob got missed from my first scan since one commit lists his name as
    just 'Rob' and 3 commits don't attribute him as author:
    
    	83d304c61ad5fdc58b0a9309dbd1e5a3f6cd9b01
    	7552d80e367fe38bbc594fe94abd649917fe54d5
    	6eecef4fed8a21dfdabef42eb69fd150b96167b2

diff --git a/AUTHORS b/AUTHORS
index 31a1da1..9f1a589 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -22,6 +22,7 @@ Julien Cristau
 Ma Ling
 Bryce Harrington
 Daniel Stone
+Robert Lowery
 Kaleb Keithley
 Paulo Cesar Pereira de Andrade
 Eamon Walsh
commit 4b5edde5da4b3e955eb2d77004de81e47bec7f69
Author: Robert Lowery <rlowery at exemail.com.au>
Date:   Wed Apr 15 18:03:31 2009 -0700

    Fix typo in comment
    
    Thanks to Robert Lowery for the sharp eyes on this one.

diff --git a/src/i830_driver.c b/src/i830_driver.c
index 48e2351..6ff5a1d 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -1607,7 +1607,7 @@ I830AccelMethodInit(ScrnInfoPtr pScrn)
      * Then, just to make things more confusing, the default EXA will
      * be overridden to UXA if KMS is available. See I830DrmModeInit.
      *
-     * All this *will* go away when we remov XAA and EXA support from
+     * All this *will* go away when we remove XAA and EXA support from
      * this driver. (And there will be much rejoicing.)
      */
     if (!(pI830->accel == ACCEL_NONE)) {
commit 3fd5a1ecd1d5140ae07ccc279298bcadd515e97f
Author: Carl Worth <cworth at cworth.org>
Date:   Wed Apr 15 16:44:11 2009 -0700

    RELEASING: Update instructions to reflect some minor process improvements
    
    We've added a NEWS file now, so that needs to be updated for each release.
    
    We're also now using tag names of just <version> rather than
    xf86-video-intel-<version>.

diff --git a/RELEASING b/RELEASING
index c4006c3..9376110 100644
--- a/RELEASING
+++ b/RELEASING
@@ -1,32 +1,40 @@
 The process for releasing a new tarball is as follows:
 
-1. make sure you have the latest build requirements installed:
+1. Make sure you have the latest build requirements installed:
 
 	git://git.freedesktop.org/git/util/macros
 	git://git.freedesktop.org/git/util/modular
 
-2. update your module version (usually found in configure.ac)
+2. Add relevant release notes to the NEWS files
+
+	Skim the git log since the last release, and add notes in a
+	similar style to previous releases.
+
+	For major releases list added features and known limitations.
+
+	For minor releases indicate which bugs were fixed and which
+	are still present.
+
+
+3. Update your module version (usually found in configure.ac)
 
 	$ vi configure.ac # bump version
         $ git push origin # make sure you're on the release branch
 
-3. verify your module builds
+4. Verify your module builds
 
 	$ make distcheck
 
-4. tag the release
-
-	$ git tag -m "Intel <ver> release" xf86-video-intel-<ver>
+5. Tag the release
 
-5. run the release script (this should push the tag)
+	$ git tag -m "Intel <ver> release" <ver>
 
-	$ <path_to>/util/modular/release.sh driver xf86-video-intel-<last_ver> xf86-video-intel-<ver>
+6. Run the release script (this should push the tag)
 
-6. edit the generated release message as needed and send it out
+	$ <path_to>/util/modular/release.sh driver <last_ver> <ver>
 
-	for major releases list added features and known limitations
+7. Edit the generated release message as needed and send it out
 
-	for minor releases indicate which bugs were fixed and which
-	are still present
+	At the very least, add the release notes from the NEWS file.
 
-7. throw a release party, you're done! :)
+8. Throw a release party, you're done! :)
commit e1cace16a6130dcdd93965d2329a349d49200fa6
Author: Carl Worth <cworth at cworth.org>
Date:   Wed Apr 15 16:33:12 2009 -0700

    NEWS: Add note about broken PAT code in some kernels
    
    Hoping to cut off some false bug reports here.

diff --git a/NEWS b/NEWS
index c059c98..0d0cd8a 100644
--- a/NEWS
+++ b/NEWS
@@ -19,6 +19,16 @@ this release, which should give the best performance and
 robustness. When KMS is available, UXA is the default acceleration
 used by the driver, (EXA is the default otherwise).
 
+Known issue:
+
+	Some Linux kernel versions (such as 2.6.29) are known to have
+	broken PAT code that causes recent versions of this driver to
+	fail, (which can manifest as the X server simply not
+	starting). This can be verified by adding the "nopat" option
+	to the kernel command-line and seeing the failure go away. We
+	hope that newer kernels in the 2.6.29.x as well as 2.6.30 and
+	above will have working PAT code.
+
 Some of the most notable bugs fixed in 2.7.0 include:
 
 	[GM45 965GM] bad htotal causes panel startup failure
commit 9ffd1951d1f2fd2f53273d04ea29de050f07af55
Author: Carl Worth <cworth at cworth.org>
Date:   Wed Apr 15 16:14:44 2009 -0700

    Add AUTHORS and NEWS to EXTRA_DIST
    
    These new files don't do us much good if we don't distribute them in
    our releases.

diff --git a/Makefile.am b/Makefile.am
index 45b0c42..d91b3d2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -23,5 +23,5 @@ ACLOCAL_AMFLAGS = -I m4
 
 SUBDIRS = uxa src man
 
-EXTRA_DIST = README
+EXTRA_DIST = README AUTHORS NEWS
 DISTCLEANFILES = doltcompile
commit e4cd9de2933ada3e2a4b43552729ae3a370128bf
Author: Carl Worth <cworth at cworth.org>
Date:   Wed Apr 15 16:14:03 2009 -0700

    Add a NEWS files with release-notes for 2.7.0
    
    It will be nice to have release-notes under revision control, as well
    being able to document issues in an obviously time-sensitive file,
    (as opposed to README where we were documenting some of this previously).

diff --git a/NEWS b/NEWS
new file mode 100644
index 0000000..c059c98
--- /dev/null
+++ b/NEWS
@@ -0,0 +1,107 @@
+Release 2.7.0 (2009-04-15)
+--------------------------
+Compared to the 2.6 series, 2.7.0 has a large number of bug fixes, but
+also a few significant features, such as:
+
+        SDVO-TV support, available on ADD2 card (bug#9992) and
+        D945GCLF2 board (bug#17776).
+
+        Basic SDVO-LVDS support
+
+        XV video display without tearing
+	[Though this isn't working for all users yet, see
+	https://bugs.freedesktop.org/show_bug.cgi?id=21076 ]
+
+	Various fixes for UXA, DRI2, and Kernel modesetting.
+
+We encourage users to use kernel modesetting and UXA acceleration with
+this release, which should give the best performance and
+robustness. When KMS is available, UXA is the default acceleration
+used by the driver, (EXA is the default otherwise).
+
+Some of the most notable bugs fixed in 2.7.0 include:
+
+	[GM45 965GM] bad htotal causes panel startup failure
+	https://bugs.freedesktop.org/show_bug.cgi?id=17292
+
+	[xrandr TV] need TV output property control
+	https://bugs.freedesktop.org/show_bug.cgi?id=12763
+
+	[TV] "xrandr --set TV_FORMAT" gets BadMatch error
+	https://bugs.freedesktop.org/show_bug.cgi?id=16566
+
+	[945 tiling] Low performance due to no A17 workaround
+	https://bugs.freedesktop.org/show_bug.cgi?id=16835
+
+	[TV]Flicker when launching applications in the 2.4-branch
+	https://bugs.freedesktop.org/show_bug.cgi?id=17405
+
+	[945GM FBC] FBC causes underruns & flicker
+	https://bugs.freedesktop.org/show_bug.cgi?id=18651
+
+	[xv] Textured video suffers from tearing
+	https://bugs.freedesktop.org/show_bug.cgi?id=19635
+
+	[G45] Random hangs with UXA
+	https://bugs.freedesktop.org/show_bug.cgi?id=19734
+
+	[945GM] Any 3D app is slow in resolution higher than 800x600
+	with UXA+DRI2, due to tiling
+	https://bugs.freedesktop.org/show_bug.cgi?id=19738
+
+	[i915 UXA,EXA] rotation messes display with tiling on
+	https://bugs.freedesktop.org/show_bug.cgi?id=20265
+
+	[G45] DRI2/UXA gives solid white instead of transparency
+	https://bugs.freedesktop.org/show_bug.cgi?id=20321
+
+	LVDS output not detected
+	https://bugs.freedesktop.org/show_bug.cgi?id=20517
+
+	xf86-video-intel-2.6.3: Xv crashes X server
+	https://bugs.freedesktop.org/show_bug.cgi?id=20525
+
+	[G965 non-GEM] systray in KDE 4 completely broken
+	https://bugs.freedesktop.org/show_bug.cgi?id=20527
+
+	[SDVO-TV]the desktop is teared in four sections on the screen
+	https://bugs.freedesktop.org/show_bug.cgi?id=20550
+
+	Intel video driver 2.6.3 crashes with XVideo
+	https://bugs.freedesktop.org/show_bug.cgi?id=20563
+
+	[855GM] Xv crash with non-KMS
+	https://bugs.freedesktop.org/show_bug.cgi?id=20585
+
+	2.6.99.902 breaks native 1680x1050 mode on TMDS -- EDID miss
+	https://bugs.freedesktop.org/show_bug.cgi?id=20594
+
+	[945GM TV] 2.6.99.902 sets a too high CONTRAST-value
+	https://bugs.freedesktop.org/show_bug.cgi?id=20670
+
+	[915GM] fail to detect LVDS with new VBT code
+	https://bugs.freedesktop.org/show_bug.cgi?id=20752
+
+	[regression i965]tiled output when start X
+	https://bugs.freedesktop.org/show_bug.cgi?id=20803
+
+	2.6.99.902: LVDS wrongly detected as disconnected
+	https://bugs.freedesktop.org/show_bug.cgi?id=20826
+
+	vt switching fails and crashes X
+	https://bugs.freedesktop.org/show_bug.cgi?id=20863
+
+	[HDMI] The screen will flicker when some application runs on
+	G45-64
+	https://bugs.freedesktop.org/show_bug.cgi?id=20875
+
+	TexturedVideo is offsetted wrongly on dualhead
+	https://bugs.freedesktop.org/show_bug.cgi?id=20980
+
+	[EXA] xvideo hang X
+	https://bugs.freedesktop.org/show_bug.cgi?id=21027
+
+	[EXA] x11perf performance regression
+	https://bugs.freedesktop.org/show_bug.cgi?id=21029
+
+	And many others...
commit 506c810f8f3db89048dda9777902f142ffeb86aa
Author: Carl Worth <cworth at cworth.org>
Date:   Wed Apr 15 16:10:52 2009 -0700

    Clarify that the default acceleration is UXA if KMS is available.
    
    Stale documentation considered harmful of course.

diff --git a/man/intel.man b/man/intel.man
index f85d3d1..4f8db81 100644
--- a/man/intel.man
+++ b/man/intel.man
@@ -154,7 +154,7 @@ UXA is a newer acceleration architecture built from the EXA acceleration
 code but taking advantage of kernel memory management to provide simpler,
 faster code.
 .IP
-Default: "EXA".
+Default: "UXA" if kernel-modesetting is available, "EXA" otherwise.
 .TP
 .BI "Option \*qModeDebug\*q \*q" boolean \*q
 Enable printing of additional debugging information about modesetting to
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 32ca6c9..48e2351 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -1604,8 +1604,11 @@ I830AccelMethodInit(ScrnInfoPtr pScrn)
      * 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. :)
+     * Then, just to make things more confusing, the default EXA will
+     * be overridden to UXA if KMS is available. See I830DrmModeInit.
+     *
+     * All this *will* go away when we remov XAA and EXA support from
+     * this driver. (And there will be much rejoicing.)
      */
     if (!(pI830->accel == ACCEL_NONE)) {
 #ifdef I830_USE_UXA
commit b9716b836cb2b4569c90b81f344932ac668dc5bf
Author: Carl Worth <cworth at cworth.org>
Date:   Wed Apr 15 15:39:06 2009 -0700

    Add a new AUTHORS file
    
    This is a sorted list of everyone with more than 2 commits in the git
    revision history. We also list some historical authors mentioned in the
    man page, (with code presumably pre-dating the beginning of revision
    history).

diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 0000000..31a1da1
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,62 @@
+Authors of xf86-video-intel (since 2003-11-14 when revision-control
+history begins, sorted roughly by number of commits, descending):
+
+Eric Anholt
+Keith Packard
+Zhenyu Wang
+Jesse Barnes
+Alan Hourihane
+Carl Worth
+Dave Airlie
+Michel Dänzer
+Zou Nan Hai
+Kristian Høgsberg
+Adam Jackson
+Nian Wu
+Xian, Haihao
+Egbert Eich
+Kevin E Martin
+Alan Coopersmith
+Hong Liu
+Julien Cristau
+Ma Ling
+Bryce Harrington
+Daniel Stone
+Kaleb Keithley
+Paulo Cesar Pereira de Andrade
+Eamon Walsh
+Matthieu Herrb
+Owain G. Ainsworth
+Søren Sandmann Pedersen
+Brice Goglin
+Ian Romanick
+Lukáš Hejtmánek
+Matthias Hopf
+Olivier Fourdan
+Robert Noland
+Rémi Cardona
+Shuang He
+Wu Fengguang
+and many others (with 1 or 2 commits)
+
+Other authors (from before revision-control history begins):
+
+Keith Whitwell
+Jonathan Bian
+Matthew J Sottek
+Jeff Hartmann
+Mark Vojkovich
+H. J. Lu
+David Dawes
+
+If the above list is missing anyone, please accept our apologies and
+let us know.
+
+The X.Org version of this driver is maintained by Intel Corporation:
+
+	http://www.intellinuxgraphics.org
+
+The X11R6 version of this driver originally came from XFree86 4.4 rc2.
+ 
+The XFree86 version of this driver was donated to The XFree86 Project
+by Precision Insight, Inc.; Cedar Park, TX; USA
commit 8deb3a3709a9aaa549be404566715a01246354d9
Author: Carl Worth <cworth at cworth.org>
Date:   Wed Apr 15 15:38:11 2009 -0700

    README: Remove almost all time-sensitive information
    
    This was all very stale, and is better convered in intel.man. We replace
    this with a list of pointers to where to get current information, (man
    page, web site, and mailing list).

diff --git a/README b/README
index c91c661..8ac6e1f 100644
--- a/README
+++ b/README
@@ -1,106 +1,51 @@
-Information for Intel graphics driver users
-Eric Anholt
-2007-07-02
+xf86-video-intel
+Open-source X.org graphics driver for Intel graphics
+http://www.intellinuxgraphics.com/
 
-This document provides a brief summary of the Intel graphics support provided
-by the xf86-video-intel driver.  More information can also be found in the
-intel(4) manual page.
+What is xf86-video-intel
+------------------------
+The xf86-video-intel module is an open-source 2D graphics driver for
+the X Window System as implemented by X.org. It supports a variety of
+Intel graphics chipsets including:
 
-Supported Hardware:
-	i810,
-  	i810-dc100,
-	i810e
-	i815
-	i830
-	i845
-	i852
-	i855
-	915G
-	915GM
-	945G
-	945GM/GME
-	946GZ
-	G965
-	GM/GME965
-	G33/Q33/Q35
+	i810/i810e/i810-dc100,i815,
+	i830M,845G,852GM,855GM,865M,
+	915G/GM,945G/GM/GME,946GZ
+	G/GM/GME965,
+	G/Q33,G/Q35,G41,G/Q43
+	G/GM/Q45
 
-Features
-- Full support for 8, 15, 16, and 24 bit pixel depths.
-- Hardware accelerated 2D drawing engine support for 8, 15, 16 and 24 bit
-  pixel depths.
-- Hardware accelerated 3D drawing using OpenGL and the DRI.
-- Hardware cursor support to reduce sprite flicker.
-- Textured video XV implementation on i915 through i965.
-- Hardware overlay XV implementation up through i945.
-- Screen resize and rotation.
+Where to get more information about the driver
+----------------------------------------------
+The primary source of information about this and other open-source
+drivers for Intel graphics is:
 
-Technical Notes
-- Interlace modes cannot be supported.
-- This driver  requires kernel support for AGP, which is included in Linux
-  kernels 2.3.42 and higher, and FreeBSD 4.1 and higher.
-- This driver may be built against xserver 1.2.0 or newer.  If built
-  from git source against an older server, a copy of xserver 1.3.0 source is
-  needed to complete the build, which is chosen with the --with-xserver-source
-  argument to ./configure.  The compatibility mode with xserver 1.2.0 will have
-  limited functionality, in particular by not supporting RandR 1.2 or the
-  new Damage 1.1 updated needed for 3D applications to work with display
-  rotation.
+	http://intellinuxgraphics.org/
 
-Configuration
+Documentation specific to the xf86-video-intel driver including
+possible configuration options for the xorg.conf file can be found in
+the intel(4) manual page. After installing the driver this
+documentation can be read with the following command:
 
-The driver auto-detects all device information necessary to
-initialize the card.  The only lines you should need in the "Device"
-section of your xorg.conf file are:
+	man intel
 
-       Section "Device"
-           Identifier "intel"
-           Driver     "intel"
-       EndSection
+Mailing list for communication with users and developers of
+xf86-video-intel:
 
-Please refer to the intel(4) manual page for information on configuration
-options.
+	intel-gfx at lists.freedesktop.org.
 
+	Note: Subscription is required before posting, but anyone is
+	free to subscribe. See instructions (and archives) here:
 
-Known Limitations
-- No support for "zaphod mode" dualhead.  This is the mode in which two
-  Device sections are placed in the config file, and doesn't support DRI or
-  many other features.  Instead, only "MergedFB-style" dualhead is supported.
-- No support for X Screens larger than 2048 pixels in either direction
-  before the 965.  This reflects hardware limitations in the x direction on
-  those older chips, and limits dualhead functionality.  It may be possible to
-  extend the limit vertically on these older chips.
-- i855 XV may cause hangs.  This was present in the previous release, and no
-  workaround is known.
-- SDVO TV-out cards not supported.  This should be fixed in the next
-  release.
-- Gray output with integrated TV-out and PAL TVs.
-- EXA support unstable on i845.
-- Some GM965 systems, such as the Thinkpad T61, probe the TV as being connected
-  even when no output connector is available.  This results in the gnome-panel
-  issue noted below.
+	http://lists.freedesktop.org/mailman/listinfo/intel-gfx
 
-Common issues not caused by the driver
-- Font sizes (DPI) are wrong.  Some displays incorrectly report their
-  physical size, which is harmless on most OSes that always assume 96dpi
-  displays.  This can be fixed through quirks for specific monitors in the X
-  Server, and the output of xrandr --prop along with a physical measurement of
-  the screen size in a bug report against the server can help get that fixed.
-- gnome-panel is located in the middle of the screen.  gnome-panel places
-  itself within head #0's boundaries, which doesn't work well with a second
-  head covering the same area as head #0 but larger.
-- Older resolution-changing applications have poor results in
-  multihead systems.  Previous extensions such as RandR 1.1 exposed only a
-  single output to client programs, and those requests map poorly to multi-head
-  systems.  Currently, those requests map to just one of the outputs in the
-  RandR 1.2 environment, and those applications need to be updated to RandR 1.2
-  API when available for better results.
+To report bugs encountered with the driver:
 
-The X11R6 version of this driver originally came from XFree86 4.4 rc2.
+	http://bugs.freedesktop.org
 
-The XFree86 version of this driver was donated to The XFree86 Project by:
-    Precision Insight, Inc.
-    Cedar Park, TX
-    USA
+	Product:	xorg
+	Component:	Driver/intel
 
-The X.Org version of this driver is maintained by Intel Corporation.
-<http://www.intellinuxgraphics.org>
+To see bugs that are targeted to be fixed in the next release:
+
+	https://bugs.freedesktop.org/show_bug.cgi?id=intel-2d-release
commit 9b615a52671aacf34666f90ecfff98651ce6afe2
Author: Li Peng <peng.li at intel.com>
Date:   Fri Apr 10 14:39:35 2009 +0800

    Turn on front buffer tiling in KMS.
    
    This code disabled front buffer tiling in KMS. Turn it on since kernel
    handles all tiling now, this improves performance of x11perf -aa10text
    from 97k to 286k on my 945GME.
    
    Should help with #20761, if not totally fix it.
    
    Acked-by: Jesse Barnes <jbarnes at virtuousgeek.org>
    Signed-off-by: Li Peng <peng.li at intel.com>

diff --git a/src/i830_memory.c b/src/i830_memory.c
index 0f8d90d..d3138d9 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -1244,8 +1244,6 @@ i830_allocate_framebuffer(ScrnInfoPtr pScrn)
 	tile_format = TILE_XMAJOR;
     if (pI830->accel == ACCEL_XAA && IS_I965G(pI830))
 	tile_format = TILE_NONE;
-    if (pI830->use_drm_mode)
-	tile_format = TILE_NONE;
 
     if (!IsTileable(pScrn, pitch))
 	tile_format = TILE_NONE;
commit 053432991c812146f6e7c6f13c6ace55385c825f
Author: Ma Ling <ling.ma at intel.com>
Date:   Mon Apr 13 14:27:35 2009 +0800

    update manpage for BROADCAST_RGB property

diff --git a/man/intel.man b/man/intel.man
index 6ccacda..f85d3d1 100644
--- a/man/intel.man
+++ b/man/intel.man
@@ -321,6 +321,14 @@ First DVI SDVO output
 .SS "TMDS-2"
 Second DVI SDVO output
 
+.SS "TMDS-1", "TMDS-2", "HDMI-1", "HDMI-2"
+DVI/HDMI outputs. Avaliable common properties include:
+.PP
+.B BROADCAST_RGB
+- method used to set RGB color range(full range 0-255, not full range 16-235)
+.TP 2
+Adjusting this propertie allows you to set RGB color range on each channel in order to match HDTV requirment(default 0 for full range). Setting 1 means RGB color range is 16-235, 0 means RGB color range is 0-255 on each channel.
+
 .PP
 SDVO and DVO TV outputs are not supported by the driver at this time.
 
commit 62ba7211fe9b6aada125ebfe34cf7161e817ad6b
Author: Ma Ling <ling.ma at intel.com>
Date:   Mon Apr 13 14:24:57 2009 +0800

    set broadcast RGB mode for integrated HDMI output.

diff --git a/src/i830_hdmi.c b/src/i830_hdmi.c
index 05aa9ac..0abb151 100644
--- a/src/i830_hdmi.c
+++ b/src/i830_hdmi.c
@@ -33,6 +33,7 @@
 #include "i830.h"
 #include "xf86Modes.h"
 #include "i830_display.h"
+#include "X11/Xatom.h"
 
 struct i830_hdmi_priv {
     uint32_t output_reg;
@@ -40,8 +41,12 @@ struct i830_hdmi_priv {
     uint32_t save_SDVO;
 
     Bool has_hdmi_sink;
+    /* Default 0 for full RGB range 0-255, 1 is for RGB range 16-235 */
+    uint32_t broadcast_rgb;
 };
 
+static Atom broadcast_atom;
+
 static int
 i830_hdmi_mode_valid(xf86OutputPtr output, DisplayModePtr mode)
 {
@@ -214,7 +219,91 @@ i830_hdmi_destroy (xf86OutputPtr output)
     }
 }
 
+static void
+i830_hdmi_create_resources(xf86OutputPtr output)
+{
+    ScrnInfoPtr                 pScrn = output->scrn;
+    I830Ptr                     pI830 = I830PTR(pScrn);
+    I830OutputPrivatePtr        intel_output = output->driver_private;
+    struct i830_hdmi_priv       *dev_priv = intel_output->dev_priv;
+    INT32			broadcast_range[2];
+    int                         err;
+
+    /* only R G B are 8bit color mode */
+    if (pScrn->depth != 24 ||
+        /* only 965G and G4X platform */
+        !(IS_I965G(pI830) || IS_G4X(pI830)))
+        return;
+
+    broadcast_atom =
+        MakeAtom("BROADCAST_RGB", sizeof("BROADCAST_RGB") - 1, TRUE);
+
+    broadcast_range[0] = 0;
+    broadcast_range[1] = 1;
+    err = RRConfigureOutputProperty(output->randr_output,
+                                    broadcast_atom,
+                                    FALSE, TRUE, FALSE, 2, broadcast_range);
+    if (err != 0) {
+        xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+                   "RRConfigureOutputProperty error, %d\n", err);
+        return;
+    }
+    /* Set the current value of the broadcast property as full range */
+    dev_priv->broadcast_rgb = 0;
+    err = RRChangeOutputProperty(output->randr_output,
+                                 broadcast_atom,
+                                 XA_INTEGER, 32, PropModeReplace,
+                                 1, &dev_priv->broadcast_rgb,
+                                 FALSE, TRUE);
+    if (err != 0) {
+        xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+                   "RRChangeOutputProperty error, %d\n", err);
+        return;
+    }
+}
+
+static Bool
+i830_hdmi_set_property(xf86OutputPtr output, Atom property,
+                       RRPropertyValuePtr value)
+{
+    ScrnInfoPtr             pScrn = output->scrn;
+    I830Ptr                 pI830 = I830PTR(pScrn);
+    I830OutputPrivatePtr    intel_output = output->driver_private;
+    struct i830_hdmi_priv   *dev_priv = intel_output->dev_priv;
+    uint32_t temp;
+
+    if (property == broadcast_atom) {
+        uint32_t val;
+
+        if (value->type != XA_INTEGER || value->format != 32 ||
+            value->size != 1)
+        {
+            return FALSE;
+        }
+
+        val = *(INT32 *)value->data;
+        if (val < 0 || val > 1)
+        {
+            return FALSE;
+        }
+        if (val == dev_priv->broadcast_rgb)
+            return TRUE;
+
+        temp = INREG(dev_priv->output_reg);
+
+        if (val == 1)
+            temp |= SDVO_COLOR_NOT_FULL_RANGE;
+        else if (val == 0)
+            temp &= ~SDVO_COLOR_NOT_FULL_RANGE;
+
+        OUTREG(dev_priv->output_reg, temp);
+        dev_priv->broadcast_rgb = val;
+    }
+    return TRUE;
+}
+
 static const xf86OutputFuncsRec i830_hdmi_output_funcs = {
+    .create_resources = i830_hdmi_create_resources,
     .dpms = i830_hdmi_dpms,
     .save = i830_hdmi_save,
     .restore = i830_hdmi_restore,
@@ -225,6 +314,7 @@ static const xf86OutputFuncsRec i830_hdmi_output_funcs = {
     .commit = i830_output_commit,
     .detect = i830_hdmi_detect,
     .get_modes = i830_ddc_get_modes,
+    .set_property = i830_hdmi_set_property,
     .destroy = i830_hdmi_destroy
 };
 
commit 69388953ce889080d5f014123d89bf3eb45f3d8d
Author: Ma Ling <ling.ma at intel.com>
Date:   Mon Apr 13 14:23:06 2009 +0800

    set broadcast RGB mode for HDMI and TMDS from SDVOX output
    
    Almost all digital TVs accept broadcast RGB values from 16 to 235 for each channel,
    otherwise for those uncompensated videos, when RGB values are set from 0 to 255,
    they will shows black and whiter clamping, which seriously degrades picture quality.
    The patch will enable the broadcast RGB mode for hdtv according to user's setting.
    It fixed bug #14486

diff --git a/src/i810_reg.h b/src/i810_reg.h
index 59b6079..d5d41b3 100644
--- a/src/i810_reg.h
+++ b/src/i810_reg.h
@@ -1300,6 +1300,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define SDVO_ENCODING_HDMI			(0x2 << 10)
 /** Requird for HDMI operation */
 #define SDVO_NULL_PACKETS_DURING_VSYNC		(1 << 9)
+#define SDVO_COLOR_NOT_FULL_RANGE		(1 << 8)
 #define SDVO_BORDER_ENABLE			(1 << 7)
 #define SDVO_AUDIO_ENABLE			(1 << 6)
 /** New with 965, default is to be set */
diff --git a/src/i830_sdvo.c b/src/i830_sdvo.c
index a7b5171..29ccd4e 100644
--- a/src/i830_sdvo.c
+++ b/src/i830_sdvo.c
@@ -49,6 +49,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "i830_display.h"
 #include "i810_reg.h"
 #include "i830_sdvo_regs.h"
+#include "X11/Xatom.h"
 
 /** SDVO driver private structure. */
 struct i830_sdvo_priv {
@@ -110,6 +111,8 @@ struct i830_sdvo_priv {
 
     /** DDC bus used by this SDVO output */
     uint8_t ddc_bus;
+    /* Default 0 for full RGB range 0-255, 1 is for RGB range 16-235 */
+    uint32_t broadcast_rgb;
 
     /** State for save/restore */
     /** @{ */
@@ -121,6 +124,8 @@ struct i830_sdvo_priv {
     /** @} */
 };
 
+static Atom broadcast_atom;
+
 /**
  * Writes the SDVOB or SDVOC with the given value, but always writes both
  * SDVOB and SDVOC to work around apparent hardware issues (according to
@@ -1927,7 +1932,94 @@ i830_sdvo_get_crtc(xf86OutputPtr output)
 }
 #endif
 
+static void
+i830_sdvo_create_resources(xf86OutputPtr output)
+{
+    ScrnInfoPtr                 pScrn = output->scrn;
+    I830Ptr                     pI830 = I830PTR(pScrn);
+    I830OutputPrivatePtr        intel_output = output->driver_private;
+    struct i830_sdvo_priv       *dev_priv = intel_output->dev_priv;
+    INT32			broadcast_range[2];
+    int                         err;
+
+    /* only R G B are 8bit color mode */
+    if (pScrn->depth != 24 ||
+        /* only 965G and G4X platform */
+        !(IS_I965G(pI830) || IS_G4X(pI830)) ||
+        /* only TMDS encoding */
+        !(strstr(output->name, "TMDS") || strstr(output->name, "HDMI")))
+        return;
+
+    broadcast_atom =
+        MakeAtom("BROADCAST_RGB", sizeof("BROADCAST_RGB") - 1, TRUE);
+
+    broadcast_range[0] = 0;
+    broadcast_range[1] = 1;
+    err = RRConfigureOutputProperty(output->randr_output,
+                                    broadcast_atom,
+                                    FALSE, TRUE, FALSE, 2, broadcast_range);
+    if (err != 0) {
+        xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+                   "RRConfigureOutputProperty error, %d\n", err);
+        return;
+    }
+    /* Set the current value of the broadcast property as full range */
+    dev_priv->broadcast_rgb = 0;
+    err = RRChangeOutputProperty(output->randr_output,
+                                 broadcast_atom,
+                                 XA_INTEGER, 32, PropModeReplace,
+                                 1, &dev_priv->broadcast_rgb,
+                                 FALSE, TRUE);
+    if (err != 0) {
+        xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+                   "RRChangeOutputProperty error, %d\n", err);
+        return;
+    }
+}
+
+static Bool
+i830_sdvo_set_property(xf86OutputPtr output, Atom property,
+		       RRPropertyValuePtr value)
+{
+    ScrnInfoPtr             pScrn = output->scrn;
+    I830Ptr                 pI830 = I830PTR(pScrn);
+    I830OutputPrivatePtr    intel_output = output->driver_private;
+    struct i830_sdvo_priv   *dev_priv = intel_output->dev_priv;
+    uint32_t temp;
+
+    if (property == broadcast_atom) {
+        uint32_t val;
+
+        if (value->type != XA_INTEGER || value->format != 32 ||
+            value->size != 1)
+        {
+            return FALSE;
+        }
+
+        val = *(INT32 *)value->data;
+        if (val < 0 || val > 1)
+        {
+            return FALSE;
+        }
+        if (val == dev_priv->broadcast_rgb)
+            return TRUE;
+
+        temp = INREG(dev_priv->output_device);
+
+        if (val == 1)
+            temp |= SDVO_COLOR_NOT_FULL_RANGE;
+        else if (val == 0)
+            temp &= ~SDVO_COLOR_NOT_FULL_RANGE;
+
+        i830_sdvo_write_sdvox(output, temp);
+
+        dev_priv->broadcast_rgb = val;
+    }
+    return TRUE;
+}
+
 static const xf86OutputFuncsRec i830_sdvo_output_funcs = {
+    .create_resources = i830_sdvo_create_resources,
     .dpms = i830_sdvo_dpms,
     .save = i830_sdvo_save,
     .restore = i830_sdvo_restore,
@@ -1938,6 +2030,7 @@ static const xf86OutputFuncsRec i830_sdvo_output_funcs = {
     .commit = i830_output_commit,
     .detect = i830_sdvo_detect,
     .get_modes = i830_sdvo_get_modes,
+    .set_property = i830_sdvo_set_property,
     .destroy = i830_sdvo_destroy,
 #ifdef RANDR_GET_CRTC_INTERFACE
     .get_crtc = i830_sdvo_get_crtc,
commit 6d345c49f693cc5cffaa00b94559d2afcb3a0864
Author: Carl Worth <cworth at cworth.org>
Date:   Fri Apr 10 14:07:14 2009 -0700

    Add a RELEASING file documenting the release process
    
    Thanks to Jesse Barnes for the original recipe.

diff --git a/RELEASING b/RELEASING
new file mode 100644
index 0000000..c4006c3
--- /dev/null
+++ b/RELEASING
@@ -0,0 +1,32 @@
+The process for releasing a new tarball is as follows:
+
+1. make sure you have the latest build requirements installed:
+
+	git://git.freedesktop.org/git/util/macros
+	git://git.freedesktop.org/git/util/modular
+
+2. update your module version (usually found in configure.ac)
+
+	$ vi configure.ac # bump version
+        $ git push origin # make sure you're on the release branch
+
+3. verify your module builds
+
+	$ make distcheck
+
+4. tag the release
+
+	$ git tag -m "Intel <ver> release" xf86-video-intel-<ver>
+
+5. run the release script (this should push the tag)
+
+	$ <path_to>/util/modular/release.sh driver xf86-video-intel-<last_ver> xf86-video-intel-<ver>
+
+6. edit the generated release message as needed and send it out
+
+	for major releases list added features and known limitations
+
+	for minor releases indicate which bugs were fixed and which
+	are still present
+
+7. throw a release party, you're done! :)
commit 7e516b6d24d8c0c6549a9a60fcf487e3a1615020
Author: Jesse Barnes <jbarnes at jbarnes-acer.(none)>
Date:   Wed Apr 8 16:38:08 2009 -0700

    Silence warning in i830_dmi_store_field
    
    Just add a dummy ret variable to shut up gcc.

diff --git a/src/i830_quirks.c b/src/i830_quirks.c
index 78292f7..81ea3c2 100644
--- a/src/i830_quirks.c
+++ b/src/i830_quirks.c
@@ -70,12 +70,13 @@ static char *i830_dmi_data[dmi_data_max];
 static void i830_dmi_store_##field(void) \
 {\
     FILE *f = NULL;\
+    int ret;\
     f = fopen(DMIID_FILE(field), "r");\
     if (f == NULL) {\
 	xfree(i830_dmi_data[field]); i830_dmi_data[field] = NULL;\
 	return;\
     }\
-    fread(i830_dmi_data[field], 64, 1, f);\
+    ret = fread(i830_dmi_data[field], 64, 1, f);	\
     fclose(f);\
 }
 
commit 620e97bbd6a811ad69b8ac94df1fe2c9edf65549
Author: Jesse Barnes <jbarnes at virtuousgeek.org>
Date:   Wed Apr 8 15:49:00 2009 -0700

    Don't enable kernel execbuf fencing w/EXA
    
    If we enable kernel execbuf fence register management, it's best if the
    kernel manages all fence registers.  This works fine if the accel
    method is managing pixmaps or doesn't use offscreen pixmaps.  However
    with EXA, pixmap accesses are done relative to the framebuffer BAR
    mapping (pI830->FbBase) and the Screen pixmap address.  So if we try to
    set the screen pixmap to point at a GTT mapped (and therefore properly
    fenced) address, later calls to intel_get_pixmap_offset() will call
    into EXA, which will use the pseudo-random pixmap addr and the EXA
    offscreen base addr (which is really just FbBase) to calculate the
    offset.  This will fail.  So disable kernel fence reg management in the
    EXA case (this is easier than adding proper EXA pixmap management to
    xf86-video-intel, and makes more sense since we'll be removing EXA soon
    anyway).
    
    Fixes FDO #21027.
    
    Also happens to fix FDO #21029 (as tested by Carl Worth <cworth at cworth.org).

diff --git a/src/i830_memory.c b/src/i830_memory.c
index e3314c5..0f8d90d 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -533,14 +533,15 @@ i830_allocator_init(ScrnInfoPtr pScrn, unsigned long offset, unsigned long size)
 		struct drm_i915_gem_init init;
 		int ret;
 
-		sp.param = I915_SETPARAM_NUM_USED_FENCES;
-		sp.value = 0; /* kernel gets them all */
-
-		ret = drmCommandWrite(pI830->drmSubFD, DRM_I915_SETPARAM, &sp,
-				      sizeof(sp));
-		if (ret == 0)
-		    pI830->kernel_exec_fencing = TRUE;
-
+		if (pI830->accel == ACCEL_UXA) {
+		    sp.param = I915_SETPARAM_NUM_USED_FENCES;
+		    sp.value = 0; /* kernel gets them all */
+
+		    ret = drmCommandWrite(pI830->drmSubFD, DRM_I915_SETPARAM,
+					  &sp, sizeof(sp));
+		    if (ret == 0)
+			pI830->kernel_exec_fencing = TRUE;
+		}
 		init.gtt_start = pI830->memory_manager->offset;
 		init.gtt_end = pI830->memory_manager->offset +
 		    pI830->memory_manager->size;
commit 0a0731c11d10392cdc55ecc04e4e3575c8b3fe57
Author: Shuang He <shuang.he at intel.com>
Date:   Tue Apr 7 12:31:07 2009 -0700

    Fix value for MI_WAIT_FOR_PIPEA_SCAN_LINE_WINDOW
    
    Since the change to scan-line based video sync, (rather than vblank-
    based), we've only been getting tear-free video on one of the two
    pipes. This fixes that bug by using the correct constant for waiting
    on PIPEA.

diff --git a/src/i810_reg.h b/src/i810_reg.h
index 102097c..59b6079 100644
--- a/src/i810_reg.h
+++ b/src/i810_reg.h
@@ -2443,7 +2443,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define MI_WAIT_FOR_PIPEB_VBLANK		(1<<7)
 #define MI_WAIT_FOR_PIPEB_SCAN_LINE_WINDOW	(1<<5)
 #define MI_WAIT_FOR_PIPEA_VBLANK		(1<<3)
-#define MI_WAIT_FOR_PIPEA_SCAN_LINE_WINDOW	(1<<2)
+#define MI_WAIT_FOR_PIPEA_SCAN_LINE_WINDOW	(1<<1)
 
 /* Set the scan line for MI_WAIT_FOR_PIPE?_SCAN_LINE_WINDOW */
 #define MI_LOAD_SCAN_LINES_INCL			(0x12<<23)
commit 940c2aad4d174b6609bdc49f8c99a4bc37926516
Author: Carl Worth <cworth at cworth.org>
Date:   Mon Apr 6 14:36:33 2009 -0700

    Don't clip video to CRTC in the case of textured video
    
    Since we're not limited by a single overlay plane on a single pipe,
    we want to not clip at all, (so that the correct video appears on
    both pipes).
    
    This fixes bug #20980 which shows a video spanning two pipes
    being rendered incorrectly.

diff --git a/src/i830_video.c b/src/i830_video.c
index 13f3ab1..4ed3047 100644
--- a/src/i830_video.c
+++ b/src/i830_video.c
@@ -2146,7 +2146,8 @@ i830_clip_video_helper (ScrnInfoPtr pScrn,
 						   pPriv->desired_crtc,
 						   &crtc_box);
 	
-	if (crtc)
+	/* For textured video, we don't actually want to clip at all. */
+	if (crtc && !pPriv->textured)
 	{
 	    REGION_INIT (pScreen, &crtc_region_local, &crtc_box, 1);
 	    crtc_region = &crtc_region_local;
commit 63b4b5efac936c674dedad8125a8dbac4f000908
Author: Zhenyu Wang <zhenyu.z.wang at intel.com>
Date:   Tue Apr 7 10:53:08 2009 +0800

    quirk LVDS on ibase MB890 855GM board
    
    fix bug #19529

diff --git a/src/i830_quirks.c b/src/i830_quirks.c
index 8680baf..78292f7 100644
--- a/src/i830_quirks.c
+++ b/src/i830_quirks.c
@@ -236,6 +236,17 @@ static void quirk_msi_lvds_dmi (I830Ptr pI830)
    }
 }
 
+static void quirk_ibase_lvds (I830Ptr pI830)
+{
+   if (!i830_dmi_data[board_name]) {
+       ErrorF("Failed to load DMI info, iBase LVDS quirk not applied.\n");
+       return;
+   }
+   if (!strncmp(i830_dmi_data[board_name], "i855-W83627HF", 13)) {
+       pI830->quirk_flag |= QUIRK_IGNORE_LVDS;
+   }
+}
+
 static void quirk_ivch_dvob (I830Ptr pI830)
 {
 	pI830->quirk_flag |= QUIRK_IVCH_NEED_DVOB;
@@ -379,6 +390,9 @@ static i830_quirk i830_quirk_list[] = {
     /* #19239: Mirrus Centrino laptop */
     { PCI_CHIP_I915_GM, 0x1584, 0x9800, quirk_broken_acpi_lid },
 
+    /* #19529: iBase MB890 board */
+    { PCI_CHIP_I855_GM, 0x8086, 0x3582, quirk_ibase_lvds },
+
     { 0, 0, 0, NULL },
 };
 
commit 5d9d9a2e466474a0508a15b294a91507ccb3ccc1
Author: Carl Worth <cworth at cworth.org>
Date:   Mon Apr 6 14:02:08 2009 -0700

    Fix new video sync-to-blank code for multi-head
    
    We need to account for a non-zero Y offset for the CRTC. Without
    this, we don't sync to the correct region, so tearing becomes
    visible again.

diff --git a/src/i830_video.c b/src/i830_video.c
index 3331dd3..13f3ab1 100644
--- a/src/i830_video.c
+++ b/src/i830_video.c
@@ -2517,6 +2517,7 @@ I830PutImage(ScrnInfoPtr pScrn,
 
         if (sync) {
 	    BoxPtr box;
+	    int y1, y2;
             int event, pipe;
 	    I830CrtcPrivatePtr intel_crtc = crtc->driver_private;
 
@@ -2529,14 +2530,16 @@ I830PutImage(ScrnInfoPtr pScrn,
 	    }
 
 	    box = REGION_EXTENTS(unused, clipBoxes);
+	    y1 = box->y1 - crtc->y;
+	    y2 = box->y2 - crtc->y;
 
             BEGIN_BATCH(5);
 	    /* The documentation says that the LOAD_SCAN_LINES command
 	     * always comes in pairs. Don't ask me why. */
 	    OUT_BATCH(MI_LOAD_SCAN_LINES_INCL | pipe);
-	    OUT_BATCH((box->y1 << 16) | box->y2);
+	    OUT_BATCH((y1 << 16) | y2);
 	    OUT_BATCH(MI_LOAD_SCAN_LINES_INCL | pipe);
-	    OUT_BATCH((box->y1 << 16) | box->y2);
+	    OUT_BATCH((y1 << 16) | y2);
             OUT_BATCH(MI_WAIT_FOR_EVENT | event);
             ADVANCE_BATCH();
         }
commit 3d4ee3cac1d63dfdf7b54c8ba577f3b77637499f
Author: Carl Worth <cworth at cworth.org>
Date:   Mon Apr 6 11:31:20 2009 -0700

    Remove support for 'auto'(-1) value of XV_SYNC_TO_VBLANK
    
    We previously had a heurstic here where we would only sync to vblank
    for windows that covered more than 25% of the screen. We don't need
    this anymore since the new approach to sync, (WAIT_FOR_SCANLINE_WINDOW),
    is not excessively costly for small windows.

diff --git a/man/intel.man b/man/intel.man
index ffe69a1..6ccacda 100644
--- a/man/intel.man
+++ b/man/intel.man
@@ -451,10 +451,11 @@ You can use the "xvattr" tool to query/set those attributes at runtime.
 
 .SS "XV_SYNC_TO_VBLANK"
 XV_SYNC_TO_VBLANK is used to control whether textured adapter synchronizes 
-the screen update to the vblank to eliminate tearing. It has three 
-values 'auto'(-1), 'off'(0) and 'on(1). 'off' means never sync, 'on' means 
-always sync, no matter what size, and 'auto' means sync if the Xv image is 
-more than quarter of the pixels on the screen. The default is 'auto'(-1).
+the screen update to the vblank to eliminate tearing. It is a Boolean
+attribute with values of 0 (never sync) or 1 (always sync). An historic
+value of -1 (sync for large windows only) will now be interpreted as 1,
+(since the current approach for sync is not costly even with small
+video windows).
 
 .SS "XV_BRIGHTNESS"
         
diff --git a/src/i830_video.c b/src/i830_video.c
index 3dde5b4..3331dd3 100644
--- a/src/i830_video.c
+++ b/src/i830_video.c
@@ -1019,7 +1019,7 @@ I830SetupImageVideoTextured(ScreenPtr pScreen)
 	pPriv->doubleBuffer = 0;
 
 	pPriv->rotation = RR_Rotate_0;
-	pPriv->SyncToVblank = -1;
+	pPriv->SyncToVblank = 1;
 
 	/* gotta uninit this someplace, XXX: shouldn't be necessary for textured */
 	REGION_NULL(pScreen, &pPriv->clip);
@@ -2513,23 +2513,6 @@ I830PutImage(ScrnInfoPtr pScrn,
             sync = FALSE;
         } else if (pPriv->SyncToVblank == 0) {
             sync = FALSE;
-        } else if (pPriv->SyncToVblank == -1) {
-            BoxRec crtc_box;
-            BoxPtr pbox;
-            int nbox, crtc_area, coverage = 0;
-
-            i830_crtc_box(crtc, &crtc_box);
-            crtc_area = i830_box_area(&crtc_box);
-            pbox = REGION_RECTS(clipBoxes);
-            nbox = REGION_NUM_RECTS(clipBoxes);
-            
-            while (nbox--) {
-                coverage += i830_box_area(pbox);
-                pbox++;
-            }
-
-            if ((coverage << 2) < crtc_area)
-                sync = FALSE;
         }
 
         if (sync) {
commit bc3312fd7c03d09a231dfebfe390fe668ad15d1e
Author: Carl Worth <cworth at cworth.org>
Date:   Mon Apr 6 11:16:40 2009 -0700

    Use WAIT_FOR_SCAN_LINE instead of WAIT_FOR_VBLANK
    
    Either way, the goal is tear-free video playing. But waiting for
    a scan-line window not only has the advantage of being cheaper
    for small windows, but also avoids hanging the GPU in the case
    of the pipe getting turned off, (by screensaver, for example),
    while a batch is waiting for a VBLANK that will never occur.
    
    This fixes that GPU hang.

diff --git a/src/i810_reg.h b/src/i810_reg.h
index bc462fa..102097c 100644
--- a/src/i810_reg.h
+++ b/src/i810_reg.h
@@ -2436,12 +2436,19 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define MI_OVERLAY_FLIP_OFF		(2<<21)
 
 /* Wait for Events */
-#define MI_WAIT_FOR_EVENT		(0x03<<23)
-#define MI_WAIT_FOR_PIPEB_SVBLANK	(1<<18)
-#define MI_WAIT_FOR_PIPEA_SVBLANK	(1<<17)
-#define MI_WAIT_FOR_OVERLAY_FLIP	(1<<16)
-#define MI_WAIT_FOR_PIPEB_VBLANK	(1<<7)
-#define MI_WAIT_FOR_PIPEA_VBLANK	(1<<3)
+#define MI_WAIT_FOR_EVENT			(0x03<<23)
+#define MI_WAIT_FOR_PIPEB_SVBLANK		(1<<18)
+#define MI_WAIT_FOR_PIPEA_SVBLANK		(1<<17)
+#define MI_WAIT_FOR_OVERLAY_FLIP		(1<<16)
+#define MI_WAIT_FOR_PIPEB_VBLANK		(1<<7)
+#define MI_WAIT_FOR_PIPEB_SCAN_LINE_WINDOW	(1<<5)
+#define MI_WAIT_FOR_PIPEA_VBLANK		(1<<3)
+#define MI_WAIT_FOR_PIPEA_SCAN_LINE_WINDOW	(1<<2)
+
+/* Set the scan line for MI_WAIT_FOR_PIPE?_SCAN_LINE_WINDOW */
+#define MI_LOAD_SCAN_LINES_INCL			(0x12<<23)
+#define MI_LOAD_SCAN_LINES_DISPLAY_PIPEA	(0)
+#define MI_LOAD_SCAN_LINES_DISPLAY_PIPEB	(0x1<<20)
 
 /* Flush */
 #define MI_FLUSH			(0x04<<23)
diff --git a/src/i830_video.c b/src/i830_video.c
index 3f3aaac..3dde5b4 100644
--- a/src/i830_video.c
+++ b/src/i830_video.c
@@ -2533,24 +2533,28 @@ I830PutImage(ScrnInfoPtr pScrn,
         }
 
         if (sync) {
-            I830CrtcPrivatePtr intel_crtc = crtc->driver_private;
-            int event;
-
-            if (IS_I965G(pI830)) {
-                if (intel_crtc->pipe == 0)
-                    event = MI_WAIT_FOR_PIPEA_SVBLANK;
-                else
-                    event = MI_WAIT_FOR_PIPEB_SVBLANK;
-            } else {
-                if (intel_crtc->pipe == 0)
-                    event = MI_WAIT_FOR_PIPEA_VBLANK;
-                else
-                    event = MI_WAIT_FOR_PIPEB_VBLANK;
-            }
+	    BoxPtr box;
+            int event, pipe;
+	    I830CrtcPrivatePtr intel_crtc = crtc->driver_private;
+
+	    if (intel_crtc->pipe == 0) {
+		event = MI_WAIT_FOR_PIPEA_SCAN_LINE_WINDOW;
+		pipe = MI_LOAD_SCAN_LINES_DISPLAY_PIPEA;
+	    } else {
+		event = MI_WAIT_FOR_PIPEB_SCAN_LINE_WINDOW;
+		pipe = MI_LOAD_SCAN_LINES_DISPLAY_PIPEB;
+	    }
+
+	    box = REGION_EXTENTS(unused, clipBoxes);
 
-            BEGIN_BATCH(2);
+            BEGIN_BATCH(5);
+	    /* The documentation says that the LOAD_SCAN_LINES command
+	     * always comes in pairs. Don't ask me why. */
+	    OUT_BATCH(MI_LOAD_SCAN_LINES_INCL | pipe);
+	    OUT_BATCH((box->y1 << 16) | box->y2);
+	    OUT_BATCH(MI_LOAD_SCAN_LINES_INCL | pipe);
+	    OUT_BATCH((box->y1 << 16) | box->y2);
             OUT_BATCH(MI_WAIT_FOR_EVENT | event);
-            OUT_BATCH(MI_NOOP);
             ADVANCE_BATCH();
         }
 
commit 6cd914ef315036ce8e91c7b6492994353e8ed2d8
Author: Jesse Barnes <jbarnes at virtuousgeek.org>
Date:   Fri Apr 3 11:15:18 2009 -0700

    Fix offset in begin_gtt_access case
    
    Don't use bo->virtual in the begin_gtt_access case, use the framebuffer
    mapping and bo offset instead.
    
    Reviewed-by: Eric Anholt <eric at anholt.net>
    Signed-off-by: Jesse Barnes <jbarnes at virtuousgeek.org>

diff --git a/src/i830_driver.c b/src/i830_driver.c
index d7ee615..32ca6c9 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -846,11 +846,12 @@ i830_update_front_offset(ScrnInfoPtr pScrn)
 	      if (drm_intel_gem_bo_map_gtt(bo))
 		  xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "%s: bo map failed\n",
 			     __FUNCTION__);
+	      data = bo->virtual;
 	  } else {
 	      /* Will already be pinned by bind_all_memory in this case */
 	      drm_intel_gem_bo_start_gtt_access(bo, 1);
+	      data = pI830->FbBase + bo->offset;
 	  }
-	  data = bo->virtual;
       }
    }
    if (!pScreen->ModifyPixmapHeader(pScreen->GetScreenPixmap(pScreen),
diff --git a/src/i830_exa.c b/src/i830_exa.c
index fc4e66c..39011bc 100644
--- a/src/i830_exa.c
+++ b/src/i830_exa.c
@@ -867,12 +867,13 @@ i830_uxa_prepare_access (PixmapPtr pixmap, uxa_access_t access)
 			   __FUNCTION__);
 		return FALSE;
 	    }
+	    pixmap->devPrivate.ptr = bo->virtual;
 	} else { /* or not... */
 	    if (drm_intel_bo_pin(bo, 4096) != 0)
 		return FALSE;
 	    drm_intel_gem_bo_start_gtt_access(bo, access == UXA_ACCESS_RW);
+	    pixmap->devPrivate.ptr = i830->FbBase + bo->offset;
 	}
-	pixmap->devPrivate.ptr = bo->virtual;
     }
     return TRUE;
 }
commit fad714c40078d22fff82dc0692a344f66ddf9680
Author: Zhenyu Wang <zhenyu.z.wang at intel.com>
Date:   Wed Apr 1 10:11:35 2009 +0800

    SDVO: fix output flag dumping for unknown type
    
    Found by Hugo Jacques <hugo.jacques at verint.com>

diff --git a/src/i830_sdvo.c b/src/i830_sdvo.c
index 79d49d9..a7b5171 100644
--- a/src/i830_sdvo.c
+++ b/src/i830_sdvo.c
@@ -1605,7 +1605,7 @@ i830_sdvo_output_setup (xf86OutputPtr output, uint16_t flag)
 	xf86DrvMsg(intel_output->pI2CBus->scrnIndex, X_WARNING,
 		   "%s: Unknown SDVO output type (0x%02x%02x)\n",
 		   SDVO_NAME(dev_priv),
-		   bytes[0], bytes[1]);
+		   bytes[1], bytes[0]);
 	name_prefix="Unknown";
     }
 
commit 00de1757dd5776962bdd4c8968181878c2ebf4c9
Author: Hugo Jacques <hugo.jacques at verint.com>
Date:   Wed Apr 1 10:10:05 2009 +0800

    SDVO: add composite TV out support

diff --git a/src/i830_sdvo.c b/src/i830_sdvo.c
index 254b866..79d49d9 100644
--- a/src/i830_sdvo.c
+++ b/src/i830_sdvo.c
@@ -1570,6 +1570,14 @@ i830_sdvo_output_setup (xf86OutputPtr output, uint16_t flag)
 	dev_priv->is_tv = TRUE;
 	intel_output->needs_tv_clock = TRUE;
     }
+    else if (flag & SDVO_OUTPUT_CVBS0)
+    {
+	dev_priv->controlled_output = SDVO_OUTPUT_CVBS0;
+	output->subpixel_order = SubPixelHorizontalRGB; /* XXX */
+	name_prefix="TV";
+	dev_priv->is_tv = TRUE;
+	intel_output->needs_tv_clock = TRUE;
+    }
     else if (flag & SDVO_OUTPUT_RGB0)
     {
 	dev_priv->controlled_output = SDVO_OUTPUT_RGB0;
commit 087f72e1f5d7d11b8795ba80a842874f5a9bb01d
Author: Jesse Barnes <jbarnes at virtuousgeek.org>
Date:   Tue Mar 31 07:50:10 2009 -0700

    Match GTT unmap with map in KMS rotation case
    
    Missed this when the GTT unmap call was added.  If we don't do this we
    trigger an assertion in libdrm, since the buffer has never been mapped
    normally.
    
    Fixes bug #20943.
    
    Signed-off-by: Jesse Barnes <jbarnes at virtuousgeek.org>

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 0cbcde7..7b97a64 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -382,7 +382,7 @@ drmmode_crtc_shadow_destroy(xf86CrtcPtr crtc, PixmapPtr rotate_pixmap, void *dat
 		 * unbound. */
 		drmModeRmFB(drmmode->fd, drmmode_crtc->rotate_fb_id);
 		drmmode_crtc->rotate_fb_id = 0;
-		drm_intel_bo_unmap(drmmode_crtc->rotate_bo);
+		drm_intel_gem_bo_unmap_gtt(drmmode_crtc->rotate_bo);
 		dri_bo_unreference(drmmode_crtc->rotate_bo);
 		drmmode_crtc->rotate_bo = NULL;
 	}
commit 4f046af760b92c07f59664359453933fb5358e3d
Author: Zhenyu Wang <zhenyu.z.wang at intel.com>
Date:   Tue Mar 31 13:49:44 2009 +0800

    Disable LVDS detect methods
    
    Both methods ACPI lid and SWF bit have issues in LVDS detect from
    wider testing. Fallback to origin code.

diff --git a/src/i830_lvds.c b/src/i830_lvds.c
index 7569e99..7fc0bce 100644
--- a/src/i830_lvds.c
+++ b/src/i830_lvds.c
@@ -881,6 +881,13 @@ i830_lvds_mode_set(xf86OutputPtr output, DisplayModePtr mode,
 static xf86OutputStatus
 i830_lvds_detect(xf86OutputPtr output)
 {
+    /* Fallback to origin, mark LVDS always connected.
+     * From wider tests, we have seen both broken cases with
+     * ACPI lid and SWF bit. So disable them for now until we
+     * get a reliable way for LVDS detect.
+     */
+    return XF86OutputStatusConnected;
+
     enum lid_status lid;
 
     lid = i830_lvds_acpi_lid_open(output);
commit e964d4e53af3a47de6d09c884be1cc0044d03bea
Author: Albert Damen <albrt at gmx.net>
Date:   Mon Mar 30 11:38:02 2009 -0700

    Non-GEM allocations incorrectly force TILE_NONE (bug 20797)
    
    With -intel 2.6.3 performance was very bad when using a non gem enabled kernel
    (2.6.27) and EXA. For example sauerbraten ran with 4 fps and screensaver GLBlur
    with 1 fps. With -intel 2.6.1 performance was good using the same kernel.
    
    Git bisecting led me to commit f1ed73c1ef3e3daa9f695194dcc813167cbcb53d (in 2.6
    branch) "Make i830_allocate_memory take tiling parameters" as first bad commit.
    
    Using gdb I found tiling was set exactly the same in 2.6.3 as in 2.6.1, so that
    was good (TILE_XMAJOR for front, back and depth buffers).
    Looking further I found the line mem->tiling = TILE_NONE; (line 961 in
    src/i830_memory.c) at the end of i830_allocate_memory suspicious, as
    mem->tiling now already gets set via i830_allocate_aperture and some buffers do
    have tiling. Removing that line indeed fixed the performance issue. Now
    sauerbraten runs with 30+ fps and GLBlur runs smoothly.

diff --git a/src/i830_memory.c b/src/i830_memory.c
index 052d906..e3314c5 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -958,8 +958,6 @@ i830_allocate_memory(ScrnInfoPtr pScrn, const char *name,
 	}
     }
 
-    mem->tiling = TILE_NONE;
-
     return mem;
 }
 
commit 51cf8a453c2bc2e8604bfc41a649e971c1ba5026
Author: Jesse Barnes <jbarnes at virtuousgeek.org>
Date:   Mon Mar 30 11:27:56 2009 -0700

    Require libdrm 2.4.6 for GTT unmap support
    
    Need the new functions available.

diff --git a/configure.ac b/configure.ac
index 88059bf..ae134af 100644
--- a/configure.ac
+++ b/configure.ac
@@ -211,7 +211,7 @@ if test "x$GCC" = "xyes"; then
 	-Wnested-externs -fno-strict-aliasing"
 fi
 
-PKG_CHECK_MODULES(DRM, [libdrm >= 2.4.5])
+PKG_CHECK_MODULES(DRM, [libdrm >= 2.4.6])
 AM_CONDITIONAL(DRI, test x$DRI = xyes)
 if test "$DRI" = yes; then
         PKG_CHECK_MODULES(DRI, [xf86driproto glproto])
commit 8dabcc40747bfd478f296728741240241698f165
Author: Jesse Barnes <jbarnes at virtuousgeek.org>
Date:   Mon Mar 30 09:53:40 2009 -0700

    Tiling fixes, third set
    
    Hopefully this concludes the fixes necessary to deal with the various
    combinations of kernel and user level tiling.  We have several cases to
    handle:
      1) KMS (kernel handles all tiling)
      2) UMS w/memory management + kexec fencing (kernel handles all tiling)
      3) UMS w/memory mangement but no kexec fencing (userland handles tiling)
      4) UMS w/o memory management (userland handles tiling)
    
    For cases (1) & (2) we can use GTT mapping, which will give us good
    performance and take care of allocating fence registers as needed.  It's
    important *not* to have userland set up fence regs in this case, since
    the kernel will be using all of them.
    
    For case (3), we use the begin/end GTT map functions provided by libdrm,
    in combination with pinning and fence register setup in i830_memory.c to
    deal with tiled surfaces.  This also gives us good performance and
    correctness.
    
    For case (4) we use the old style virtual mapping + offset for dealing
    with surfaces; note that UXA doesn't seem to work in this configuration
    regardless of these fixes.
    
    Fixes bug #20803.
    
    Reviewed-by: Eric Anholt <eric at anholt.net>
    Signed-off-by: Jesse Barnes <jbarnes at virtuousgeek.org>

diff --git a/src/i830_driver.c b/src/i830_driver.c
index 7502d30..d7ee615 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -823,22 +823,40 @@ i830_update_front_offset(ScrnInfoPtr pScrn)
    ScreenPtr pScreen = pScrn->pScreen;
    I830Ptr pI830 = I830PTR(pScrn);
    int pitch = pScrn->displayWidth * pI830->cpp;
+   pointer data = NULL;
 
    /* Update buffer locations, which may have changed as a result of
     * i830_bind_all_memory().
     */
    pScrn->fbOffset = pI830->front_buffer->offset;
 
+   if (pI830->starting || pI830->accel == ACCEL_UXA)
+       return;
+
    /* If we are still in ScreenInit, there is no screen pixmap to be updated
     * yet.  We'll fix it up at CreateScreenResources.
     */
-   if (!pI830->starting && pI830->accel != ACCEL_UXA) {
-      if (!pScreen->ModifyPixmapHeader(pScreen->GetScreenPixmap(pScreen),
+   if (!pI830->memory_manager) {
+       data = pI830->FbBase + pScrn->fbOffset; /* default to legacy */
+   } else {
+      dri_bo *bo = pI830->front_buffer->bo;
+
+      if (bo) {
+	  if (pI830->kernel_exec_fencing) {
+	      if (drm_intel_gem_bo_map_gtt(bo))
+		  xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "%s: bo map failed\n",
+			     __FUNCTION__);
+	  } else {
+	      /* Will already be pinned by bind_all_memory in this case */
+	      drm_intel_gem_bo_start_gtt_access(bo, 1);
+	  }
+	  data = bo->virtual;
+      }
+   }
+   if (!pScreen->ModifyPixmapHeader(pScreen->GetScreenPixmap(pScreen),
 				       pScrn->virtualX, pScrn->virtualY, -1, -1,
-				       pitch, (pointer)(pI830->FbBase +
-							pScrn->fbOffset)))
+				       pitch, data))
        FatalError("Couldn't adjust screen pixmap\n");
-   }
 }
 
 /**
diff --git a/src/i830_exa.c b/src/i830_exa.c
index 0a22486..fc4e66c 100644
--- a/src/i830_exa.c
+++ b/src/i830_exa.c
@@ -37,6 +37,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "i810_reg.h"
 #include "i915_drm.h"
 #include <string.h>
+#include <sys/mman.h>
 
 #define ALWAYS_SYNC		0
 #define ALWAYS_FLUSH		0
@@ -837,8 +838,6 @@ i830_uxa_set_pixmap_bo (PixmapPtr pixmap, dri_bo *bo)
 static Bool
 i830_uxa_prepare_access (PixmapPtr pixmap, uxa_access_t access)
 {
-    ScrnInfoPtr pScrn = xf86Screens[pixmap->drawable.pScreen->myNum];
-    I830Ptr pI830 = I830PTR(pScrn);
     dri_bo *bo = i830_get_pixmap_bo (pixmap);
 
     if (bo) {
@@ -853,16 +852,27 @@ i830_uxa_prepare_access (PixmapPtr pixmap, uxa_access_t access)
 	    i830->need_sync = FALSE;
 	}
 
-	if (pScrn->vtSema && !pI830->use_drm_mode && pI830->memory_manager) {
-	    if (drm_intel_bo_pin(bo, 4096) != 0)
-		return FALSE;
-	    drm_intel_gem_bo_start_gtt_access(bo, access == UXA_ACCESS_RW);
-	    pixmap->devPrivate.ptr = pI830->FbBase + bo->offset;
-	} else {
+	/* No VT sema or GEM?  No GTT mapping. */
+	if (!scrn->vtSema || !i830->memory_manager) {
 	    if (dri_bo_map(bo, access == UXA_ACCESS_RW) != 0)
 		return FALSE;
 	    pixmap->devPrivate.ptr = bo->virtual;
+	    return TRUE;
+	}
+
+	/* Kernel manages fences at GTT map/fault time */
+	if (i830->kernel_exec_fencing) {
+	    if (drm_intel_gem_bo_map_gtt(bo)) {
+		xf86DrvMsg(scrn->scrnIndex, X_WARNING, "%s: bo map failed\n",
+			   __FUNCTION__);
+		return FALSE;
+	    }
+	} else { /* or not... */
+	    if (drm_intel_bo_pin(bo, 4096) != 0)
+		return FALSE;
+	    drm_intel_gem_bo_start_gtt_access(bo, access == UXA_ACCESS_RW);
 	}
+	pixmap->devPrivate.ptr = bo->virtual;
     }
     return TRUE;
 }
@@ -870,8 +880,6 @@ i830_uxa_prepare_access (PixmapPtr pixmap, uxa_access_t access)
 static void
 i830_uxa_finish_access (PixmapPtr pixmap)
 {
-    ScrnInfoPtr pScrn = xf86Screens[pixmap->drawable.pScreen->myNum];
-    I830Ptr pI830 = I830PTR(pScrn);
     dri_bo *bo = i830_get_pixmap_bo (pixmap);
 
     if (bo) {
@@ -879,14 +887,20 @@ i830_uxa_finish_access (PixmapPtr pixmap)
 	ScrnInfoPtr scrn = xf86Screens[screen->myNum];
 	I830Ptr i830 = I830PTR(scrn);
 
-	if (pScrn->vtSema && !pI830->use_drm_mode && pI830->memory_manager)
-	    drm_intel_bo_unpin(bo);
-	else
+	if (bo == i830->front_buffer->bo)
+	    i830->need_flush = TRUE;
+
+	if (!scrn->vtSema || !i830->memory_manager) {
 	    dri_bo_unmap(bo);
+	    pixmap->devPrivate.ptr = NULL;
+	    return;
+	}
 
+	if (i830->kernel_exec_fencing)
+	    drm_intel_gem_bo_unmap_gtt(bo);
+	else
+	    drm_intel_bo_unpin(bo);
 	pixmap->devPrivate.ptr = NULL;
-	if (bo == i830->front_buffer->bo)
-	    i830->need_flush = TRUE;
     }
 }
 
commit 375b2e40fcb17e94538a75392950e2533c1bb031
Author: Zhenyu Wang <zhenyu.z.wang at intel.com>
Date:   Wed Mar 25 11:13:52 2009 +0800

    Disable LVDS config parsing from VBT for now
    
    As wider tests showed that this doesn't work for all VBIOS, so
    disable it for now and reenable it after we get reliable method.

diff --git a/src/i830_bios.c b/src/i830_bios.c
index 9b13bf4..4f2355d 100644
--- a/src/i830_bios.c
+++ b/src/i830_bios.c
@@ -181,6 +181,12 @@ parse_driver_feature(I830Ptr pI830, struct bdb_header *bdb)
     if (!IS_I9XX(pI830))
 	return;
 
+    /* XXX Disable this parsing, as it looks doesn't work for all
+       VBIOS. Reenable it if we could find out the reliable VBT parsing
+       for LVDS config later. */
+    if (1)
+	return;
+
     feature = find_section(bdb, BDB_DRIVER_FEATURES);
     if (!feature)
 	return;
commit 69c84f2c8204771b68f40ed64e64657237b54546
Author: Zhenyu Wang <zhenyu.z.wang at intel.com>
Date:   Thu Mar 26 13:52:05 2009 +0800

    gitignore intel_lid

diff --git a/src/reg_dumper/.gitignore b/src/reg_dumper/.gitignore
index 5aac542..60a9a4f 100644
--- a/src/reg_dumper/.gitignore
+++ b/src/reg_dumper/.gitignore
@@ -4,3 +4,4 @@ intel_idle
 intel_reg_dumper
 intel_stepping
 intel_statuspage
+intel_lid
commit b5b377806422c9538fa9f846819ad253c1a50846
Author: Ma, Ling <ling.ma at intel.com>
Date:   Wed Mar 25 14:39:46 2009 +0800

    disable center mode for 965GM and G4X platform
    
    When disabling VGA mode, usually we don't need to touch VGA center mode.
    However because of hardware reason, for Cresline, Cantiga & Eaglelake platform,
    we have to disable center mode as well. The patch fixed bug- TV Out strobing regression,
    reported by Robert Lowery in intel-gfx at lists.freedesktop.org mailing list.
    
    Signed-off-by: Ma Ling <ling.ma at intel.com>

diff --git a/src/i830_display.c b/src/i830_display.c
index a44143f..dd1310f 100644
--- a/src/i830_display.c
+++ b/src/i830_display.c
@@ -1113,6 +1113,9 @@ i830_disable_vga_plane (xf86CrtcPtr crtc)
     sr01 = INREG8(SRX + 1);
     OUTREG8(SRX + 1, sr01 | (1 << 5));
     usleep(30);
+    /* disable center mode on 965GM and G4X platform */
+    if (IS_I965GM(pI830) || IS_G4X(pI830))
+        vgacntrl &= ~(3 << 24);
 
     vgacntrl |= VGA_DISP_DISABLE;
 


More information about the xorg-commit mailing list