From 5f1ba3e21b62cee1a4f900a2e6964728f3eeea9b Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 26 Jul 2005 02:44:01 +0000 Subject: 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... --- src/mesa/drivers/dri/r300/radeon_screen.c | 32 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 18 deletions(-) (limited to 'src/mesa/drivers/dri/r300/radeon_screen.c') diff --git a/src/mesa/drivers/dri/r300/radeon_screen.c b/src/mesa/drivers/dri/r300/radeon_screen.c index ea9b9ea266..34f5d84e36 100644 --- a/src/mesa/drivers/dri/r300/radeon_screen.c +++ b/src/mesa/drivers/dri/r300/radeon_screen.c @@ -216,7 +216,6 @@ static const struct dri_debug_control debug_control[] = { #define PCI_CHIP_R420_JK 0x4a4b #endif -static PFNGLXCREATECONTEXTMODES create_context_modes = NULL; static radeonScreenPtr __radeonScreen; @@ -271,7 +270,7 @@ static __GLcontextModes *radeonFillInModes(unsigned pixel_bits, fb_type = GL_UNSIGNED_INT_8_8_8_8_REV; } - modes = (*create_context_modes) (num_modes, sizeof(__GLcontextModes)); + modes = (*dri_interface->createContextModes) (num_modes, sizeof(__GLcontextModes)); m = modes; if (!driFillInModes(&m, fb_format, fb_type, depth_bits_array, stencil_bits_array, @@ -312,7 +311,7 @@ static radeonScreenPtr radeonCreateScreen(__DRIscreenPrivate * sPriv) unsigned char *RADEONMMIO; PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = (PFNGLXSCRENABLEEXTENSIONPROC) - glXGetProcAddress((const GLubyte *) "__glXScrEnableExtension"); + (*dri_interface->getProcAddress("glxEnableExtension")); void *const psc = sPriv->psc->screenConfigs; @@ -790,13 +789,14 @@ static const struct __DriverAPIRec radeonAPI = { * \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on * failure. */ -void *__driCreateNewScreen_20050722(__DRInativeDisplay * dpy, int scrn, +void *__driCreateNewScreen_20050725(__DRInativeDisplay * dpy, int scrn, __DRIscreen * psc, const __GLcontextModes * modes, const __DRIversion * ddx_version, const __DRIversion * dri_version, const __DRIversion * drm_version, const __DRIframebuffer * frame_buffer, drmAddress pSAREA, int fd, int internal_api_version, + const __DRIinterfaceMethods * interface, __GLcontextModes ** driver_modes) { __DRIscreenPrivate *psp; @@ -804,6 +804,8 @@ void *__driCreateNewScreen_20050722(__DRInativeDisplay * dpy, int scrn, static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion drm_expected = { 1, 11, 1 }; + dri_interface = interface; + if (!driCheckDriDdxDrmVersions3("R300", dri_version, &dri_expected, ddx_version, &ddx_expected, @@ -816,20 +818,14 @@ void *__driCreateNewScreen_20050722(__DRInativeDisplay * dpy, int scrn, frame_buffer, pSAREA, fd, internal_api_version, &radeonAPI); if (psp != NULL) { - create_context_modes = (PFNGLXCREATECONTEXTMODES) - glXGetProcAddress((const GLubyte *) - "__glXCreateContextModes"); - if (create_context_modes != NULL) { - RADEONDRIPtr dri_priv = (RADEONDRIPtr) psp->pDevPriv; - *driver_modes = radeonFillInModes(dri_priv->bpp, - (dri_priv->bpp == - 16) ? 16 : 24, - (dri_priv->bpp == - 16) ? 0 : 8, - (dri_priv->backOffset != - dri_priv-> - depthOffset)); - } + RADEONDRIPtr dri_priv = (RADEONDRIPtr) psp->pDevPriv; + *driver_modes = radeonFillInModes(dri_priv->bpp, + (dri_priv->bpp == + 16) ? 16 : 24, + (dri_priv->bpp == + 16) ? 0 : 8, + (dri_priv->backOffset != + dri_priv->depthOffset)); } return (void *)psp; -- cgit v1.2.3