diff options
author | Ian Romanick <[email protected]> | 2005-07-26 02:44:01 +0000 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2005-07-26 02:44:01 +0000 |
commit | 5f1ba3e21b62cee1a4f900a2e6964728f3eeea9b (patch) | |
tree | 986059d9e958763f9663c78a92313db2c3579269 /src/mesa | |
parent | 1201348a337aa00a85b6bc6dec4963cfc5898e77 (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/mesa')
32 files changed, 209 insertions, 390 deletions
diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index 1483dc0445c..c201d44c6c6 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -37,6 +37,10 @@ typedef GLboolean ( * PFNGLXGETMSCRATEOMLPROC) (__DRInativeDisplay *dpy, __DRIid drawable, int32_t *numerator, int32_t *denominator); #endif +/* This pointer *must* be set by the driver's __driCreateNewScreen funciton! + */ +const __DRIinterfaceMethods * dri_interface = NULL; + /** * Weak thread-safety dispatch pointer. Older versions of libGL will not have * this symbol, so a "weak" version is included here so that the driver will @@ -50,19 +54,6 @@ struct _glapi_table *_glapi_DispatchTSD __attribute__((weak)) = NULL; */ static const int empty_attribute_list[1] = { None }; -/** - * Function used to determine if a drawable (window) still exists. Ideally - * this function comes from libGL. With older versions of libGL from XFree86 - * we can fall-back to an internal version. - * - * \sa __driWindowExists __glXWindowExists - */ -static PFNGLXWINDOWEXISTSPROC window_exists; - -typedef GLboolean (*PFNGLXCREATECONTEXTWITHCONFIGPROC)( __DRInativeDisplay*, int, int, void *, - drm_context_t * ); - -static PFNGLXCREATECONTEXTWITHCONFIGPROC create_context_with_config; /** * Cached copy of the internal API version used by libGL and the client-side @@ -103,9 +94,6 @@ __driUtilMessage(const char *f, ...) } } -typedef __DRIscreen *(*PFNGLXFINDDRISCREEN)(__DRInativeDisplay *, int); -static PFNGLXFINDDRISCREEN glx_find_dri_screen = NULL; - /*****************************************************************/ /** \name Drawable list management */ @@ -151,7 +139,7 @@ static void __driGarbageCollectDrawables(void *drawHash) do { __DRIdrawablePrivate *pdp = (__DRIdrawablePrivate *)pdraw->private; dpy = pdp->driScreenPriv->display; - if (! (*window_exists)(dpy, draw)) { + if (! (*dri_interface->windowExists)(dpy, draw)) { /* Destroy the local drawable data in the hash table, if the drawable no longer exists in the Xserver */ drmHashDelete(drawHash, draw); @@ -211,7 +199,7 @@ static GLboolean driUnbindContext(__DRInativeDisplay *dpy, int scrn, return GL_FALSE; } - pDRIScreen = (*glx_find_dri_screen)(dpy, scrn); + pDRIScreen = (*dri_interface->getScreen)(dpy, scrn); if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) { /* ERROR!!! */ return GL_FALSE; @@ -387,7 +375,7 @@ static GLboolean driBindContext(__DRInativeDisplay *dpy, int scrn, return GL_FALSE; } - pDRIScreen = (*glx_find_dri_screen)(dpy, scrn); + pDRIScreen = (*dri_interface->getScreen)(dpy, scrn); if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) { /* ERROR!!! */ return GL_FALSE; @@ -410,8 +398,8 @@ static GLboolean driBindContext(__DRInativeDisplay *dpy, int scrn, * \param pdp pointer to the private drawable information to update. * * This function basically updates the __DRIdrawablePrivate struct's - * cliprect information by calling \c __DRIDrawablePrivate::getInfo. This is - * usually called by the DRI_VALIDATE_DRAWABLE_INFO macro which + * cliprect information by calling \c __DRIinterfaceMethods::getDrawableInfo. + * This is usually called by the DRI_VALIDATE_DRAWABLE_INFO macro which * compares the __DRIdrwablePrivate pStamp and lastStamp values. If * the values are different that means we have to update the clipping * info. @@ -444,7 +432,7 @@ __driUtilUpdateDrawableInfo(__DRIdrawablePrivate *pdp) DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); if (!__driFindDrawable(psp->drawHash, pdp->draw) || - ! (*pdp->getInfo)(pdp->display, pdp->screen, pdp->draw, + ! (*dri_interface->getDrawableInfo)(pdp->display, pdp->screen, pdp->draw, &pdp->index, &pdp->lastStamp, &pdp->x, &pdp->y, &pdp->w, &pdp->h, &pdp->numClipRects, &pdp->pClipRects, @@ -578,7 +566,7 @@ static void *driCreateNewDrawable(__DRInativeDisplay *dpy, int renderType, const int *attrs) { - __DRIscreen * const pDRIScreen = (*glx_find_dri_screen)(dpy, modes->screen); + __DRIscreen * const pDRIScreen = (*dri_interface->getScreen)(dpy, modes->screen); __DRIscreenPrivate *psp; __DRIdrawablePrivate *pdp; @@ -599,7 +587,7 @@ static void *driCreateNewDrawable(__DRInativeDisplay *dpy, return NULL; } - if (!XF86DRICreateDrawable(dpy, modes->screen, draw, &pdp->hHWDrawable)) { + if (!(*dri_interface->createDrawable)(dpy, modes->screen, draw, &pdp->hHWDrawable)) { _mesa_free(pdp); return NULL; } @@ -625,17 +613,9 @@ static void *driCreateNewDrawable(__DRInativeDisplay *dpy, pdp->driScreenPriv = psp; pdp->driContextPriv = &psp->dummyContextPriv; - pdp->getInfo = (PFNGLXGETDRAWABLEINFOPROC) - glXGetProcAddress( (const GLubyte *) "__glXGetDrawableInfo" ); - if ( pdp->getInfo == NULL ) { - (void)XF86DRIDestroyDrawable(dpy, modes->screen, pdp->draw); - _mesa_free(pdp); - return NULL; - } - if (!(*psp->DriverAPI.CreateBuffer)(psp, pdp, modes, renderType == GLX_PIXMAP_BIT)) { - (void)XF86DRIDestroyDrawable(dpy, modes->screen, pdp->draw); + (void)(*dri_interface->destroyDrawable)(dpy, modes->screen, pdp->draw); _mesa_free(pdp); return NULL; } @@ -691,8 +671,8 @@ static void driDestroyDrawable(__DRInativeDisplay *dpy, void *drawablePrivate) if (pdp) { (*psp->DriverAPI.DestroyBuffer)(pdp); - if ((*window_exists)(dpy, pdp->draw)) - (void)XF86DRIDestroyDrawable(dpy, scrn, pdp->draw); + if ((*dri_interface->windowExists)(dpy, pdp->draw)) + (void)(*dri_interface->destroyDrawable)(dpy, scrn, pdp->draw); if (pdp->pClipRects) { _mesa_free(pdp->pClipRects); pdp->pClipRects = NULL; @@ -731,7 +711,7 @@ static void driDestroyContext(__DRInativeDisplay *dpy, int scrn, void *contextPr if (pcp) { (*pcp->driScreenPriv->DriverAPI.DestroyContext)(pcp); __driGarbageCollectDrawables(pcp->driScreenPriv->drawHash); - (void)XF86DRIDestroyContext(dpy, scrn, pcp->contextID); + (void) (*dri_interface->destroyContext)(dpy, scrn, pcp->contextID); _mesa_free(pcp); } } @@ -768,7 +748,7 @@ driCreateNewContext(__DRInativeDisplay *dpy, const __GLcontextModes *modes, __DRIscreenPrivate *psp; void * const shareCtx = (pshare != NULL) ? pshare->driverPrivate : NULL; - pDRIScreen = (*glx_find_dri_screen)(dpy, modes->screen); + pDRIScreen = (*dri_interface->getScreen)(dpy, modes->screen); if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) { /* ERROR!!! */ return NULL; @@ -781,7 +761,7 @@ driCreateNewContext(__DRInativeDisplay *dpy, const __GLcontextModes *modes, return NULL; } - if (! (*create_context_with_config)(dpy, modes->screen, modes->fbconfigID, + if (! (*dri_interface->createContext)(dpy, modes->screen, modes->fbconfigID, &pcp->contextID, &pcp->hHWContext)) { _mesa_free(pcp); return NULL; @@ -809,7 +789,8 @@ driCreateNewContext(__DRInativeDisplay *dpy, const __GLcontextModes *modes, pctx->unbindContext = driUnbindContext; if ( !(*psp->DriverAPI.CreateContext)(modes, pcp, shareCtx) ) { - (void)XF86DRIDestroyContext(dpy, modes->screen, pcp->contextID); + (void) (*dri_interface->destroyContext)(dpy, modes->screen, + pcp->contextID); _mesa_free(pcp); return NULL; } @@ -906,25 +887,6 @@ __driUtilCreateNewScreen(__DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, __DRIscreenPrivate *psp; - window_exists = (PFNGLXWINDOWEXISTSPROC) - glXGetProcAddress( (const GLubyte *) "__glXWindowExists" ); - - if ( window_exists == NULL ) { - return NULL; - } - - glx_find_dri_screen = - (PFNGLXFINDDRISCREEN)glXGetProcAddress("__glXFindDRIScreen"); - if ( glx_find_dri_screen == NULL ) { - return NULL; - } - - create_context_with_config = (PFNGLXCREATECONTEXTWITHCONFIGPROC) - glXGetProcAddress( (const GLubyte *) "__glXCreateContextWithConfig" ); - if ( create_context_with_config == NULL ) { - return NULL; - } - api_ver = internal_api_version; psp = (__DRIscreenPrivate *)_mesa_malloc(sizeof(__DRIscreenPrivate)); @@ -1033,15 +995,11 @@ driQueryFrameTracking( __DRInativeDisplay * dpy, void * priv, int64_t * sbc, int64_t * missedFrames, float * lastMissedUsage, float * usage ) { - static PFNGLXGETUSTPROC get_ust; __DRIswapInfo sInfo; int status; int64_t ust; __DRIdrawablePrivate * dpriv = (__DRIdrawablePrivate *) priv; - if ( get_ust == NULL ) { - get_ust = (PFNGLXGETUSTPROC) glXGetProcAddress( (const GLubyte *) "__glXGetUST" ); - } status = dpriv->driScreenPriv->DriverAPI.GetSwapInfo( dpriv, & sInfo ); if ( status == 0 ) { @@ -1049,7 +1007,7 @@ driQueryFrameTracking( __DRInativeDisplay * dpy, void * priv, *missedFrames = sInfo.swap_missed_count; *lastMissedUsage = sInfo.swap_missed_usage; - (*get_ust)( & ust ); + (*dri_interface->getUST)( & ust ); *usage = driCalculateSwapUsage( dpriv, sInfo.swap_ust, ust ); } @@ -1089,20 +1047,13 @@ float driCalculateSwapUsage( __DRIdrawablePrivate *dPriv, int64_t last_swap_ust, int64_t current_ust ) { - static PFNGLXGETMSCRATEOMLPROC get_msc_rate = NULL; int32_t n; int32_t d; int interval; float usage = 1.0; - if ( get_msc_rate == NULL ) { - get_msc_rate = (PFNGLXGETMSCRATEOMLPROC) - glXGetProcAddress( (const GLubyte *) "glXGetMscRateOML" ); - } - - if ( (get_msc_rate != NULL) - && get_msc_rate( dPriv->display, dPriv->draw, &n, &d ) ) { + if ( (*dri_interface->getMSCRate)( dPriv->display, dPriv->draw, &n, &d ) ) { interval = (dPriv->pdraw->swap_interval != 0) ? dPriv->pdraw->swap_interval : 1; diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index 3e2aa1f52d8..a5e907e7261 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -314,7 +314,7 @@ struct __DRIdrawablePrivateRec { * \name Display and screen information. * * Basically just need these for when the locking code needs to call - * __driUtilUpdateDrawableInfo() which calls XF86DRIGetDrawableInfo(). + * \c __driUtilUpdateDrawableInfo. */ /*@{*/ __DRInativeDisplay *display; @@ -325,12 +325,6 @@ struct __DRIdrawablePrivateRec { * Called via glXSwapBuffers(). */ void (*swapBuffers)( __DRIdrawablePrivate *dPriv ); - - /** - * Get information about the location, size, and clip rects of the - * drawable within the display. - */ - PFNGLXGETDRAWABLEINFOPROC getInfo; }; /** @@ -549,10 +543,12 @@ extern float driCalculateSwapUsage( __DRIdrawablePrivate *dPriv, int64_t last_swap_ust, int64_t current_ust ); -/* Test for the GLX header glx.h */ -#ifndef GLX -extern void -(*glXGetProcAddress(const GLubyte *procname))( void ); -#endif +/** + * Pointer to the \c __DRIinterfaceMethods passed to the driver by the loader. + * + * This pointer is set in the driver's \c __driCreateNewScreen function and + * is defined in dri_util.c. + */ +extern const __DRIinterfaceMethods * dri_interface; #endif /* _DRI_UTIL_H_ */ diff --git a/src/mesa/drivers/dri/fb/fb_dri.c b/src/mesa/drivers/dri/fb/fb_dri.c index 6f4ffc078e5..e2ba66d2e7b 100644 --- a/src/mesa/drivers/dri/fb/fb_dri.c +++ b/src/mesa/drivers/dri/fb/fb_dri.c @@ -73,7 +73,6 @@ typedef struct { #define FB_CONTEXT(ctx) ((fbContextPtr)(ctx->DriverCtx)) -static PFNGLXCREATECONTEXTMODES create_context_modes = NULL; static const GLubyte * get_string(GLcontext *ctx, GLenum pname) @@ -706,7 +705,7 @@ fbFillInModes( unsigned pixel_bits, unsigned depth_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, depth_buffer_factor, @@ -777,15 +776,10 @@ void * __driCreateNewScreen( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc frame_buffer, pSAREA, fd, internal_api_version, &fbAPI); if ( psp != NULL ) { - create_context_modes = (PFNGLXCREATECONTEXTMODES) - glXGetProcAddress( (const GLubyte *) "__glXCreateContextModes" ); - if ( create_context_modes != NULL ) { - - *driver_modes = fbFillInModes( psp->fbBPP, - (psp->fbBPP == 16) ? 16 : 24, - (psp->fbBPP == 16) ? 0 : 8, - 1); - } + *driver_modes = fbFillInModes( psp->fbBPP, + (psp->fbBPP == 16) ? 16 : 24, + (psp->fbBPP == 16) ? 0 : 8, + 1); } return (void *) psp; diff --git a/src/mesa/drivers/dri/ffb/ffb_xmesa.c b/src/mesa/drivers/dri/ffb/ffb_xmesa.c index c516cae2f2d..f49b40aa833 100644 --- a/src/mesa/drivers/dri/ffb/ffb_xmesa.c +++ b/src/mesa/drivers/dri/ffb/ffb_xmesa.c @@ -616,8 +616,6 @@ static const struct __DriverAPIRec ffbAPI = { }; -static PFNGLXCREATECONTEXTMODES create_context_modes = NULL; - static __GLcontextModes * ffbFillInModes( unsigned pixel_bits, unsigned depth_bits, unsigned stencil_bits, GLboolean have_back_buffer ) @@ -667,7 +665,7 @@ ffbFillInModes( unsigned pixel_bits, unsigned depth_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, depth_buffer_factor, @@ -710,7 +708,7 @@ ffbFillInModes( unsigned pixel_bits, unsigned depth_bits, * failure. */ PUBLIC -void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, +void * __driCreateNewScreen_20050725( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, const __GLcontextModes * modes, const __DRIversion * ddx_version, const __DRIversion * dri_version, @@ -718,6 +716,7 @@ void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, __DRIsc const __DRIframebuffer * frame_buffer, drmAddress pSAREA, int fd, int internal_api_version, + const __DRIinterfaceMethods * interface, __GLcontextModes ** driver_modes ) { @@ -726,6 +725,8 @@ void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, __DRIsc static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion drm_expected = { 0, 0, 1 }; + dri_interface = interface; + if ( ! driCheckDriDdxDrmVersions2( "ffb", dri_version, & dri_expected, ddx_version, & ddx_expected, @@ -738,11 +739,7 @@ void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, __DRIsc frame_buffer, pSAREA, fd, internal_api_version, &ffbAPI); if ( psp != NULL ) { - create_context_modes = (PFNGLXCREATECONTEXTMODES) - glXGetProcAddress( (const GLubyte *) "__glXCreateContextModes" ); - if ( create_context_modes != NULL ) { - *driver_modes = ffbFillInModes( 32, 16, 0, GL_TRUE ); - } + *driver_modes = ffbFillInModes( 32, 16, 0, GL_TRUE ); } return (void *) psp; diff --git a/src/mesa/drivers/dri/i810/i810screen.c b/src/mesa/drivers/dri/i810/i810screen.c index 0eacdd75f07..1b9d4aa3699 100644 --- a/src/mesa/drivers/dri/i810/i810screen.c +++ b/src/mesa/drivers/dri/i810/i810screen.c @@ -54,8 +54,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "GL/internal/dri_interface.h" -static PFNGLXCREATECONTEXTMODES create_context_modes = NULL; - static __GLcontextModes *fill_in_modes( __GLcontextModes *modes, unsigned pixel_bits, unsigned depth_bits, @@ -158,7 +156,7 @@ i810FillInModes( unsigned pixel_bits, unsigned depth_bits, num_modes = depth_buffer_factor * back_buffer_factor * 4; - modes = (*create_context_modes)( num_modes, sizeof( __GLcontextModes ) ); + modes = (*dri_interface->createContextModes)( num_modes, sizeof( __GLcontextModes ) ); m = modes; for ( i = 0 ; i < depth_buffer_factor ; i++ ) { m = fill_in_modes( m, pixel_bits, @@ -426,7 +424,7 @@ static const struct __DriverAPIRec i810API = { * failure. */ PUBLIC -void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, +void * __driCreateNewScreen_20050725( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, const __GLcontextModes * modes, const __DRIversion * ddx_version, const __DRIversion * dri_version, @@ -434,6 +432,7 @@ void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, __DRIsc const __DRIframebuffer * frame_buffer, drmAddress pSAREA, int fd, int internal_api_version, + const __DRIinterfaceMethods * interface, __GLcontextModes ** driver_modes ) { @@ -442,6 +441,8 @@ void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, __DRIsc static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion drm_expected = { 1, 2, 0 }; + dri_interface = interface; + if ( ! driCheckDriDdxDrmVersions2( "i810", dri_version, & dri_expected, ddx_version, & ddx_expected, @@ -454,13 +455,9 @@ void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, __DRIsc frame_buffer, pSAREA, fd, internal_api_version, &i810API); if ( psp != NULL ) { - create_context_modes = (PFNGLXCREATECONTEXTMODES) - glXGetProcAddress( (const GLubyte *) "__glXCreateContextModes" ); - if ( create_context_modes != NULL ) { - *driver_modes = i810FillInModes( 16, - 16, 0, - 1); - } + *driver_modes = i810FillInModes( 16, + 16, 0, + 1); } return (void *) psp; diff --git a/src/mesa/drivers/dri/i830/i830_screen.c b/src/mesa/drivers/dri/i830/i830_screen.c index 99155c66007..c77657d6f06 100644 --- a/src/mesa/drivers/dri/i830/i830_screen.c +++ b/src/mesa/drivers/dri/i830/i830_screen.c @@ -67,7 +67,6 @@ DRI_CONF_BEGIN DRI_CONF_END; const GLuint __driNConfigOptions = 2; -static PFNGLXCREATECONTEXTMODES create_context_modes = NULL; static int i830_malloc_proxy_buf(drmBufMapPtr buffers) { @@ -143,7 +142,7 @@ static GLboolean i830InitDriver(__DRIscreenPrivate *sPriv) i830ScreenPrivate *i830Screen; I830DRIPtr gDRIPriv = (I830DRIPtr)sPriv->pDevPriv; PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = - (PFNGLXSCRENABLEEXTENSIONPROC) glXGetProcAddress( (const GLubyte *) "__glXScrEnableExtension" ); + (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); void * const psc = sPriv->psc->screenConfigs; @@ -467,7 +466,7 @@ i830FillInModes( unsigned pixel_bits, unsigned depth_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, depth_buffer_factor, @@ -503,7 +502,7 @@ i830FillInModes( unsigned pixel_bits, unsigned depth_bits, * failure. */ PUBLIC -void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, +void * __driCreateNewScreen_20050725( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, const __GLcontextModes * modes, const __DRIversion * ddx_version, const __DRIversion * dri_version, @@ -511,6 +510,7 @@ void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, __DRIsc const __DRIframebuffer * frame_buffer, drmAddress pSAREA, int fd, int internal_api_version, + const __DRIinterfaceMethods * interface, __GLcontextModes ** driver_modes ) { @@ -519,6 +519,8 @@ void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, __DRIsc static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion drm_expected = { 1, 3, 0 }; + dri_interface = interface; + if ( ! driCheckDriDdxDrmVersions2( "i830", dri_version, & dri_expected, ddx_version, & ddx_expected, @@ -531,15 +533,11 @@ void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, __DRIsc frame_buffer, pSAREA, fd, internal_api_version, &i830API); if ( psp != NULL ) { - create_context_modes = (PFNGLXCREATECONTEXTMODES) - glXGetProcAddress( (const GLubyte *) "__glXCreateContextModes" ); - if ( create_context_modes != NULL ) { - I830DRIPtr dri_priv = (I830DRIPtr) psp->pDevPriv; - *driver_modes = i830FillInModes( dri_priv->cpp * 8, - (dri_priv->cpp == 2) ? 16 : 24, - (dri_priv->cpp == 2) ? 0 : 8, - (dri_priv->backOffset != dri_priv->depthOffset) ); - } + I830DRIPtr dri_priv = (I830DRIPtr) psp->pDevPriv; + *driver_modes = i830FillInModes( dri_priv->cpp * 8, + (dri_priv->cpp == 2) ? 16 : 24, + (dri_priv->cpp == 2) ? 0 : 8, + (dri_priv->backOffset != dri_priv->depthOffset) ); } return (void *) psp; diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c index 5e3826a6886..71a8aeba1e8 100644 --- a/src/mesa/drivers/dri/i915/intel_screen.c +++ b/src/mesa/drivers/dri/i915/intel_screen.c @@ -54,8 +54,6 @@ DRI_CONF_BEGIN DRI_CONF_END; const GLuint __driNConfigOptions = 1; -static PFNGLXCREATECONTEXTMODES create_context_modes = NULL; - static void intelPrintDRIInfo(intelScreenPrivate *intelScreen, __DRIscreenPrivate *sPriv, @@ -77,7 +75,7 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv) intelScreenPrivate *intelScreen; I830DRIPtr gDRIPriv = (I830DRIPtr)sPriv->pDevPriv; PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = - (PFNGLXSCRENABLEEXTENSIONPROC) glXGetProcAddress( (const GLubyte *) "__glXScrEnableExtension" ); + (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); void * const psc = sPriv->psc->screenConfigs; @@ -417,7 +415,7 @@ intelFillInModes( unsigned pixel_bits, unsigned depth_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, depth_buffer_factor, @@ -453,7 +451,7 @@ intelFillInModes( unsigned pixel_bits, unsigned depth_bits, * failure. */ PUBLIC -void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, +void * __driCreateNewScreen_20050725( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, const __GLcontextModes * modes, const __DRIversion * ddx_version, const __DRIversion * dri_version, @@ -461,6 +459,7 @@ void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, __DRIsc const __DRIframebuffer * frame_buffer, drmAddress pSAREA, int fd, int internal_api_version, + const __DRIinterfaceMethods * interface, __GLcontextModes ** driver_modes ) { @@ -469,6 +468,8 @@ void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, __DRIsc static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion drm_expected = { 1, 1, 0 }; + dri_interface = interface; + if ( ! driCheckDriDdxDrmVersions2( "i915", dri_version, & dri_expected, ddx_version, & ddx_expected, @@ -481,15 +482,11 @@ void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, __DRIsc frame_buffer, pSAREA, fd, internal_api_version, &intelAPI); if ( psp != NULL ) { - create_context_modes = (PFNGLXCREATECONTEXTMODES) - glXGetProcAddress( (const GLubyte *) "__glXCreateContextModes" ); - if ( create_context_modes != NULL ) { - I830DRIPtr dri_priv = (I830DRIPtr) psp->pDevPriv; - *driver_modes = intelFillInModes( dri_priv->cpp * 8, - (dri_priv->cpp == 2) ? 16 : 24, - (dri_priv->cpp == 2) ? 0 : 8, - (dri_priv->backOffset != dri_priv->depthOffset) ); - } + I830DRIPtr dri_priv = (I830DRIPtr) psp->pDevPriv; + *driver_modes = intelFillInModes( dri_priv->cpp * 8, + (dri_priv->cpp == 2) ? 16 : 24, + (dri_priv->cpp == 2) ? 0 : 8, + (dri_priv->backOffset != dri_priv->depthOffset) ); } return (void *) psp; diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.c b/src/mesa/drivers/dri/mach64/mach64_screen.c index fd9acec36f4..91aa31eecc0 100644 --- a/src/mesa/drivers/dri/mach64/mach64_screen.c +++ b/src/mesa/drivers/dri/mach64/mach64_screen.c @@ -67,7 +67,6 @@ static const GLuint __driNConfigOptions = 3; static const GLuint __driNConfigOptions = 2; #endif -static PFNGLXCREATECONTEXTMODES create_context_modes = NULL; static __GLcontextModes * fill_in_modes( __GLcontextModes * modes, unsigned pixel_bits, @@ -173,7 +172,7 @@ mach64FillInModes( unsigned pixel_bits, unsigned depth_bits, num_modes = depth_buffer_factor * back_buffer_factor * 4; - modes = (*create_context_modes)( num_modes, sizeof( __GLcontextModes ) ); + modes = (*dri_interface->createContextModes)( num_modes, sizeof( __GLcontextModes ) ); m = modes; for ( i = 0 ; i < depth_buffer_factor ; i++ ) { m = fill_in_modes( m, pixel_bits, @@ -209,7 +208,7 @@ mach64CreateScreen( __DRIscreenPrivate *sPriv ) mach64ScreenPtr mach64Screen; ATIDRIPtr serverInfo = (ATIDRIPtr)sPriv->pDevPriv; PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = - (PFNGLXSCRENABLEEXTENSIONPROC) glXGetProcAddress( (const GLubyte *) "__glXScrEnableExtension" ); + (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); void * const psc = sPriv->psc->screenConfigs; @@ -499,7 +498,7 @@ static struct __DriverAPIRec mach64API = { * failure. */ PUBLIC -void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, +void * __driCreateNewScreen_20050725( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, const __GLcontextModes * modes, const __DRIversion * ddx_version, const __DRIversion * dri_version, @@ -507,6 +506,7 @@ void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, __DRIsc const __DRIframebuffer * frame_buffer, drmAddress pSAREA, int fd, int internal_api_version, + const __DRIinterfaceMethods * interface, __GLcontextModes ** driver_modes ) { @@ -515,6 +515,8 @@ void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, __DRIsc static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion drm_expected = { 1, 0, 0 }; + dri_interface = interface; + if ( ! driCheckDriDdxDrmVersions2( "Mach64", dri_version, & dri_expected, ddx_version, & ddx_expected, @@ -527,15 +529,11 @@ void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, __DRIsc frame_buffer, pSAREA, fd, internal_api_version, &mach64API); if ( psp != NULL ) { - create_context_modes = (PFNGLXCREATECONTEXTMODES) - glXGetProcAddress( (const GLubyte *) "__glXCreateContextModes" ); - if ( create_context_modes != NULL ) { - ATIDRIPtr dri_priv = (ATIDRIPtr) psp->pDevPriv; - *driver_modes = mach64FillInModes( dri_priv->cpp * 8, - 16, - 0, - 1); - } + ATIDRIPtr dri_priv = (ATIDRIPtr) psp->pDevPriv; + *driver_modes = mach64FillInModes( dri_priv->cpp * 8, + 16, + 0, + 1); } return (void *) psp; diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c index aaa4e25c103..e310f619586 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.c +++ b/src/mesa/drivers/dri/mga/mga_xmesa.c @@ -104,8 +104,6 @@ DRI_CONF_BEGIN DRI_CONF_END; static const GLuint __driNConfigOptions = 6; -static PFNGLXCREATECONTEXTMODES create_context_modes = NULL; - #ifndef MGA_DEBUG int MGA_DEBUG = 0; #endif @@ -161,7 +159,7 @@ mgaFillInModes( unsigned pixel_bits, unsigned depth_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, depth_buffer_factor, @@ -199,7 +197,7 @@ mgaInitDriver(__DRIscreenPrivate *sPriv) mgaScreenPrivate *mgaScreen; MGADRIPtr serverInfo = (MGADRIPtr)sPriv->pDevPriv; PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = - (PFNGLXSCRENABLEEXTENSIONPROC) glXGetProcAddress( (const GLubyte *) "__glXScrEnableExtension" ); + (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); void * const psc = sPriv->psc->screenConfigs; @@ -436,14 +434,6 @@ static const struct dri_debug_control debug_control[] = }; -static int -get_ust_nop( int64_t * ust ) -{ - *ust = 1; - return 0; -} - - static GLboolean mgaCreateContext( const __GLcontextModes *mesaVis, __DRIcontextPrivate *driContextPriv, @@ -654,12 +644,7 @@ mgaCreateContext( const __GLcontextModes *mesaVis, mmesa->vblank_flags = (mmesa->mgaScreen->irq == 0) ? VBLANK_FLAG_NO_IRQ : driGetDefaultVBlankFlags(&mmesa->optionCache); - mmesa->get_ust = (PFNGLXGETUSTPROC) glXGetProcAddress( (const GLubyte *) "__glXGetUST" ); - if ( mmesa->get_ust == NULL ) { - mmesa->get_ust = get_ust_nop; - } - - (*mmesa->get_ust)( & mmesa->swap_ust ); + (*dri_interface->getUST)( & mmesa->swap_ust ); if (driQueryOptionb(&mmesa->optionCache, "no_rast")) { fprintf(stderr, "disabling 3D acceleration\n"); @@ -949,7 +934,7 @@ static const struct __DriverAPIRec mgaAPI = { * failure. */ PUBLIC -void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, +void * __driCreateNewScreen_20050725( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, const __GLcontextModes * modes, const __DRIversion * ddx_version, const __DRIversion * dri_version, @@ -957,6 +942,7 @@ void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, __DRIsc const __DRIframebuffer * frame_buffer, drmAddress pSAREA, int fd, int internal_api_version, + const __DRIinterfaceMethods * interface, __GLcontextModes ** driver_modes ) { @@ -965,6 +951,8 @@ void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, __DRIsc static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion drm_expected = { 3, 0, 0 }; + dri_interface = interface; + if ( ! driCheckDriDdxDrmVersions2( "MGA", dri_version, & dri_expected, ddx_version, & ddx_expected, @@ -977,15 +965,11 @@ void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, __DRIsc frame_buffer, pSAREA, fd, internal_api_version, &mgaAPI); if ( psp != NULL ) { - create_context_modes = (PFNGLXCREATECONTEXTMODES) - glXGetProcAddress( (const GLubyte *) "__glXCreateContextModes" ); - if ( create_context_modes != NULL ) { - MGADRIPtr dri_priv = (MGADRIPtr) psp->pDevPriv; - *driver_modes = mgaFillInModes( dri_priv->cpp * 8, - (dri_priv->cpp == 2) ? 16 : 24, - (dri_priv->cpp == 2) ? 0 : 8, - (dri_priv->backOffset != dri_priv->depthOffset) ); - } + MGADRIPtr dri_priv = (MGADRIPtr) psp->pDevPriv; + *driver_modes = mgaFillInModes( dri_priv->cpp * 8, + (dri_priv->cpp == 2) ? 16 : 24, + (dri_priv->cpp == 2) ? 0 : 8, + (dri_priv->backOffset != dri_priv->depthOffset) ); } return (void *) psp; diff --git a/src/mesa/drivers/dri/mga/mgacontext.h b/src/mesa/drivers/dri/mga/mgacontext.h index 1d8c5da6dae..81348b6c7f9 100644 --- a/src/mesa/drivers/dri/mga/mgacontext.h +++ b/src/mesa/drivers/dri/mga/mgacontext.h @@ -271,8 +271,6 @@ struct mga_context_t { uint32_t last_frame_fence; - PFNGLXGETUSTPROC get_ust; - /* Drawable, cliprect and scissor information */ int dirty_cliprects; /* which sets of cliprects are uptodate? */ diff --git a/src/mesa/drivers/dri/mga/mgaioctl.c b/src/mesa/drivers/dri/mga/mgaioctl.c index 62785f6344b..df253d15934 100644 --- a/src/mesa/drivers/dri/mga/mgaioctl.c +++ b/src/mesa/drivers/dri/mga/mgaioctl.c @@ -424,7 +424,7 @@ void mgaCopyBuffer( const __DRIdrawablePrivate *dPriv ) & missed_target ); if ( missed_target ) { mmesa->swap_missed_count++; - (void) (*mmesa->get_ust)( & mmesa->swap_missed_ust ); + (void) (*dri_interface->getUST)( & mmesa->swap_missed_ust ); } LOCK_HARDWARE( mmesa ); @@ -462,7 +462,7 @@ void mgaCopyBuffer( const __DRIdrawablePrivate *dPriv ) mmesa->dirty |= MGA_UPLOAD_CLIPRECTS; mmesa->swap_count++; - (void) (*mmesa->get_ust)( & mmesa->swap_ust ); + (void) (*dri_interface->getUST)( & mmesa->swap_ust ); } diff --git a/src/mesa/drivers/dri/r128/r128_screen.c b/src/mesa/drivers/dri/r128/r128_screen.c index a5c2a6d1542..f5d0287ed9f 100644 --- a/src/mesa/drivers/dri/r128/r128_screen.c +++ b/src/mesa/drivers/dri/r128/r128_screen.c @@ -88,7 +88,6 @@ static const GLuint __driNConfigOptions = 3; #define PCI_CHIP_RAGE128RL 0x524C #endif -static PFNGLXCREATECONTEXTMODES create_context_modes = NULL; /* Create the device specific screen private data struct. */ @@ -98,7 +97,7 @@ r128CreateScreen( __DRIscreenPrivate *sPriv ) r128ScreenPtr r128Screen; R128DRIPtr r128DRIPriv = (R128DRIPtr)sPriv->pDevPriv; PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = - (PFNGLXSCRENABLEEXTENSIONPROC) glXGetProcAddress( (const GLubyte *) "__glXScrEnableExtension" ); + (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); void * const psc = sPriv->psc->screenConfigs; @@ -440,7 +439,7 @@ r128FillInModes( unsigned pixel_bits, unsigned depth_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, depth_buffer_factor, @@ -483,7 +482,7 @@ r128FillInModes( unsigned pixel_bits, unsigned depth_bits, * failure. */ PUBLIC -void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, +void * __driCreateNewScreen_20050725( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, const __GLcontextModes * modes, const __DRIversion * ddx_version, const __DRIversion * dri_version, @@ -491,6 +490,7 @@ void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, __DRIsc const __DRIframebuffer * frame_buffer, drmAddress pSAREA, int fd, int internal_api_version, + const __DRIinterfaceMethods * interface, __GLcontextModes ** driver_modes ) { @@ -500,6 +500,8 @@ void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, __DRIsc static const __DRIversion drm_expected = { 2, 2, 0 }; + dri_interface = interface; + if ( ! driCheckDriDdxDrmVersions2( "Rage128", dri_version, & dri_expected, ddx_version, & ddx_expected, @@ -512,15 +514,11 @@ void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, __DRIsc frame_buffer, pSAREA, fd, internal_api_version, &r128API); if ( psp != NULL ) { - create_context_modes = (PFNGLXCREATECONTEXTMODES) - glXGetProcAddress( (const GLubyte *) "__glXCreateContextModes" ); - if ( create_context_modes != NULL ) { - R128DRIPtr dri_priv = (R128DRIPtr) psp->pDevPriv; - *driver_modes = r128FillInModes( dri_priv->bpp, - (dri_priv->bpp == 16) ? 16 : 24, - (dri_priv->bpp == 16) ? 0 : 8, - (dri_priv->backOffset != dri_priv->depthOffset) ); - } + R128DRIPtr dri_priv = (R128DRIPtr) psp->pDevPriv; + *driver_modes = r128FillInModes( dri_priv->bpp, + (dri_priv->bpp == 16) ? 16 : 24, + (dri_priv->bpp == 16) ? 0 : 8, + (dri_priv->backOffset != dri_priv->depthOffset) ); } return (void *) psp; diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c index 7c543a55ec8..06834fb626e 100644 --- a/src/mesa/drivers/dri/r200/r200_context.c +++ b/src/mesa/drivers/dri/r200/r200_context.c @@ -249,14 +249,6 @@ static const struct dri_debug_control debug_control[] = }; -static int -get_ust_nop( int64_t * ust ) -{ - *ust = 1; - return 0; -} - - /* Create the device specific rendering context. */ GLboolean r200CreateContext( const __GLcontextModes *glVisual, @@ -509,11 +501,7 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual, rmesa->prefer_gart_client_texturing = (getenv("R200_GART_CLIENT_TEXTURES") != 0); - rmesa->get_ust = (PFNGLXGETUSTPROC) glXGetProcAddress( (const GLubyte *) "__glXGetUST" ); - if ( rmesa->get_ust == NULL ) { - rmesa->get_ust = get_ust_nop; - } - (*rmesa->get_ust)( & rmesa->swap_ust ); + (*dri_interface->getUST)( & rmesa->swap_ust ); #if DO_DEBUG diff --git a/src/mesa/drivers/dri/r200/r200_context.h b/src/mesa/drivers/dri/r200/r200_context.h index 5e3fb2295d5..8169af709b7 100644 --- a/src/mesa/drivers/dri/r200/r200_context.h +++ b/src/mesa/drivers/dri/r200/r200_context.h @@ -912,7 +912,6 @@ struct r200_context { GLuint swap_count; GLuint swap_missed_count; - PFNGLXGETUSTPROC get_ust; /* r200_tcl.c */ diff --git a/src/mesa/drivers/dri/r200/r200_ioctl.c b/src/mesa/drivers/dri/r200/r200_ioctl.c index ad43158d64a..a2336ce4f3d 100644 --- a/src/mesa/drivers/dri/r200/r200_ioctl.c +++ b/src/mesa/drivers/dri/r200/r200_ioctl.c @@ -486,7 +486,7 @@ void r200CopyBuffer( const __DRIdrawablePrivate *dPriv ) rmesa->hw.all_dirty = GL_TRUE; rmesa->swap_count++; - (*rmesa->get_ust)( & ust ); + (*dri_interface->getUST)( & ust ); if ( missed_target ) { rmesa->swap_missed_count++; rmesa->swap_missed_ust = ust - rmesa->swap_ust; @@ -540,7 +540,7 @@ void r200PageFlip( const __DRIdrawablePrivate *dPriv ) driWaitForVBlank( dPriv, & rmesa->vbl_seq, rmesa->vblank_flags, & missed_target ); if ( missed_target ) { rmesa->swap_missed_count++; - (void) (*rmesa->get_ust)( & rmesa->swap_missed_ust ); + (void) (*dri_interface->getUST)( & rmesa->swap_missed_ust ); } LOCK_HARDWARE( rmesa ); @@ -554,7 +554,7 @@ void r200PageFlip( const __DRIdrawablePrivate *dPriv ) } rmesa->swap_count++; - (void) (*rmesa->get_ust)( & rmesa->swap_ust ); + (void) (*dri_interface->getUST)( & rmesa->swap_ust ); if ( rmesa->sarea->pfCurrentPage == 1 ) { rmesa->state.color.drawOffset = rmesa->r200Screen->frontOffset; diff --git a/src/mesa/drivers/dri/r200/r200_screen.c b/src/mesa/drivers/dri/r200/r200_screen.c index 014818ac1b6..ddb3a91b1dc 100644 --- a/src/mesa/drivers/dri/r200/r200_screen.c +++ b/src/mesa/drivers/dri/r200/r200_screen.c @@ -136,7 +136,6 @@ static const GLuint __driNConfigOptions = 17; #endif -static PFNGLXCREATECONTEXTMODES create_context_modes = NULL; static r200ScreenPtr __r200Screen; @@ -191,7 +190,7 @@ r200FillInModes( unsigned pixel_bits, unsigned depth_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, depth_buffer_factor, @@ -232,7 +231,7 @@ r200CreateScreen( __DRIscreenPrivate *sPriv ) RADEONDRIPtr dri_priv = (RADEONDRIPtr)sPriv->pDevPriv; unsigned char *RADEONMMIO; PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = - (PFNGLXSCRENABLEEXTENSIONPROC) glXGetProcAddress( (const GLubyte *) "__glXScrEnableExtension" ); + (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); void * const psc = sPriv->psc->screenConfigs; @@ -643,7 +642,7 @@ static const struct __DriverAPIRec r200API = { * failure. */ PUBLIC -void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, +void * __driCreateNewScreen_20050725( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, const __GLcontextModes * modes, const __DRIversion * ddx_version, const __DRIversion * dri_version, @@ -651,6 +650,7 @@ void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, __DRIsc const __DRIframebuffer * frame_buffer, drmAddress pSAREA, int fd, int internal_api_version, + const __DRIinterfaceMethods * interface, __GLcontextModes ** driver_modes ) { @@ -659,6 +659,8 @@ void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, __DRIsc static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion drm_expected = { 1, 5, 0 }; + dri_interface = interface; + if ( ! driCheckDriDdxDrmVersions3( "R200", dri_version, & dri_expected, ddx_version, & ddx_expected, @@ -671,15 +673,11 @@ void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, __DRIsc frame_buffer, pSAREA, fd, internal_api_version, &r200API); if ( psp != NULL ) { - create_context_modes = (PFNGLXCREATECONTEXTMODES) - glXGetProcAddress( (const GLubyte *) "__glXCreateContextModes" ); - if ( create_context_modes != NULL ) { - RADEONDRIPtr dri_priv = (RADEONDRIPtr) psp->pDevPriv; - *driver_modes = r200FillInModes( 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 = r200FillInModes( dri_priv->bpp, + (dri_priv->bpp == 16) ? 16 : 24, + (dri_priv->bpp == 16) ? 0 : 8, + (dri_priv->backOffset != dri_priv->depthOffset) ); } return (void *) psp; diff --git a/src/mesa/drivers/dri/r300/radeon_context.c b/src/mesa/drivers/dri/r300/radeon_context.c index 8c712dc2033..97507617cd7 100644 --- a/src/mesa/drivers/dri/r300/radeon_context.c +++ b/src/mesa/drivers/dri/r300/radeon_context.c @@ -124,12 +124,6 @@ static void radeonInitDriverFuncs(struct dd_function_table *functions) } -static int get_ust_nop(int64_t * ust) -{ - *ust = 1; - return 0; -} - /** * Create and initialize all common fields of the context, * including the Mesa context itself. @@ -195,13 +189,7 @@ GLboolean radeonInitContext(radeonContextPtr radeon, radeon->vblank_flags = (radeon->radeonScreen->irq != 0) ? driGetDefaultVBlankFlags(&radeon->optionCache) : VBLANK_FLAG_NO_IRQ; - radeon->get_ust = - (PFNGLXGETUSTPROC) glXGetProcAddress((const GLubyte *) - "__glXGetUST"); - if (radeon->get_ust == NULL) { - radeon->get_ust = get_ust_nop; - } - (*radeon->get_ust) (&radeon->swap_ust); + (*dri_interface->getUST) (&radeon->swap_ust); return GL_TRUE; } diff --git a/src/mesa/drivers/dri/r300/radeon_context.h b/src/mesa/drivers/dri/r300/radeon_context.h index 84fcaee7181..189bc6ad021 100644 --- a/src/mesa/drivers/dri/r300/radeon_context.h +++ b/src/mesa/drivers/dri/r300/radeon_context.h @@ -196,7 +196,6 @@ struct radeon_context { GLuint swap_count; GLuint swap_missed_count; - PFNGLXGETUSTPROC get_ust; /* Derived state */ struct radeon_state state; diff --git a/src/mesa/drivers/dri/r300/radeon_ioctl.c b/src/mesa/drivers/dri/r300/radeon_ioctl.c index 1f2f71c29ab..af489e2a842 100644 --- a/src/mesa/drivers/dri/r300/radeon_ioctl.c +++ b/src/mesa/drivers/dri/r300/radeon_ioctl.c @@ -208,7 +208,7 @@ void radeonCopyBuffer(const __DRIdrawablePrivate * dPriv) ((r300ContextPtr)radeon)->hw.all_dirty = GL_TRUE; radeon->swap_count++; - (*radeon->get_ust) (&ust); + (*dri_interface->getUST) (&ust); if (missed_target) { radeon->swap_missed_count++; radeon->swap_missed_ust = ust - radeon->swap_ust; @@ -266,7 +266,7 @@ void radeonPageFlip(const __DRIdrawablePrivate * dPriv) &missed_target); if (missed_target) { radeon->swap_missed_count++; - (void)(*radeon->get_ust) (&radeon->swap_missed_ust); + (void)(*dri_interface->getUST) (&radeon->swap_missed_ust); } LOCK_HARDWARE(radeon); @@ -280,7 +280,7 @@ void radeonPageFlip(const __DRIdrawablePrivate * dPriv) } radeon->swap_count++; - (void)(*radeon->get_ust) (&radeon->swap_ust); + (void)(*dri_interface->getUST) (&radeon->swap_ust); if (radeon->sarea->pfCurrentPage == 1) { radeon->state.color.drawOffset = radeon->radeonScreen->frontOffset; diff --git a/src/mesa/drivers/dri/r300/radeon_screen.c b/src/mesa/drivers/dri/r300/radeon_screen.c index ea9b9ea2669..34f5d84e361 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; diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c index e6149e1a580..12f5f401151 100644 --- a/src/mesa/drivers/dri/radeon/radeon_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_context.c @@ -213,14 +213,6 @@ static const struct dri_debug_control debug_control[] = }; -static int -get_ust_nop( int64_t * ust ) -{ - *ust = 1; - return 0; -} - - /* Create the device specific context. */ GLboolean @@ -450,11 +442,7 @@ radeonCreateContext( const __GLcontextModes *glVisual, rmesa->vblank_flags = (rmesa->radeonScreen->irq != 0) ? driGetDefaultVBlankFlags(&rmesa->optionCache) : VBLANK_FLAG_NO_IRQ; - rmesa->get_ust = (PFNGLXGETUSTPROC) glXGetProcAddress( (const GLubyte *) "__glXGetUST" ); - if ( rmesa->get_ust == NULL ) { - rmesa->get_ust = get_ust_nop; - } - (*rmesa->get_ust)( & rmesa->swap_ust ); + (*dri_interface->getUST)( & rmesa->swap_ust ); #if DO_DEBUG diff --git a/src/mesa/drivers/dri/radeon/radeon_context.h b/src/mesa/drivers/dri/radeon/radeon_context.h index 3019602b7cf..621a4c65574 100644 --- a/src/mesa/drivers/dri/radeon/radeon_context.h +++ b/src/mesa/drivers/dri/radeon/radeon_context.h @@ -775,7 +775,6 @@ struct radeon_context { GLuint swap_count; GLuint swap_missed_count; - PFNGLXGETUSTPROC get_ust; /* radeon_tcl.c */ diff --git a/src/mesa/drivers/dri/radeon/radeon_ioctl.c b/src/mesa/drivers/dri/radeon/radeon_ioctl.c index 3e1fc4bafff..53c5d5ca537 100644 --- a/src/mesa/drivers/dri/radeon/radeon_ioctl.c +++ b/src/mesa/drivers/dri/radeon/radeon_ioctl.c @@ -935,7 +935,7 @@ void radeonCopyBuffer( const __DRIdrawablePrivate *dPriv ) UNLOCK_HARDWARE( rmesa ); rmesa->swap_count++; - (*rmesa->get_ust)( & ust ); + (*dri_interface->getUST)( & ust ); if ( missed_target ) { rmesa->swap_missed_count++; rmesa->swap_missed_ust = ust - rmesa->swap_ust; @@ -983,7 +983,7 @@ void radeonPageFlip( const __DRIdrawablePrivate *dPriv ) driWaitForVBlank( dPriv, & rmesa->vbl_seq, rmesa->vblank_flags, & missed_target ); if ( missed_target ) { rmesa->swap_missed_count++; - (void) (*rmesa->get_ust)( & rmesa->swap_missed_ust ); + (void) (*dri_interface->getUST)( & rmesa->swap_missed_ust ); } LOCK_HARDWARE( rmesa ); @@ -997,7 +997,7 @@ void radeonPageFlip( const __DRIdrawablePrivate *dPriv ) } rmesa->swap_count++; - (void) (*rmesa->get_ust)( & rmesa->swap_ust ); + (void) (*dri_interface->getUST)( & rmesa->swap_ust ); if ( rmesa->sarea->pfCurrentPage == 1 ) { rmesa->state.color.drawOffset = rmesa->radeonScreen->frontOffset; diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 71da86f1d17..9cd60875b1b 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -115,7 +115,6 @@ static const GLuint __driNConfigOptions = 13; #define PCI_CHIP_RS250_4437 0x4437 #endif -static PFNGLXCREATECONTEXTMODES create_context_modes = NULL; static int getSwapInfo( __DRIdrawablePrivate *dPriv, __DRIswapInfo * sInfo ); @@ -168,7 +167,7 @@ radeonFillInModes( unsigned pixel_bits, unsigned depth_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, depth_buffer_factor, @@ -208,7 +207,7 @@ radeonScreenPtr radeonCreateScreen( __DRIscreenPrivate *sPriv ) RADEONDRIPtr dri_priv = (RADEONDRIPtr)sPriv->pDevPriv; unsigned char *RADEONMMIO; PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = - (PFNGLXSCRENABLEEXTENSIONPROC) glXGetProcAddress( (const GLubyte *) "__glXScrEnableExtension" ); + (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); void * const psc = sPriv->psc->screenConfigs; @@ -567,7 +566,7 @@ static struct __DriverAPIRec radeonAPI = { * failure. */ PUBLIC -void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, +void * __driCreateNewScreen_20050725( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, const __GLcontextModes * modes, const __DRIversion * ddx_version, const __DRIversion * dri_version, @@ -575,6 +574,7 @@ void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, __DRIsc const __DRIframebuffer * frame_buffer, drmAddress pSAREA, int fd, int internal_api_version, + const __DRIinterfaceMethods * interface, __GLcontextModes ** driver_modes ) { @@ -583,6 +583,8 @@ void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, __DRIsc static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion drm_expected = { 1, 3, 0 }; + dri_interface = interface; + if ( ! driCheckDriDdxDrmVersions3( "Radeon", dri_version, & dri_expected, ddx_version, & ddx_expected, @@ -595,15 +597,11 @@ void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, __DRIsc 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; diff --git a/src/mesa/drivers/dri/savage/savage_xmesa.c b/src/mesa/drivers/dri/savage/savage_xmesa.c index 355419a84a0..bb8f015e760 100644 --- a/src/mesa/drivers/dri/savage/savage_xmesa.c +++ b/src/mesa/drivers/dri/savage/savage_xmesa.c @@ -105,7 +105,6 @@ DRI_CONF_BEGIN DRI_CONF_END; static const GLuint __driNConfigOptions = 10; -static PFNGLXCREATECONTEXTMODES create_context_modes = NULL; static const struct dri_debug_control debug_control[] = { @@ -955,7 +954,7 @@ savageFillInModes( unsigned pixel_bits, unsigned depth_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, depth_buffer_factor, @@ -998,7 +997,7 @@ savageFillInModes( unsigned pixel_bits, unsigned depth_bits, * failure. */ PUBLIC -void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, +void * __driCreateNewScreen_20050725( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, const __GLcontextModes * modes, const __DRIversion * ddx_version, const __DRIversion * dri_version, @@ -1006,6 +1005,7 @@ void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, __DRIsc const __DRIframebuffer * frame_buffer, drmAddress pSAREA, int fd, int internal_api_version, + const __DRIinterfaceMethods * interface, __GLcontextModes ** driver_modes ) { @@ -1014,6 +1014,8 @@ void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, __DRIsc static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion drm_expected = { 2, 1, 0 }; + dri_interface = interface; + if ( ! driCheckDriDdxDrmVersions2( "Savage", dri_version, & dri_expected, ddx_version, & ddx_expected, @@ -1026,15 +1028,11 @@ void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, __DRIsc frame_buffer, pSAREA, fd, internal_api_version, &savageAPI); if ( psp != NULL ) { - create_context_modes = (PFNGLXCREATECONTEXTMODES) - glXGetProcAddress( (const GLubyte *) "__glXCreateContextModes" ); - if ( create_context_modes != NULL ) { - SAVAGEDRIPtr dri_priv = (SAVAGEDRIPtr)psp->pDevPriv; - *driver_modes = savageFillInModes( dri_priv->cpp*8, - (dri_priv->cpp == 2) ? 16 : 24, - (dri_priv->cpp == 2) ? 0 : 8, - (dri_priv->backOffset != dri_priv->depthOffset) ); - } + SAVAGEDRIPtr dri_priv = (SAVAGEDRIPtr)psp->pDevPriv; + *driver_modes = savageFillInModes( dri_priv->cpp*8, + (dri_priv->cpp == 2) ? 16 : 24, + (dri_priv->cpp == 2) ? 0 : 8, + (dri_priv->backOffset != dri_priv->depthOffset) ); } return (void *) psp; diff --git a/src/mesa/drivers/dri/sis/sis_screen.c b/src/mesa/drivers/dri/sis/sis_screen.c index 56585d3cdd2..592852e9418 100644 --- a/src/mesa/drivers/dri/sis/sis_screen.c +++ b/src/mesa/drivers/dri/sis/sis_screen.c @@ -59,7 +59,6 @@ DRI_CONF_BEGIN DRI_CONF_END; static const GLuint __driNConfigOptions = 2; -static PFNGLXCREATECONTEXTMODES create_context_modes = NULL; static __GLcontextModes * sisFillInModes(int bpp) @@ -100,7 +99,7 @@ sisFillInModes(int bpp) 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, depth_buffer_factor, @@ -414,7 +413,7 @@ static struct __DriverAPIRec sisAPI = { * failure. */ PUBLIC -void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, +void * __driCreateNewScreen_20050725( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, const __GLcontextModes *modes, const __DRIversion *ddx_version, @@ -423,6 +422,7 @@ void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, const __DRIframebuffer *frame_buffer, drmAddress pSAREA, int fd, int internal_api_version, + const __DRIinterfaceMethods * interface, __GLcontextModes **driver_modes ) { @@ -431,6 +431,8 @@ void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, static const __DRIversion dri_expected = {4, 0, 0}; static const __DRIversion drm_expected = {1, 0, 0}; + dri_interface = interface; + if (!driCheckDriDdxDrmVersions2("SiS", dri_version, &dri_expected, ddx_version, &ddx_expected, drm_version, &drm_expected)) { @@ -442,12 +444,8 @@ void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, frame_buffer, pSAREA, fd, internal_api_version, &sisAPI); if (psp != NULL) { - create_context_modes = (PFNGLXCREATECONTEXTMODES) - glXGetProcAddress((const GLubyte *)"__glXCreateContextModes"); - if (create_context_modes != NULL) { - SISDRIPtr dri_priv = (SISDRIPtr)psp->pDevPriv; - *driver_modes = sisFillInModes(dri_priv->bytesPerPixel * 8); - } + SISDRIPtr dri_priv = (SISDRIPtr)psp->pDevPriv; + *driver_modes = sisFillInModes(dri_priv->bytesPerPixel * 8); } return (void *)psp; diff --git a/src/mesa/drivers/dri/tdfx/tdfx_screen.c b/src/mesa/drivers/dri/tdfx/tdfx_screen.c index 56fe39e7017..b373129646b 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_screen.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_screen.c @@ -346,7 +346,6 @@ static const struct __DriverAPIRec tdfxAPI = { .SwapBuffersMSC = NULL }; -static PFNGLXCREATECONTEXTMODES create_context_modes = NULL; static __GLcontextModes *tdfxFillInModes(unsigned pixel_bits, unsigned depth_bits, @@ -368,7 +367,7 @@ static __GLcontextModes *tdfxFillInModes(unsigned pixel_bits, num_modes = (depth_bits == 16) ? 32 : 16; - modes = (*create_context_modes)(num_modes, sizeof(__GLcontextModes)); + modes = (*dri_interface->createContextModes)(num_modes, sizeof(__GLcontextModes)); m = modes; for (i = 0; i <= 1; i++) { @@ -427,7 +426,7 @@ static __GLcontextModes *tdfxFillInModes(unsigned pixel_bits, * failure. */ PUBLIC -void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, +void * __driCreateNewScreen_20050725( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, const __GLcontextModes * modes, const __DRIversion * ddx_version, const __DRIversion * dri_version, @@ -435,6 +434,7 @@ void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, __DRIsc const __DRIframebuffer * frame_buffer, drmAddress pSAREA, int fd, int internal_api_version, + const __DRIinterfaceMethods * interface, __GLcontextModes ** driver_modes ) { __DRIscreenPrivate *psp; @@ -442,6 +442,8 @@ void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, __DRIsc static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion drm_expected = { 1, 0, 0 }; + dri_interface = interface; + if ( ! driCheckDriDdxDrmVersions2( "tdfx", dri_version, & dri_expected, ddx_version, & ddx_expected, @@ -454,10 +456,7 @@ void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, __DRIsc frame_buffer, pSAREA, fd, internal_api_version, &tdfxAPI); - create_context_modes = (PFNGLXCREATECONTEXTMODES) - glXGetProcAddress((const GLubyte *)"__glXCreateContextModes"); - - if (create_context_modes != NULL) { + if (psp != NULL) { /* divined from tdfx_dri.c, sketchy */ TDFXDRIPtr dri_priv = (TDFXDRIPtr) psp->pDevPriv; int bpp = (dri_priv->cpp > 2) ? 24 : 16; diff --git a/src/mesa/drivers/dri/trident/trident_context.c b/src/mesa/drivers/dri/trident/trident_context.c index 9f3fb26342c..0af70e96fc9 100644 --- a/src/mesa/drivers/dri/trident/trident_context.c +++ b/src/mesa/drivers/dri/trident/trident_context.c @@ -358,34 +358,6 @@ tridentScreenPtr tridentCreateScreen( __DRIscreenPrivate *sPriv ) TRIDENTDRIPtr tDRIPriv = (TRIDENTDRIPtr)sPriv->pDevPriv; tridentScreenPtr tridentScreen; -#if 0 - /* Check the DRI version */ - { - int major, minor, patch; - if ( XF86DRIQueryVersion( sPriv->display, &major, &minor, &patch ) ) { - if ( major != 3 || minor != 1 || patch < 0 ) { - __driUtilMessage( "r128 DRI driver expected DRI version 3.1.x but got version %d.%d.%d", major, minor, patch ); - return GL_FALSE; - } - } - } - - /* Check that the DDX driver version is compatible */ - if ( sPriv->ddxMajor != 4 || - sPriv->ddxMinor != 0 || - sPriv->ddxPatch < 0 ) { - __driUtilMessage( "r128 DRI driver expected DDX driver version 4.0.x but got version %d.%d.%d", sPriv->ddxMajor, sPriv->ddxMinor, sPriv->ddxPatch ); - return GL_FALSE; - } - - /* Check that the DRM driver version is compatible */ - if ( sPriv->drmMajor != 2 || - sPriv->drmMinor != 1 || - sPriv->drmPatch < 0 ) { - __driUtilMessage( "r128 DRI driver expected DRM driver version 2.1.x but got version %d.%d.%d", sPriv->drmMajor, sPriv->drmMinor, sPriv->drmPatch ); - return GL_FALSE; - } -#endif /* Allocate the private area */ tridentScreen = (tridentScreenPtr) CALLOC( sizeof(*tridentScreen) ); @@ -453,9 +425,8 @@ static struct __DriverAPIRec tridentAPI = { tridentUnbindContext, }; -static PFNGLXCREATECONTEXTMODES create_context_modes = NULL; -PUBLIC void *__driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, +PUBLIC void *__driCreateNewScreen_20050725( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, const __GLcontextModes * modes, const __DRIversion * ddx_version, @@ -464,10 +435,22 @@ PUBLIC void *__driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, const __DRIframebuffer * frame_buffer, drmAddress pSAREA, int fd, int internal_api_version, + const __DRIinterfaceMethods * interface, __GLcontextModes ** driver_modes ) { __DRIscreenPrivate *psp; - /* XXX version checks */ + static const __DRIversion ddx_expected = { 4, 0, 0 }; + static const __DRIversion dri_expected = { 3, 1, 0 }; + static const __DRIversion drm_expected = { 1, 0, 0 }; + + dri_interface = interface; + + if ( ! driCheckDriDdxDrmVersions2( "Trident", + dri_version, & dri_expected, + ddx_version, & ddx_expected, + drm_version, & drm_expected ) ) { + return NULL; + } psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL, ddx_version, dri_version, drm_version, @@ -475,14 +458,10 @@ PUBLIC void *__driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, internal_api_version, &tridentAPI); if ( psp != NULL ) { - create_context_modes = (PFNGLXCREATECONTEXTMODES) - glXGetProcAddress( (const GLubyte *) "__glXCreateContextModes" ); #if 0 - if ( create_context_modes != NULL ) { - TRIDENTDRIPtr dri_priv = (TRIDENTDRIPtr) psp->pDevPriv; - *driver_modes = tridentFillInModes( dri_priv->bytesPerPixel * 8, - GL_TRUE ); - } + TRIDENTDRIPtr dri_priv = (TRIDENTDRIPtr) psp->pDevPriv; + *driver_modes = tridentFillInModes( dri_priv->bytesPerPixel * 8, + GL_TRUE ); #endif } return (void *) psp; diff --git a/src/mesa/drivers/dri/unichrome/via_context.c b/src/mesa/drivers/dri/unichrome/via_context.c index 4d673286712..ca31245b0fd 100644 --- a/src/mesa/drivers/dri/unichrome/via_context.c +++ b/src/mesa/drivers/dri/unichrome/via_context.c @@ -342,12 +342,6 @@ FreeBuffer(struct via_context *vmesa) via_free_dma_buffer(vmesa); } -static int -get_ust_nop( int64_t * ust ) -{ - *ust = 1; - return 0; -} GLboolean viaCreateContext(const __GLcontextModes *visual, @@ -563,13 +557,8 @@ viaCreateContext(const __GLcontextModes *visual, if (getenv("VIA_PAGEFLIP")) vmesa->allowPageFlip = 1; - - vmesa->get_ust = - (PFNGLXGETUSTPROC) glXGetProcAddress( (const GLubyte *) "__glXGetUST" ); - if ( vmesa->get_ust == NULL ) { - vmesa->get_ust = get_ust_nop; - } - vmesa->get_ust( &vmesa->swap_ust ); + + (*dri_interface->getUST)( &vmesa->swap_ust ); vmesa->regMMIOBase = (GLuint *)((GLuint)viaScreen->reg); diff --git a/src/mesa/drivers/dri/unichrome/via_context.h b/src/mesa/drivers/dri/unichrome/via_context.h index 54460d56f50..a4b1afc02bb 100644 --- a/src/mesa/drivers/dri/unichrome/via_context.h +++ b/src/mesa/drivers/dri/unichrome/via_context.h @@ -320,7 +320,6 @@ struct via_context { GLuint swap_count; GLuint swap_missed_count; - PFNGLXGETUSTPROC get_ust; GLuint pfCurrentOffset; GLboolean allowPageFlip; diff --git a/src/mesa/drivers/dri/unichrome/via_ioctl.c b/src/mesa/drivers/dri/unichrome/via_ioctl.c index 651c5f6e315..435fd20f778 100644 --- a/src/mesa/drivers/dri/unichrome/via_ioctl.c +++ b/src/mesa/drivers/dri/unichrome/via_ioctl.c @@ -512,7 +512,7 @@ static void viaWaitIdleVBlank( const __DRIdrawablePrivate *dPriv, vmesa->vblank_flags, & missed_target ); if ( missed_target ) { vmesa->swap_missed_count++; - vmesa->get_ust( &vmesa->swap_missed_ust ); + (*dri_interface->getUST)( &vmesa->swap_missed_ust ); } } while (!viaCheckBreadcrumb(vmesa, value)); @@ -615,7 +615,7 @@ void viaCopyBuffer(const __DRIdrawablePrivate *dPriv) viaEmitBreadcrumbLocked(vmesa); UNLOCK_HARDWARE(vmesa); - vmesa->get_ust( &vmesa->swap_ust ); + (*dri_interface->getUST)( &vmesa->swap_ust ); } @@ -639,7 +639,7 @@ void viaPageFlip(const __DRIdrawablePrivate *dPriv) viaEmitBreadcrumbLocked(vmesa); UNLOCK_HARDWARE(vmesa); - vmesa->get_ust( &vmesa->swap_ust ); + (*dri_interface->getUST)( &vmesa->swap_ust ); /* KW: FIXME: When buffers are freed, could free frontbuffer by diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c index 4115434cf29..8de73539259 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.c +++ b/src/mesa/drivers/dri/unichrome/via_screen.c @@ -62,8 +62,6 @@ DRI_CONF_END; static const GLuint __driNConfigOptions = 3; -static PFNGLXCREATECONTEXTMODES create_context_modes = NULL; - static int getSwapInfo( __DRIdrawablePrivate *dPriv, __DRIswapInfo * sInfo ); static drmBufMapPtr via_create_empty_buffers(void) @@ -99,8 +97,7 @@ viaInitDriver(__DRIscreenPrivate *sPriv) viaScreenPrivate *viaScreen; VIADRIPtr gDRIPriv = (VIADRIPtr)sPriv->pDevPriv; PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = - (PFNGLXSCRENABLEEXTENSIONPROC) glXGetProcAddress( - (const GLubyte *) "__glXScrEnableExtension" ); + (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); void * const psc = sPriv->psc->screenConfigs; @@ -368,7 +365,7 @@ viaFillInModes( unsigned pixel_bits, GLboolean have_back_buffer ) 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, @@ -405,7 +402,7 @@ viaFillInModes( unsigned pixel_bits, GLboolean have_back_buffer ) * failure. */ PUBLIC -void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, +void * __driCreateNewScreen_20050725( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, const __GLcontextModes * modes, const __DRIversion * ddx_version, @@ -414,6 +411,7 @@ void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, const __DRIframebuffer * frame_buffer, drmAddress pSAREA, int fd, int internal_api_version, + const __DRIinterfaceMethods * interface, __GLcontextModes ** driver_modes ) { @@ -422,6 +420,8 @@ void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion drm_expected = { 2, 3, 0 }; + dri_interface = interface; + if ( ! driCheckDriDdxDrmVersions2( "Unichrome", dri_version, & dri_expected, ddx_version, & ddx_expected, @@ -434,13 +434,9 @@ void * __driCreateNewScreen_20050722( __DRInativeDisplay *dpy, int scrn, frame_buffer, pSAREA, fd, internal_api_version, &viaAPI); if ( psp != NULL ) { - create_context_modes = (PFNGLXCREATECONTEXTMODES) - glXGetProcAddress( (const GLubyte *) "__glXCreateContextModes" ); - if ( create_context_modes != NULL ) { - VIADRIPtr dri_priv = (VIADRIPtr) psp->pDevPriv; - *driver_modes = viaFillInModes( dri_priv->bytesPerPixel * 8, - GL_TRUE ); - } + VIADRIPtr dri_priv = (VIADRIPtr) psp->pDevPriv; + *driver_modes = viaFillInModes( dri_priv->bytesPerPixel * 8, + GL_TRUE ); } fprintf(stderr, "%s - succeeded\n", __FUNCTION__); |