diff options
37 files changed, 365 insertions, 468 deletions
diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index e5c5a7759d1..1b1aeba55f9 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -62,6 +62,7 @@ typedef struct __DRIdrawableRec __DRIdrawable; typedef struct __DRIdriverRec __DRIdriver; typedef struct __DRIframebufferRec __DRIframebuffer; typedef struct __DRIversionRec __DRIversion; +typedef struct __DRIinterfaceMethodsRec __DRIinterfaceMethods; typedef unsigned long __DRIid; typedef void __DRInativeDisplay; /*@}*/ @@ -74,38 +75,6 @@ typedef void __DRInativeDisplay; extern __DRIscreen *__glXFindDRIScreen(__DRInativeDisplay *dpy, int scrn); -/** - * Type of a pointer to \c __glXGetInternalVersion, as returned by - * \c glXGetProcAddress. - * - * \sa __glXGetInternalVersion, glXGetProcAddress - */ -typedef int (* PFNGLXGETINTERNALVERSIONPROC) ( void ); - -/** - * Type of a pointer to \c __glXWindowExists, as returned by - * \c glXGetProcAddress. - * - * \sa __glXWindowExists, glXGetProcAddress - */ -typedef GLboolean (* PFNGLXWINDOWEXISTSPROC) (__DRInativeDisplay *dpy, __DRIid draw); - -/** - * Type of a pointer to \c __glXGetUST, as returned by \c glXGetProcAddress. - * - * \sa __glXGetUST, glXGetProcAddress - */ -typedef int (* PFNGLXGETUSTPROC) ( int64_t * ust ); - -/** - * Type of pointer to \c __glXCreateContextModes, as returned by - * \c glXGetProcAddress. - * - * \sa _gl_context_modes_create, glXGetProcAddress - */ - -typedef __GLcontextModes * (* PFNGLXCREATECONTEXTMODES) ( unsigned count, - size_t minimum_bytes_per_struct ); /** * Type of a pointer to \c glXGetScreenDriver, as returned by @@ -135,19 +104,6 @@ typedef const char * (* PFNGLXGETDRIVERCONFIGPROC) (const char *driverName); */ typedef void (* PFNGLXSCRENABLEEXTENSIONPROC) ( void *psc, const char * name ); -/** - * Type of a pointer to \c __glXGetDrawableInfo, as returned by - * \c glXGetProcAddress. This function is used to get information about the - * position, size, and clip rects of a drawable. - * - * \sa __glXGetDrawableInfo, glXGetProcAddress - */ -typedef GLboolean (* PFNGLXGETDRAWABLEINFOPROC) ( __DRInativeDisplay *dpy, int scrn, - __DRIid draw, unsigned int * index, unsigned int * stamp, - int * x, int * y, int * width, int * height, - int * numClipRects, drm_clip_rect_t ** pClipRects, - int * backX, int * backY, - int * numBackClipRects, drm_clip_rect_t ** pBackClipRects ); /* Test for the xf86dri.h header file */ #ifndef _XF86DRI_H_ @@ -173,9 +129,10 @@ typedef void *(CREATENEWSCREENFUNC)(__DRInativeDisplay *dpy, int scrn, const __DRIversion * ddx_version, const __DRIversion * dri_version, const __DRIversion * drm_version, const __DRIframebuffer * frame_buffer, void * pSAREA, int fd, int internal_api_version, + const __DRIinterfaceMethods * interface, __GLcontextModes ** driver_modes); typedef CREATENEWSCREENFUNC* PFNCREATENEWSCREENFUNC; -extern CREATENEWSCREENFUNC __driCreateNewScreen_20050722; +extern CREATENEWSCREENFUNC __driCreateNewScreen_20050725; /** @@ -202,6 +159,113 @@ struct __DRIversionRec { int patch; /**< Patch-level. */ }; + +typedef void (*__DRIfuncPtr)(void); + +struct __DRIinterfaceMethodsRec { + /** + * Get pointer to named function. + */ + __DRIfuncPtr (*getProcAddress)( const char * proc_name ); + + /** + * Create a list of \c __GLcontextModes structures. + */ + __GLcontextModes * (*createContextModes)(unsigned count, + size_t minimum_bytes_per_struct); + + /** + * Destroy a list of \c __GLcontextModes structures. + * + * \todo + * Determine if the drivers actually need to call this. + */ + void (*destroyContextModes)( __GLcontextModes * modes ); + + /** + * Get the \c __DRIscreen for a given display and screen number. + */ + __DRIscreen *(*getScreen)(__DRInativeDisplay *dpy, int screenNum); + + + /** + * \name Client/server protocol functions. + * + * These functions implement the DRI client/server protocol for + * context and drawable operations. Platforms that do not implement + * the wire protocol (e.g., EGL) will implement glorified no-op functions. + */ + /*@{*/ + /** + * Determine if the specified window ID still exists. + * + * \note + * Implementations may assume that the driver will only pass an ID into + * this function that actually corresponds to a window. On + * implementations where windows can only be destroyed by the DRI driver + * (e.g., EGL), this function is allowed to always return \c GL_TRUE. + */ + GLboolean (*windowExists)(__DRInativeDisplay *dpy, __DRIid draw); + + /** + * Create the server-side portion of the GL context. + */ + GLboolean (* createContext)( __DRInativeDisplay *dpy, int screenNum, + int configID, void * contextID, drm_context_t * hw_context ); + + /** + * Destroy the server-side portion of the GL context. + */ + GLboolean (* destroyContext)( __DRInativeDisplay *dpy, int screenNum, + __DRIid context ); + + /** + * Create the server-side portion of the drawable. + */ + GLboolean (*createDrawable)( __DRInativeDisplay * ndpy, int screen, + __DRIid drawable, drm_drawable_t * hHWDrawable ); + + /** + * Destroy the server-side portion of the drawable. + */ + GLboolean (*destroyDrawable)( __DRInativeDisplay * ndpy, int screen, + __DRIid drawable ); + + /** + * This function is used to get information about the position, size, and + * clip rects of a drawable. + */ + GLboolean (* getDrawableInfo) ( __DRInativeDisplay *dpy, int scrn, + __DRIid draw, unsigned int * index, unsigned int * stamp, + int * x, int * y, int * width, int * height, + int * numClipRects, drm_clip_rect_t ** pClipRects, + int * backX, int * backY, + int * numBackClipRects, drm_clip_rect_t ** pBackClipRects ); + /*@}*/ + + + /** + * \name Timing related functions. + */ + /*@{*/ + /** + * Get the 64-bit unadjusted system time (UST). + */ + int (*getUST)(int64_t * ust); + + /** + * Get the media stream counter (MSC) rate. + * + * Matching the definition in GLX_OML_sync_control, this function returns + * the rate of the "media stream counter". In practical terms, this is + * the frame refresh rate of the display. + */ + GLboolean (*getMSCRate)(__DRInativeDisplay * dpy, __DRIid drawable, + int32_t * numerator, int32_t * denominator); + /*@}*/ +}; + + /** * Framebuffer information record. Used by libGL to communicate information * about the framebuffer to the driver's \c __driCreateNewScreen function. @@ -332,7 +396,7 @@ struct __DRIcontextRec { /** * Method to bind a DRI drawable to a DRI graphics context. * - * \since Internal API version 20050722. + * \since Internal API version 20050725. */ GLboolean (*bindContext)(__DRInativeDisplay *dpy, int scrn, __DRIid draw, __DRIid read, __DRIcontext *ctx); @@ -340,7 +404,7 @@ struct __DRIcontextRec { /** * Method to unbind a DRI drawable from a DRI graphics context. * - * \since Internal API version 20050722. + * \since Internal API version 20050725. */ GLboolean (*unbindContext)(__DRInativeDisplay *dpy, int scrn, __DRIid draw, __DRIid read, __DRIcontext *ctx); 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, 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__); |