>From 6386a9df53acc7da88d30a85c49786caa28e4d29 Mon Sep 17 00:00:00 2001

Remove support for the original incarnation of DRI2.  This version has
since been abandoned and will never ship.  This eliminates a build
dependency on a component that only exists in Fedora 9 and in now-dead
up-stream development trees.

I also recommend that we spin a Mesa 7.1.1 release with this patch.

Signed-off-by: Ian Romanick <[EMAIL PROTECTED]>
---
 configs/autoconf.in     |    1 -
 configure.ac            |    2 -
 src/glx/x11/Makefile    |    5 +-
 src/glx/x11/dri2.c      |  252 --------------------------------
 src/glx/x11/dri2.h      |   53 -------
 src/glx/x11/dri2_glx.c  |  371 -----------------------------------------------
 src/glx/x11/glxclient.h |    2 -
 src/glx/x11/glxext.c    |    8 -
 8 files changed, 1 insertions(+), 693 deletions(-)
 delete mode 100644 src/glx/x11/dri2.c
 delete mode 100644 src/glx/x11/dri2.h
 delete mode 100644 src/glx/x11/dri2_glx.c

diff --git a/configs/autoconf.in b/configs/autoconf.in
index a3eaed5..b1c9b64 100644
--- a/configs/autoconf.in
+++ b/configs/autoconf.in
@@ -86,7 +86,6 @@ APP_LIB_DEPS = $(EXTRA_LIB_PATH) @APP_LIB_DEPS@
 DRI_LIB_DEPS = $(EXTRA_LIB_PATH) @DRI_LIB_DEPS@
 LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
 LIBDRM_LIB = @LIBDRM_LIBS@
-DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
 EXPAT_INCLUDES = @EXPAT_INCLUDES@
 
 # Autoconf directories
diff --git a/configure.ac b/configure.ac
index c87dce6..5eb25ea 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,6 @@ AC_CANONICAL_HOST
 
 dnl Versions for external dependencies
 LIBDRM_REQUIRED=2.3.1
-DRI2PROTO_REQUIRED=1.1
 
 dnl Check for progs
 AC_PROG_CPP
@@ -531,7 +530,6 @@ dri)
 
     # Check for libdrm
     PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED])
-    PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
 
     # find the DRI deps for libGL
     if test "$x11_pkgconfig" = yes; then
diff --git a/src/glx/x11/Makefile b/src/glx/x11/Makefile
index 5d9c61c..1b3f9d9 100644
--- a/src/glx/x11/Makefile
+++ b/src/glx/x11/Makefile
@@ -35,9 +35,7 @@ SOURCES = \
          dri_common.c \
          dri_glx.c \
          XF86dri.c \
-         glxhash.c \
-         dri2_glx.c \
-         dri2.c
+         glxhash.c
 
 include $(TOP)/src/mesa/sources
 
@@ -53,7 +51,6 @@ INCLUDES = -I. \
        -I$(TOP)/src/mesa/main \
        -I$(TOP)/src/mesa/glapi \
        $(LIBDRM_CFLAGS) \
-       $(DRI2PROTO_CFLAGS) \
        $(X11_INCLUDES)
 
 
