summaryrefslogtreecommitdiffstats
path: root/src/glx
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2005-07-26 02:44:01 +0000
committerIan Romanick <[email protected]>2005-07-26 02:44:01 +0000
commit5f1ba3e21b62cee1a4f900a2e6964728f3eeea9b (patch)
tree986059d9e958763f9663c78a92313db2c3579269 /src/glx
parent1201348a337aa00a85b6bc6dec4963cfc5898e77 (diff)
Fixes the glXGetProcAddress portion of the interface. Most of the functions
that are currently obtained via glXGetProcAddress and all of the XF86DRI functions are replaced with a funciton table. This table will be passed to __driCreateNewScreen. One of the functions in the table is getProcAddress. This allows some loaders to expose functionality not in all loaders. This will be immediatly used for glxEnableExtension (formerly known to drivers as __glXScrEnableExtension). libGL (and in the future libglx) expose this function so that drivers can enable GLX extensions. libEGL should exposed eglEnableExtension to enable EGL extensions. The same function cannot be used for both because the extensions have different names and (possibly) different semantics. Drivers can optionally use one, both, or neither. The key parts are in the __DRIinterfaceMethodsRec structure in dri_interface.h. A pointer to one of these structures is passed into __driCreateNewScreen. Because of this, the version of the API is bumped to 20050725. Since the previous version(s) were never in a release, their existance is erased. I was actually a little surprised by how much code this cuts from the drivers. A lot of glXGetProcAddress calls disappear, and a lot of version checks go with them. Nice. The one thing I'm not sure of is removing __glXInitialize. For some reason that function was in the glXGetProcAddress table, but *nothing* in the Mesa tree used it. Did something with DRI conf. use this function? It seems odd...
Diffstat (limited to 'src/glx')
-rw-r--r--src/glx/x11/dri_glx.c2
-rw-r--r--src/glx/x11/glxclient.h2
-rw-r--r--src/glx/x11/glxcmds.c33
-rw-r--r--src/glx/x11/glxext.c37
4 files changed, 44 insertions, 30 deletions
diff --git a/src/glx/x11/dri_glx.c b/src/glx/x11/dri_glx.c
index 8cc0b62b023..91ca875ff16 100644
--- a/src/glx/x11/dri_glx.c
+++ b/src/glx/x11/dri_glx.c
@@ -166,7 +166,7 @@ ExtractDir(int index, const char *paths, int dirLen, char *dir)
* \todo
* Create a macro or something so that this is automatically updated.
*/
-static const char createNewScreenName[] = "__driCreateNewScreen_20050722";
+static const char createNewScreenName[] = "__driCreateNewScreen_20050725";
/**
diff --git a/src/glx/x11/glxclient.h b/src/glx/x11/glxclient.h
index 6852fd066aa..166673847c4 100644
--- a/src/glx/x11/glxclient.h
+++ b/src/glx/x11/glxclient.h
@@ -137,6 +137,8 @@ extern const char *glXGetScreenDriver (Display *dpy, int scrNum);
extern const char *glXGetDriverConfig (const char *driverName);
+extern Bool __glXWindowExists(Display *dpy, GLXDrawable draw);
+
#endif
/************************************************************************/
diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c
index 5a16fb964d3..77f80e3f987 100644
--- a/src/glx/x11/glxcmds.c
+++ b/src/glx/x11/glxcmds.c
@@ -49,6 +49,7 @@
#ifdef GLX_DIRECT_RENDERING
#include "indirect_init.h"
#include "xf86vmode.h"
+#include "xf86dri.h"
#endif
#include "glxextensions.h"
#include "glcontextmodes.h"
@@ -63,13 +64,6 @@ static const char __glXGLXClientVendorName[] = "SGI";
static const char __glXGLXClientVersion[] = "1.4";
-#if defined(GLX_DIRECT_RENDERING)
-#include "xf86dri.h"
-
-static Bool __glXWindowExists(Display *dpy, GLXDrawable draw);
-#endif
-
-
/****************************************************************************/
/**
* Get the __DRIdrawable for the drawable associated with a GLXContext
@@ -2814,28 +2808,9 @@ static const struct name_address_pair GLX_functions[] = {
GLX_FUNCTION( glXGetSyncValuesOML ),
#ifdef GLX_DIRECT_RENDERING
- /***
- *** Internal functions useful to DRI drivers
- *** With this, the DRI drivers shouldn't need dlopen()/dlsym() to
- *** access internal libGL functions which may or may not exist.
- ***/
- GLX_FUNCTION( __glXInitialize ),
- GLX_FUNCTION( __glXFindDRIScreen ),
- GLX_FUNCTION( __glXGetInternalVersion ),
- GLX_FUNCTION( __glXWindowExists ),
- GLX_FUNCTION2( __glXCreateContextWithConfig, XF86DRICreateContextWithConfig ),
- GLX_FUNCTION2( __glXGetDrawableInfo, XF86DRIGetDrawableInfo ),
-
/*** DRI configuration ***/
GLX_FUNCTION( glXGetScreenDriver ),
GLX_FUNCTION( glXGetDriverConfig ),
-
- GLX_FUNCTION( __glXScrEnableExtension ),
-
- GLX_FUNCTION( __glXGetUST ),
-
- GLX_FUNCTION2( __glXCreateContextModes, _gl_context_modes_create ),
- GLX_FUNCTION2( __glXDestroyContextModes, _gl_context_modes_destroy ),
#endif
{ NULL, NULL } /* end of list */
@@ -2949,10 +2924,10 @@ int __glXGetInternalVersion(void)
* 20040415 - Added support for bindContext3 and unbindContext3.
* 20040602 - Add __glXGetDrawableInfo. I though that was there
* months ago. :(
- * 20050722 - Gut all the old interfaces. This breaks compatability with
+ * 20050725 - Gut all the old interfaces. This breaks compatability with
* any DRI driver built to any previous version.
*/
- return 20050722;
+ return 20050725;
}
@@ -2986,7 +2961,7 @@ static int windowExistsErrorHandler(Display *dpy, XErrorEvent *xerr)
*
* \since Internal API version 20021128.
*/
-static Bool __glXWindowExists(Display *dpy, GLXDrawable draw)
+Bool __glXWindowExists(Display *dpy, GLXDrawable draw)
{
XWindowAttributes xwa;
int (*oldXErrorHandler)(Display *, XErrorEvent *);
diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c
index 1754efa0c26..66567b83138 100644
--- a/src/glx/x11/glxext.c
+++ b/src/glx/x11/glxext.c
@@ -667,6 +667,42 @@ filter_modes( __GLcontextModes ** server_modes,
}
+/**
+ * Implement \c __DRIinterfaceMethods::getProcAddress.
+ */
+static __DRIfuncPtr get_proc_address( const char * proc_name )
+{
+ if (strcmp( proc_name, "glxEnableExtension" ) == 0) {
+ return (__DRIfuncPtr) __glXScrEnableExtension;
+ }
+
+ return NULL;
+}
+
+
+/**
+ * Table of functions exported by the loader to the driver.
+ */
+static const __DRIinterfaceMethods interface_methods = {
+ get_proc_address,
+
+ _gl_context_modes_create,
+ _gl_context_modes_destroy,
+
+ __glXFindDRIScreen,
+ __glXWindowExists,
+
+ XF86DRICreateContextWithConfig,
+ XF86DRIDestroyContext,
+
+ XF86DRICreateDrawable,
+ XF86DRIDestroyDrawable,
+ XF86DRIGetDrawableInfo,
+
+ __glXGetUST,
+ glXGetMscRateOML,
+};
+
/**
* Perform the required libGL-side initialization and call the client-side
@@ -819,6 +855,7 @@ CallCreateNewScreen(Display *dpy, int scrn, __DRIscreen *psc,
pSAREA,
fd,
api_ver,
+ & interface_methods,
& driver_modes );
filter_modes( & configs->configs,