#include "sarea.h"
#include <stdio.h>
#include <dlfcn.h>
-#include "dri_glx.h"
#include <sys/types.h>
#include <stdarg.h>
#include "glcontextmodes.h"
#define RTLD_GLOBAL 0
#endif
+typedef struct __GLXDRIdisplayPrivateRec __GLXDRIdisplayPrivate;
+struct __GLXDRIdisplayPrivateRec {
+ __GLXDRIdisplay base;
+
+ /*
+ ** XFree86-DRI version information
+ */
+ int driMajor;
+ int driMinor;
+ int driPatch;
+};
#ifndef DEFAULT_DRIVER_DIR
/* this is normally defined in Mesa/configs/default with DRI_DRIVER_SEARCH_PATH */
*/
static void *
CallCreateNewScreen(Display *dpy, int scrn, __GLXscreenConfigs *psc,
- __DRIdisplay * driDpy,
+ __GLXDRIdisplayPrivate * driDpy,
PFNCREATENEWSCREENFUNC createNewScreen)
{
- __DRIscreenPrivate *psp = NULL;
+ void *psp = NULL;
#ifndef GLX_USE_APPLEGL
drm_handle_t hSAREA;
drmAddress pSAREA = MAP_FAILED;
const char * err_msg;
const char * err_extra;
- dri_version.major = driDpy->private->driMajor;
- dri_version.minor = driDpy->private->driMinor;
- dri_version.patch = driDpy->private->driPatch;
+ dri_version.major = driDpy->driMajor;
+ dri_version.minor = driDpy->driMinor;
+ dri_version.patch = driDpy->driPatch;
err_msg = "XF86DRIOpenConnection";
__GLXdisplayPrivate *priv)
{
PFNCREATENEWSCREENFUNC createNewScreen;
+ __GLXDRIdisplayPrivate *pdp;
- if (priv->driDisplay.private == NULL)
+ if (priv->driDisplay == NULL)
return;
/* Create drawable hash */
if (createNewScreenName == NULL)
return;
+ pdp = (__GLXDRIdisplayPrivate *) priv->driDisplay;
psc->driScreen.private =
- CallCreateNewScreen(psc->dpy, screen, psc,
- &priv->driDisplay, createNewScreen);
+ CallCreateNewScreen(psc->dpy, screen, psc, pdp, createNewScreen);
if (psc->driScreen.private != NULL)
__glXScrEnableDRIExtension(psc);
}
/* Called from __glXFreeDisplayPrivate.
*/
-static void driDestroyDisplay(Display *dpy, void *private)
+static void driDestroyDisplay(__GLXDRIdisplay *dpy)
{
- __DRIdisplayPrivate *pdpyp = (__DRIdisplayPrivate *)private;
-
- if (pdpyp)
- Xfree(pdpyp);
+ Xfree(dpy);
}
-
/*
* Allocate, initialize and return a __DRIdisplayPrivate object.
* This is called from __glXInitialize() when we are given a new
* display pointer.
*/
-void *driCreateDisplay(Display *dpy, __DRIdisplay *pdisp)
+__GLXDRIdisplay *driCreateDisplay(Display *dpy)
{
- __DRIdisplayPrivate *pdpyp;
+ __GLXDRIdisplayPrivate *pdpyp;
int eventBase, errorBase;
int major, minor, patch;
- /* Initialize these fields to NULL in case we fail.
- * If we don't do this we may later get segfaults trying to free random
- * addresses when the display is closed.
- */
- pdisp->private = NULL;
- pdisp->destroyDisplay = NULL;
-
if (!XF86DRIQueryExtension(dpy, &eventBase, &errorBase)) {
return NULL;
}
return NULL;
}
- pdpyp = (__DRIdisplayPrivate *)Xmalloc(sizeof(__DRIdisplayPrivate));
+ pdpyp = Xmalloc(sizeof *pdpyp);
if (!pdpyp) {
return NULL;
}
pdpyp->driMinor = minor;
pdpyp->driPatch = patch;
- pdisp->destroyDisplay = driDestroyDisplay;
+ pdpyp->base.destroyDisplay = driDestroyDisplay;
return (void *)pdpyp;
}
+++ /dev/null
-/**************************************************************************
-
-Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sub license, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial portions
-of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
-ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Kevin E. Martin <kevin@precisioninsight.com>
- * Brian Paul <brian@precisioninsight.com>
- *
- */
-
-#ifndef _DRI_GLX_H_
-#define _DRI_GLX_H_
-
-#ifdef GLX_DIRECT_RENDERING
-
-struct __DRIdisplayPrivateRec {
- /*
- ** XFree86-DRI version information
- */
- int driMajor;
- int driMinor;
- int driPatch;
-};
-
-typedef struct __DRIdisplayPrivateRec __DRIdisplayPrivate;
-typedef struct __DRIscreenPrivateRec __DRIscreenPrivate;
-typedef struct __DRIvisualPrivateRec __DRIvisualPrivate;
-typedef struct __DRIcontextPrivateRec __DRIcontextPrivate;
-typedef struct __DRIdrawablePrivateRec __DRIdrawablePrivate;
-
-#endif
-#endif /* _DRI_GLX_H_ */
* Display dependent methods. This structure is initialized during the
* \c driCreateDisplay call.
*/
-struct __DRIdisplayRec {
+typedef struct __GLXDRIdisplayRec __GLXDRIdisplay;
+struct __GLXDRIdisplayRec {
/**
* Method to destroy the private DRI display data.
*/
- void (*destroyDisplay)(Display *dpy, void *displayPrivate);
-
- /**
- * Opaque pointer to private per display direct rendering data.
- * \c NULL if direct rendering is not supported on this display.
- */
- struct __DRIdisplayPrivateRec *private;
+ void (*destroyDisplay)(__GLXDRIdisplay *display);
};
/*
** Function to create and DRI display data and initialize the display
** dependent methods.
*/
-extern void *driCreateDisplay(Display *dpy, __DRIdisplay *pdisp);
+extern __GLXDRIdisplay *driCreateDisplay(Display *dpy);
extern void driCreateScreen(__GLXscreenConfigs *psc, int screen,
__GLXdisplayPrivate *priv);
extern void driDestroyScreen(__GLXscreenConfigs *psc);
/**
* Per display direct rendering interface functions and data.
*/
- __DRIdisplay driDisplay;
+ __GLXDRIdisplay *driDisplay;
#endif
};
unsigned i;
__GLXscreenConfigs *sc;
- if (priv == NULL || priv->driDisplay.private == NULL)
+ if (priv == NULL || priv->driDisplay == NULL)
return NULL;
for (i = 0; i < screen_count; i++) {
#include "xf86dri.h"
#include "xf86drm.h"
#include "sarea.h"
-#include "dri_glx.h"
#endif
#ifdef USE_XCB
#ifdef GLX_DIRECT_RENDERING
/* Free the direct rendering per display data */
- if (priv->driDisplay.private)
- (*priv->driDisplay.destroyDisplay)(priv->dpy,
- priv->driDisplay.private);
- priv->driDisplay.private = NULL;
+ if (priv->driDisplay)
+ (*priv->driDisplay->destroyDisplay)(priv->driDisplay);
+ priv->driDisplay = NULL;
#endif
Xfree((char*) priv);
** (e.g., those called in AllocAndFetchScreenConfigs).
*/
if (getenv("LIBGL_ALWAYS_INDIRECT") == NULL) {
- dpyPriv->driDisplay.private =
- driCreateDisplay(dpy, &dpyPriv->driDisplay);
+ dpyPriv->driDisplay = driCreateDisplay(dpy);
}
#endif
drm_drawable_t hwDrawable;
void *empty_attribute_list = NULL;
- if (priv == NULL || priv->driDisplay.private == NULL)
+ if (priv == NULL || priv->driDisplay == NULL)
return NULL;
sc = &priv->screenConfigs[gc->screen];