diff --git a/src/glx/x11/dri2.c b/src/glx/x11/dri2.c
deleted file mode 100644
index e7044ab..0000000
--- a/src/glx/x11/dri2.c
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
- * 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 ([EMAIL PROTECTED])
- */
-
-
-#define NEED_REPLIES
-#include <X11/Xlibint.h>
-#include <X11/extensions/Xext.h>
-#include <X11/extensions/extutil.h>
-#include <X11/extensions/dri2proto.h>
-#include "glheader.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, int screen,
-                char **driverName, char **busId, unsigned int *sareaHandle)
-{
-    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->screen = screen;
-    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
-       UnlockDisplay(dpy);
-       SyncHandle();
-       return False;
-    }
-
-    *sareaHandle = rep.sareaHandle;
-
-    *driverName = Xmalloc(rep.driverNameLength + 1);
-    if (*driverName == NULL) {
-       _XEatData(dpy, 
-                 ((rep.driverNameLength + 3) & ~3) +
-                 ((rep.busIdLength + 3) & ~3));
-       UnlockDisplay(dpy);
-       SyncHandle();
-       return False;
-    }
-    _XReadPad(dpy, *driverName, rep.driverNameLength);
-    (*driverName)[rep.driverNameLength] = '\0';
-
-    *busId = Xmalloc(rep.busIdLength + 1);
-    if (*busId == NULL) {
-       Xfree(*driverName);
-       _XEatData(dpy, ((rep.busIdLength + 3) & ~3));
-       UnlockDisplay(dpy);
-       SyncHandle();
-       return False;
-    }
-    _XReadPad(dpy, *busId, rep.busIdLength);
-    (*busId)[rep.busIdLength] = '\0';
-
-    UnlockDisplay(dpy);
-    SyncHandle();
-
-    return rep.sareaHandle != 0;
-}
-
-Bool DRI2AuthConnection(Display *dpy, int screen, drm_magic_t magic)
-{
-    XExtDisplayInfo *info = DRI2FindDisplay(dpy);
-    xDRI2AuthConnectionReq *req;
-    xDRI2AuthConnectionReply rep;
-
-    XextCheckExtension (dpy, info, dri2ExtensionName, False);
-
-    LockDisplay(dpy);
-    GetReq(DRI2AuthConnection, req);
-    req->reqType = info->codes->major_opcode;
-    req->dri2ReqType = X_DRI2AuthConnection;
-    req->screen = screen;
-    req->magic = magic;
-    rep.authenticated = 0;
-    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
-       UnlockDisplay(dpy);
-       SyncHandle();
-       return False;
-    }
-    UnlockDisplay(dpy);
-    SyncHandle();
-
-    return rep.authenticated;
-}
-
-Bool DRI2CreateDrawable(Display *dpy, XID drawable,
-                       unsigned int *handle, unsigned int *head)
-{
-    XExtDisplayInfo *info = DRI2FindDisplay(dpy);
-    xDRI2CreateDrawableReply rep;
-    xDRI2CreateDrawableReq *req;
-
-    XextCheckExtension (dpy, info, dri2ExtensionName, False);
-
-    LockDisplay(dpy);
-    GetReq(DRI2CreateDrawable, req);
-    req->reqType = info->codes->major_opcode;
-    req->dri2ReqType = X_DRI2CreateDrawable;
-    req->drawable = drawable;
-    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
-       UnlockDisplay(dpy);
-       SyncHandle();
-       return False;
-    }
-    UnlockDisplay(dpy);
-    SyncHandle();
-
-    *handle = rep.handle;
-    *head = rep.head;
-
-    return True;
-}
-
-void DRI2DestroyDrawable(Display *dpy, XID drawable)
-{
-    XExtDisplayInfo *info = DRI2FindDisplay(dpy);
-    xDRI2DestroyDrawableReq *req;
-
-    XextSimpleCheckExtension (dpy, info, dri2ExtensionName);
-
-    XSync(dpy, GL_FALSE);
-
-    LockDisplay(dpy);
-    GetReq(DRI2DestroyDrawable, req);
-    req->reqType = info->codes->major_opcode;
-    req->dri2ReqType = X_DRI2DestroyDrawable;
-    req->drawable = drawable;
-    UnlockDisplay(dpy);
-    SyncHandle();
-}
-
-Bool DRI2ReemitDrawableInfo(Display *dpy, XID drawable, unsigned int *head)
-{
-    XExtDisplayInfo *info = DRI2FindDisplay(dpy);
-    xDRI2ReemitDrawableInfoReply rep;
-    xDRI2ReemitDrawableInfoReq *req;
-
-    XextCheckExtension (dpy, info, dri2ExtensionName, False);
-
-    LockDisplay(dpy);
-    GetReq(DRI2ReemitDrawableInfo, req);
-    req->reqType = info->codes->major_opcode;
-    req->dri2ReqType = X_DRI2ReemitDrawableInfo;
-    req->drawable = drawable;
-    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
-       UnlockDisplay(dpy);
-       SyncHandle();
-       return False;
-    }
-    UnlockDisplay(dpy);
-    SyncHandle();
-
-    *head = rep.head;
-
-    return True;
-}
diff --git a/src/glx/x11/dri2.h b/src/glx/x11/dri2.h
deleted file mode 100644
index 1dfd044..0000000
--- a/src/glx/x11/dri2.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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 ([EMAIL PROTECTED])
- */
-
-#ifndef _DRI2_H_
-#define _DRI2_H_
-
-extern Bool
-DRI2QueryExtension(Display *display, int *eventBase, int *errorBase);
-extern Bool
-DRI2QueryVersion(Display *display, int *major, int *minor);
-extern Bool
-DRI2Connect(Display *display, int screen,
-           char **driverName, char **busId, unsigned int *sareaHandle);
-extern Bool
-DRI2AuthConnection(Display *display, int screen, drm_magic_t magic);
-extern Bool
-DRI2CreateDrawable(Display *display, XID drawable,
-                  unsigned int *handle, unsigned int *head);
-extern void
-DRI2DestroyDrawable(Display *display, XID handle);
-extern Bool
-DRI2ReemitDrawableInfo(Display *dpy, XID handle, unsigned int *head);
-
-#endif
diff --git a/src/glx/x11/dri2_glx.c b/src/glx/x11/dri2_glx.c
deleted file mode 100644
index 0be65bc..0000000
--- a/src/glx/x11/dri2_glx.c
+++ /dev/null
@@ -1,371 +0,0 @@
-/*
- * 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 ([EMAIL PROTECTED])
- */
-
-#ifdef GLX_DIRECT_RENDERING
-
-#include <X11/Xlib.h>
-#include <X11/extensions/Xfixes.h>
-#include <X11/extensions/Xdamage.h>
-#include "glheader.h"
-#include "glxclient.h"
-#include "glcontextmodes.h"
-#include "xf86dri.h"
-#include "sarea.h"
-#include <dlfcn.h>
-#include <sys/types.h>
-#include <sys/mman.h>
-#include "xf86drm.h"
-#include "dri2.h"
-#include "dri_common.h"
-
-typedef struct __GLXDRIdisplayPrivateRec __GLXDRIdisplayPrivate;
-typedef struct __GLXDRIcontextPrivateRec __GLXDRIcontextPrivate;
-
-struct __GLXDRIdisplayPrivateRec {
-    __GLXDRIdisplay base;
-
-    /*
-    ** XFree86-DRI version information
-    */
-    int driMajor;
-    int driMinor;
-    int driPatch;
-};
-
-struct __GLXDRIcontextPrivateRec {
-    __GLXDRIcontext base;
-    __DRIcontext *driContext;
-    __GLXscreenConfigs *psc;
-};
-
-static void dri2DestroyContext(__GLXDRIcontext *context,
-                             __GLXscreenConfigs *psc, Display *dpy)
-{
-    __GLXDRIcontextPrivate *pcp = (__GLXDRIcontextPrivate *) context;
-    const __DRIcoreExtension *core = pcp->psc->core;
-
-    (*core->destroyContext)(pcp->driContext);
-
-    Xfree(pcp);
-}
-
-static Bool dri2BindContext(__GLXDRIcontext *context,
-                          __GLXDRIdrawable *draw, __GLXDRIdrawable *read)
-{
-    __GLXDRIcontextPrivate *pcp = (__GLXDRIcontextPrivate *) context;
-    const __DRIcoreExtension *core = pcp->psc->core;
-
-    return (*core->bindContext)(pcp->driContext,
-                               draw->driDrawable,
-                               read->driDrawable);
-}
-
-static void dri2UnbindContext(__GLXDRIcontext *context)
-{
-    __GLXDRIcontextPrivate *pcp = (__GLXDRIcontextPrivate *) context;
-    const __DRIcoreExtension *core = pcp->psc->core;
-
-    (*core->unbindContext)(pcp->driContext);
-}
-
-static __GLXDRIcontext *dri2CreateContext(__GLXscreenConfigs *psc,
-                                        const __GLcontextModes *mode,
-                                        GLXContext gc,
-                                        GLXContext shareList, int renderType)
-{
-    __GLXDRIcontextPrivate *pcp, *pcp_shared;
-    __GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) mode;
-    const __DRIcoreExtension *core = psc->core;
-    __DRIcontext *shared = NULL;
-
-    if (shareList) {
-       pcp_shared = (__GLXDRIcontextPrivate *) shareList->driContext;
-       shared = pcp_shared->driContext;
-    }
-
-    pcp = Xmalloc(sizeof *pcp);
-    if (pcp == NULL)
-       return NULL;
-
-    pcp->psc = psc;
-    pcp->driContext = 
-       (*core->createNewContext)(psc->__driScreen,
-                                 config->driConfig, shared, pcp);
-    gc->__driContext = pcp->driContext;
-
-    if (pcp->driContext == NULL) {
-       Xfree(pcp);
-       return NULL;
-    }
-
-    pcp->base.destroyContext = dri2DestroyContext;
-    pcp->base.bindContext = dri2BindContext;
-    pcp->base.unbindContext = dri2UnbindContext;
-
-    return &pcp->base;
-}
-
-static void dri2DestroyDrawable(__GLXDRIdrawable *pdraw)
-{
-    const __DRIcoreExtension *core = pdraw->psc->core;
-
-    (*core->destroyDrawable)(pdraw->driDrawable);
-    DRI2DestroyDrawable(pdraw->psc->dpy, pdraw->drawable);
-    Xfree(pdraw);
-}
-
-static __GLXDRIdrawable *dri2CreateDrawable(__GLXscreenConfigs *psc,
-                                           XID xDrawable,
-                                           GLXDrawable drawable,
-                                           const __GLcontextModes *modes)
-{
-    __GLXDRIdrawable *pdraw;
-    __GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) modes;
-    unsigned int handle, head;
-    const __DRIcoreExtension *core = psc->core;
-
-    pdraw = Xmalloc(sizeof(*pdraw));
-    if (!pdraw)
-       return NULL;
-
-    pdraw->destroyDrawable = dri2DestroyDrawable;
-    pdraw->xDrawable = xDrawable;
-    pdraw->drawable = drawable;
-    pdraw->psc = psc;
-
-    fprintf(stderr, "calling DRI2CreateDrawable, XID 0x%lx, GLX ID 0x%lx\n",
-           xDrawable, drawable);
-
-    if (!DRI2CreateDrawable(psc->dpy, xDrawable, &handle, &head)) {
-       Xfree(pdraw);
-       return NULL;
-    }
-
-    fprintf(stderr, "success, head 0x%x, handle 0x%x\n", head, handle);
-
-    /* Create a new drawable */
-    pdraw->driDrawable =
-       (*core->createNewDrawable)(psc->__driScreen,
-                                  config->driConfig,
-                                  handle,
-                                  head,
-                                  pdraw);
-
-    if (!pdraw->driDrawable) {
-       DRI2DestroyDrawable(psc->dpy, drawable);
-       Xfree(pdraw);
-       return NULL;
-    }
-
-    return pdraw;
-}
-
-static void dri2DestroyScreen(__GLXscreenConfigs *psc)
-{
-    /* Free the direct rendering per screen data */
-    (*psc->core->destroyScreen)(psc->__driScreen);
-    drmClose(psc->fd);
-    psc->__driScreen = NULL;
-}
-
-
-static void dri2ReemitDrawableInfo(__DRIdrawable *draw, unsigned int *tail,
-                                   void *loaderPrivate)
-{
-    __GLXDRIdrawable *pdraw = loaderPrivate;
-
-    DRI2ReemitDrawableInfo(pdraw->psc->dpy, pdraw->drawable, tail);
-}
-
-static void dri2PostDamage(__DRIdrawable *draw,
-                          struct drm_clip_rect *rects,
-                          int numRects, void *loaderPrivate)
-{ 
-    XRectangle *xrects;
-    XserverRegion region;
-    __GLXDRIdrawable *glxDraw = loaderPrivate;
-    __GLXscreenConfigs *psc = glxDraw->psc;
-    Display *dpy = psc->dpy;
-    int i;
-
-    xrects = malloc(sizeof(XRectangle) * numRects);
-    if (xrects == NULL)
-       return;
-
-    for (i = 0; i < numRects; i++) {
-       xrects[i].x = rects[i].x1;
-       xrects[i].y = rects[i].y1;
-       xrects[i].width = rects[i].x2 - rects[i].x1;
-       xrects[i].height = rects[i].y2 - rects[i].y1;
-    }
-    region = XFixesCreateRegion(dpy, xrects, numRects);
-    free(xrects);
-    XDamageAdd(dpy, glxDraw->xDrawable, region);
-    XFixesDestroyRegion(dpy, region);
-}
-
-static const __DRIloaderExtension dri2LoaderExtension = {
-    { __DRI_LOADER, __DRI_LOADER_VERSION },
-    dri2ReemitDrawableInfo,
-    dri2PostDamage
-};
-
-static const __DRIextension *loader_extensions[] = {
-    &dri2LoaderExtension.base,
-    &systemTimeExtension.base,
-    NULL
-};
-
-static __GLXDRIscreen *dri2CreateScreen(__GLXscreenConfigs *psc, int screen,
-                                       __GLXdisplayPrivate *priv)
-{
-    const __DRIconfig **driver_configs;
-    const __DRIextension **extensions;
-    __GLXDRIscreen *psp;
-    unsigned int sareaHandle;
-    char *driverName, *busID;
-    drm_magic_t magic;
-    int i;
-
-    psp = Xmalloc(sizeof *psp);
-    if (psp == NULL)
-       return NULL;
-
-    /* Initialize per screen dynamic client GLX extensions */
-    psc->ext_list_first_time = GL_TRUE;
-
-    if (!DRI2Connect(psc->dpy, screen, &driverName, &busID, &sareaHandle))
-       return NULL;
-
-    psc->driver = driOpenDriver(driverName);
-    if (psc->driver == NULL)
-       goto handle_error;
-
-    extensions = dlsym(psc->driver, __DRI_DRIVER_EXTENSIONS);
-    if (extensions == NULL) {
-       ErrorMessageF("driver exports no extensions (%s)\n", dlerror());
-       goto handle_error;
-    }
-    
-    for (i = 0; extensions[i]; i++) {
-       if (strcmp(extensions[i]->name, __DRI_CORE) == 0)
-           psc->core = (__DRIcoreExtension *) extensions[i];
-    }
-
-    if (psc->core == NULL) {
-       ErrorMessageF("core dri extension not found\n");
-       goto handle_error;
-    }
-
-    psc->fd = drmOpen(NULL, busID);
-    if (psc->fd < 0) {
-       ErrorMessageF("failed to open drm device: %s\n", strerror(errno));
-       return NULL;
-    }
-
-    if (drmGetMagic(psc->fd, &magic))
-       return NULL;
-
-    if (!DRI2AuthConnection(psc->dpy, screen, magic)) {
-       ErrorMessageF("failed to authenticate drm access\n");
-       return NULL;
-    }
-
-    psc->__driScreen = 
-       psc->core->createNewScreen(screen, psc->fd, sareaHandle,
-                                  loader_extensions, &driver_configs, psc);
-    if (psc->__driScreen == NULL) {
-       ErrorMessageF("failed to create dri screen\n");
-       return NULL;
-    }
-
-    driBindExtensions(psc, 1);
-
-    psc->configs = driConvertConfigs(psc->core, psc->configs, driver_configs);
-    psc->visuals = driConvertConfigs(psc->core, psc->visuals, driver_configs);
-
-    psp->destroyScreen = dri2DestroyScreen;
-    psp->createContext = dri2CreateContext;
-    psp->createDrawable = dri2CreateDrawable;
-
-    Xfree(driverName);
-    Xfree(busID);
-
-    return psp;
-
- handle_error:
-    Xfree(driverName);
-    Xfree(busID);
-
-    /* FIXME: clean up here */
-
-    return NULL;
-}
-
-/* Called from __glXFreeDisplayPrivate.
- */
-static void dri2DestroyDisplay(__GLXDRIdisplay *dpy)
-{
-    Xfree(dpy);
-}
-
-/*
- * Allocate, initialize and return a __DRIdisplayPrivate object.
- * This is called from __glXInitialize() when we are given a new
- * display pointer.
- */
-_X_HIDDEN __GLXDRIdisplay *dri2CreateDisplay(Display *dpy)
-{
-    __GLXDRIdisplayPrivate *pdp;
-    int eventBase, errorBase;
-
-    if (!DRI2QueryExtension(dpy, &eventBase, &errorBase))
-       return NULL;
-
-    pdp = Xmalloc(sizeof *pdp);
-    if (pdp == NULL)
-       return NULL;
-
-    if (!DRI2QueryVersion(dpy, &pdp->driMajor, &pdp->driMinor)) {
-       Xfree(pdp);
-       return NULL;
-    }
-
-    pdp->driPatch = 0;
-
-    pdp->base.destroyDisplay = dri2DestroyDisplay;
-    pdp->base.createScreen = dri2CreateScreen;
-
-    return &pdp->base;
-}
-
-#endif /* GLX_DIRECT_RENDERING */
diff --git a/src/glx/x11/glxclient.h b/src/glx/x11/glxclient.h
index e2b4218..c235231 100644
--- a/src/glx/x11/glxclient.h
+++ b/src/glx/x11/glxclient.h
@@ -151,7 +151,6 @@ struct __GLXDRIdrawableRec {
 */
 extern __GLXDRIdisplay *driswCreateDisplay(Display *dpy);
 extern __GLXDRIdisplay *driCreateDisplay(Display *dpy);
-extern __GLXDRIdisplay *dri2CreateDisplay(Display *dpy);
 
 extern void DRI_glXUseXFont( Font font, int first, int count, int listbase );
 
@@ -570,7 +569,6 @@ struct __GLXdisplayPrivateRec {
      */
     __GLXDRIdisplay *driswDisplay;
     __GLXDRIdisplay *driDisplay;
-    __GLXDRIdisplay *dri2Display;
 #endif
 };
 
diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c
index 0d6d25e..01f6f37 100644
--- a/src/glx/x11/glxext.c
+++ b/src/glx/x11/glxext.c
@@ -207,10 +207,6 @@ static int __glXFreeDisplayPrivate(XExtData *extension)
     if (priv->driDisplay)
        (*priv->driDisplay->destroyDisplay)(priv->driDisplay);
     priv->driDisplay = NULL;
-
-    if (priv->dri2Display)
-       (*priv->dri2Display->destroyDisplay)(priv->dri2Display);
-    priv->dri2Display = NULL;
 #endif
 
     Xfree((char*) priv);
@@ -608,9 +604,6 @@ static Bool AllocAndFetchScreenConfigs(Display *dpy, 
__GLXdisplayPrivate *priv)
        if (psc->drawHash == NULL)
            continue;
 
-       if (priv->dri2Display)
-           psc->driScreen = (*priv->dri2Display->createScreen)(psc, i, priv);
-
        if (psc->driScreen == NULL && priv->driDisplay)
            psc->driScreen = (*priv->driDisplay->createScreen)(psc, i, priv);
 
@@ -716,7 +709,6 @@ _X_HIDDEN __GLXdisplayPrivate *__glXInitialize(Display* dpy)
     ** (e.g., those called in AllocAndFetchScreenConfigs).
     */
     if (glx_direct && glx_accel) {
-       dpyPriv->dri2Display = dri2CreateDisplay(dpy);
        dpyPriv->driDisplay = driCreateDisplay(dpy);
     }
     if (glx_direct)
-- 
1.5.5.1


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to