[Intel-gfx] [PATCH] XvMC: enable XvMC on DRI2

Xiang, Haihao haihao.xiang at intel.com
Mon May 4 09:15:34 CEST 2009


---
 configure.ac          |   14 +-
 src/i830_driver.c     |    5 +-
 src/i830_hwmc.c       |   32 ++-
 src/i830_hwmc.h       |    1 -
 src/i915_hwmc.c       |    6 +-
 src/i915_hwmc.h       |    1 -
 src/i915_video.c      |   23 ++-
 src/i965_hwmc.c       |    2 -
 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 |  148 +++++--------
 src/xvmc/intel_xvmc.h |   10 -
 src/xvmc/xf86dri.c    |  565 -------------------------------------------------
 src/xvmc/xf86dri.h    |  117 ----------
 src/xvmc/xf86dristr.h |  389 ----------------------------------
 18 files changed, 482 insertions(+), 1226 deletions(-)
 create mode 100644 src/xvmc/dri2.c
 create mode 100644 src/xvmc/dri2.h
 delete mode 100644 src/xvmc/xf86dri.c
 delete mode 100644 src/xvmc/xf86dri.h
 delete mode 100644 src/xvmc/xf86dristr.h

diff --git a/configure.ac b/configure.ac
index 12fec79..e17d8ea 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])
 
-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)
@@ -142,12 +142,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 1887a51..a4f8716 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -2756,8 +2756,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 ecefb5b..10e3318 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;
 
@@ -83,6 +77,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");
@@ -93,14 +90,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;
@@ -117,9 +123,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 41f6441..2564151 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 d9b4f0d..b60b056 100644
--- a/src/i965_hwmc.c
+++ b/src/i965_hwmc.c
@@ -111,7 +111,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));
@@ -130,7 +129,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 a376eb7..3d0b506 100644
--- a/src/xvmc/Makefile.am
+++ b/src/xvmc/Makefile.am
@@ -21,9 +21,8 @@ libIntelXvMC_la_SOURCES = intel_xvmc.c \
         i965_xvmc.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 4b73caa..7910555 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)
@@ -354,7 +340,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;
@@ -367,70 +352,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.
@@ -439,12 +414,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;
@@ -473,7 +449,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);
@@ -483,18 +458,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 9ef2121..a21bf70 100644
--- a/src/xvmc/intel_xvmc.h
+++ b/src/xvmc/intel_xvmc.h
@@ -51,9 +51,6 @@
 #include <X11/extensions/Xvlib.h>
 #include <X11/extensions/XvMC.h>
 #include <X11/extensions/XvMClib.h>
-#include <drm_sarea.h>
-
-#include "xf86dri.h"
 
 #include "intel_batchbuffer.h"
 
@@ -129,11 +126,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;
@@ -155,9 +147,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_ */
-- 
1.5.6.3




More information about the Intel-gfx mailing list