diff options
author | Ian Romanick <idr@us.ibm.com> | 2004-06-02 22:48:03 +0000 |
---|---|---|
committer | Ian Romanick <idr@us.ibm.com> | 2004-06-02 22:48:03 +0000 |
commit | 5b98ada88071a752b6000756949a1951183cdd0b (patch) | |
tree | 99e88ed38d4fe16e62fdb1ee3e964dfe8891daf8 /src/mesa | |
parent | ffb36d57a5f6359b5b91b73af60482a0016dd431 (diff) |
driCheckDriDdxDrmVersion uses a function that is not available to
drivers when DRI_NEW_INTERFACE_ONLY is defined. #ifndef it away in
that situation.
Add a new function, driCheckDriDdxDrmVersion2, that is passed in the
version information that is already supplied to __driCreateNewScreen.
Part of the reason that information is supplied to
__driCreateNewScreen is so that the driver doesn't have to make those
calls to get it!
Modify all drivers that support the new interface to use the new
function instead of the old. As soon as all drivers support the new
interface, driCheckDriDdxDrmVersion can be removed.
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/common/utils.c | 85 | ||||
-rw-r--r-- | src/mesa/drivers/dri/common/utils.h | 7 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i810/i810screen.c | 12 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i830/i830_screen.c | 29 | ||||
-rw-r--r-- | src/mesa/drivers/dri/mach64/mach64_screen.c | 13 | ||||
-rw-r--r-- | src/mesa/drivers/dri/mga/mga_xmesa.c | 12 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r200/r200_screen.c | 14 | ||||
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_screen.c | 12 | ||||
-rw-r--r-- | src/mesa/drivers/dri/tdfx/tdfx_screen.c | 38 |
9 files changed, 160 insertions, 62 deletions
diff --git a/src/mesa/drivers/dri/common/utils.c b/src/mesa/drivers/dri/common/utils.c index d337cb6b94..8574e06e75 100644 --- a/src/mesa/drivers/dri/common/utils.c +++ b/src/mesa/drivers/dri/common/utils.c @@ -32,6 +32,10 @@ #include "extensions.h" #include "utils.h" +#if !defined( DRI_NEW_INTERFACE_ONLY ) && !defined( _SOLO ) +#include "xf86dri.h" /* For XF86DRIQueryVersion prototype. */ +#endif + #if defined(USE_X86_ASM) #include "x86/common_x86_asm.h" #endif @@ -145,6 +149,17 @@ void driInitExtensions( GLcontext * ctx, +#ifndef DRI_NEW_INTERFACE_ONLY +/** + * Utility function used by drivers to test the verions of other components. + * + * \deprecated + * All drivers using the new interface should use \c driCheckDriDdxVersions2 + * instead. This function is implemented using a call that is not available + * to drivers using the new interface. Furthermore, the information gained + * by this call (the DRI and DDX version information) is already provided to + * the driver via the new interface. + */ GLboolean driCheckDriDdxDrmVersions(__DRIscreenPrivate *sPriv, const char * driver_name, @@ -160,7 +175,7 @@ driCheckDriDdxDrmVersions(__DRIscreenPrivate *sPriv, /* Check the DRI version */ if (XF86DRIQueryVersion(sPriv->display, &major, &minor, &patch)) { if (major != dri_major || minor < dri_minor) { - __driUtilMessage(format, "DRI", driver_name, dri_major, dri_minor, + __driUtilMessage(format, driver_name, "DRI", dri_major, dri_minor, major, minor, patch); return GL_FALSE; } @@ -168,7 +183,7 @@ driCheckDriDdxDrmVersions(__DRIscreenPrivate *sPriv, /* Check that the DDX driver version is compatible */ if (sPriv->ddxMajor != ddx_major || sPriv->ddxMinor < ddx_minor) { - __driUtilMessage(format, "DDX", driver_name, ddx_major, ddx_minor, + __driUtilMessage(format, driver_name, "DDX", ddx_major, ddx_minor, sPriv->ddxMajor, sPriv->ddxMinor, sPriv->ddxPatch); return GL_FALSE; } @@ -178,13 +193,77 @@ driCheckDriDdxDrmVersions(__DRIscreenPrivate *sPriv, /* Check that the DRM driver version is compatible */ if (sPriv->drmMajor != drm_major || sPriv->drmMinor < drm_minor) { - __driUtilMessage(format, "DRM", driver_name, drm_major, drm_minor, + __driUtilMessage(format, driver_name, "DRM", drm_major, drm_minor, sPriv->drmMajor, sPriv->drmMinor, sPriv->drmPatch); return GL_FALSE; } return GL_TRUE; } +#endif /* DRI_NEW_INTERFACE_ONLY */ + +/** + * Utility function used by drivers to test the verions of other components. + * + * If one of the version requirements is not met, a message is logged using + * \c __driUtilMessage. + * + * \param driver_name Name of the driver. Used in error messages. + * \param driActual Actual DRI version supplied __driCreateNewScreen. + * \param driExpected Minimum DRI version required by the driver. + * \param ddxActual Actual DDX version supplied __driCreateNewScreen. + * \param ddxExpected Minimum DDX version required by the driver. + * \param drmActual Actual DRM version supplied __driCreateNewScreen. + * \param drmExpected Minimum DRM version required by the driver. + * + * \returns \c GL_TRUE if all version requirements are met. Otherwise, + * \c GL_FALSE is returned. + * + * \sa __driCreateNewScreen, driCheckDriDdxDrmVersions, __driUtilMessage + */ +GLboolean +driCheckDriDdxDrmVersions2(const char * driver_name, + const __DRIversion * driActual, + const __DRIversion * driExpected, + const __DRIversion * ddxActual, + const __DRIversion * ddxExpected, + const __DRIversion * drmActual, + const __DRIversion * drmExpected) +{ + static const char format[] = "%s DRI driver expected %s version %d.%d.x " + "but got version %d.%d.%d"; + + + /* Check the DRI version */ + if ( (driActual->major != driExpected->major) + || (driActual->minor < driExpected->minor) ) { + __driUtilMessage(format, driver_name, "DRI", + driExpected->major, driExpected->minor, + driActual->major, driActual->minor, driActual->patch); + return GL_FALSE; + } + + /* Check that the DDX driver version is compatible */ + if ( (ddxActual->major != ddxExpected->major) + || (ddxActual->minor < ddxExpected->minor) ) { + __driUtilMessage(format, driver_name, "DDX", + ddxExpected->major, ddxExpected->minor, + ddxActual->major, ddxActual->minor, ddxActual->patch); + return GL_FALSE; + } + + /* Check that the DRM driver version is compatible */ + if ( (drmActual->major != drmExpected->major) + || (drmActual->minor < drmExpected->minor) ) { + __driUtilMessage(format, driver_name, "DRM", + drmExpected->major, drmExpected->minor, + drmActual->major, drmActual->minor, drmActual->patch); + return GL_FALSE; + } + + return GL_TRUE; +} + GLboolean driClipRectToFramebuffer( const GLframebuffer *buffer, GLint *x, GLint *y, diff --git a/src/mesa/drivers/dri/common/utils.h b/src/mesa/drivers/dri/common/utils.h index 401a1b882f..3f24ef73db 100644 --- a/src/mesa/drivers/dri/common/utils.h +++ b/src/mesa/drivers/dri/common/utils.h @@ -47,9 +47,16 @@ extern unsigned driGetRendererString( char * buffer, extern void driInitExtensions( GLcontext * ctx, const char * const card_extensions[], GLboolean enable_imaging ); +#ifndef DRI_NEW_INTERFACE_ONLY extern GLboolean driCheckDriDdxDrmVersions( __DRIscreenPrivate *sPriv, const char * driver_name, int dri_major, int dri_minor, int ddx_major, int ddx_minor, int drm_major, int drm_minor ); +#endif + +extern GLboolean driCheckDriDdxDrmVersions2(const char * driver_name, + const __DRIversion * driActual, const __DRIversion * driExpected, + const __DRIversion * ddxActual, const __DRIversion * ddxExpected, + const __DRIversion * drmActual, const __DRIversion * drmExpected); extern GLboolean driClipRectToFramebuffer( const GLframebuffer *buffer, GLint *x, GLint *y, diff --git a/src/mesa/drivers/dri/i810/i810screen.c b/src/mesa/drivers/dri/i810/i810screen.c index 4071b8bcc1..8f78a68615 100644 --- a/src/mesa/drivers/dri/i810/i810screen.c +++ b/src/mesa/drivers/dri/i810/i810screen.c @@ -230,8 +230,6 @@ i810InitDriver(__DRIscreenPrivate *sPriv) i810ScreenPrivate *i810Screen; I810DRIPtr gDRIPriv = (I810DRIPtr)sPriv->pDevPriv; - if ( ! driCheckDriDdxDrmVersions( sPriv, "i810", 4, 0, 1, 0, 1, 2 ) ) - return GL_FALSE; /* Allocate the private area */ i810Screen = (i810ScreenPrivate *)CALLOC(sizeof(i810ScreenPrivate)); @@ -436,6 +434,16 @@ void * __driCreateNewScreen( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc { __DRIscreenPrivate *psp; + static const __DRIversion ddx_expected = { 4, 0, 0 }; + static const __DRIversion dri_expected = { 1, 0, 0 }; + static const __DRIversion drm_expected = { 1, 2, 0 }; + + if ( ! driCheckDriDdxDrmVersions2( "i810", + 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, diff --git a/src/mesa/drivers/dri/i830/i830_screen.c b/src/mesa/drivers/dri/i830/i830_screen.c index bedab612a1..9d580c78ad 100644 --- a/src/mesa/drivers/dri/i830/i830_screen.c +++ b/src/mesa/drivers/dri/i830/i830_screen.c @@ -140,25 +140,6 @@ static GLboolean i830InitDriver(__DRIscreenPrivate *sPriv) i830ScreenPrivate *i830Screen; I830DRIPtr gDRIPriv = (I830DRIPtr)sPriv->pDevPriv; - /* Check the DRI externsion version */ - if ( sPriv->driMajor != 4 || sPriv->driMinor < 0 ) { - __driUtilMessage( "i830 DRI driver expected DRI version 4.0.x " - "but got version %d.%d.%d", - sPriv->driMajor, sPriv->driMinor, sPriv->driPatch ); - return GL_FALSE; - } - - /* Check that the DDX driver version is compatible */ - if (sPriv->ddxMajor != 1 || sPriv->ddxMinor < 0) { - __driUtilMessage("i830 DRI driver expected DDX driver version 1.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 != 1 || sPriv->drmMinor < 3) { - __driUtilMessage("i830 DRI driver expected DRM driver version 1.3.x but got version %d.%d.%d", sPriv->drmMajor, sPriv->drmMinor, sPriv->drmPatch); - return GL_FALSE; - } /* Allocate the private area */ i830Screen = (i830ScreenPrivate *)CALLOC(sizeof(i830ScreenPrivate)); @@ -565,6 +546,16 @@ void * __driCreateNewScreen( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc { __DRIscreenPrivate *psp; + static const __DRIversion ddx_expected = { 4, 0, 0 }; + static const __DRIversion dri_expected = { 1, 0, 0 }; + static const __DRIversion drm_expected = { 1, 3, 0 }; + + if ( ! driCheckDriDdxDrmVersions2( "i830", + 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, diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.c b/src/mesa/drivers/dri/mach64/mach64_screen.c index 11513446c9..8ec10ea110 100644 --- a/src/mesa/drivers/dri/mach64/mach64_screen.c +++ b/src/mesa/drivers/dri/mach64/mach64_screen.c @@ -216,9 +216,6 @@ mach64CreateScreen( __DRIscreenPrivate *sPriv ) if ( MACH64_DEBUG & DEBUG_VERBOSE_DRI ) fprintf( stderr, "%s\n", __FUNCTION__ ); - if ( ! driCheckDriDdxDrmVersions( sPriv, "Mach64", 4, 0, 6, 4, 1, 0 ) ) - return NULL; - /* Allocate the private area */ mach64Screen = (mach64ScreenPtr) CALLOC( sizeof(*mach64Screen) ); if ( !mach64Screen ) return NULL; @@ -540,6 +537,16 @@ void * __driCreateNewScreen( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc { __DRIscreenPrivate *psp; + static const __DRIversion ddx_expected = { 4, 0, 0 }; + static const __DRIversion dri_expected = { 6, 4, 0 }; + static const __DRIversion drm_expected = { 1, 0, 0 }; + + if ( ! driCheckDriDdxDrmVersions2( "Mach64", + 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, diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c index 8aa647a268..358c599eba 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.c +++ b/src/mesa/drivers/dri/mga/mga_xmesa.c @@ -229,8 +229,6 @@ mgaInitDriver(__DRIscreenPrivate *sPriv) mgaScreenPrivate *mgaScreen; MGADRIPtr serverInfo = (MGADRIPtr)sPriv->pDevPriv; - if ( ! driCheckDriDdxDrmVersions( sPriv, "MGA", 4, 0, 1, 0, 3, 0 ) ) - return GL_FALSE; /* Allocate the private area */ mgaScreen = (mgaScreenPrivate *)MALLOC(sizeof(mgaScreenPrivate)); @@ -967,6 +965,16 @@ void * __driCreateNewScreen( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc { __DRIscreenPrivate *psp; + static const __DRIversion ddx_expected = { 4, 0, 0 }; + static const __DRIversion dri_expected = { 1, 0, 0 }; + static const __DRIversion drm_expected = { 3, 0, 0 }; + + if ( ! driCheckDriDdxDrmVersions2( "MGA", + 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, diff --git a/src/mesa/drivers/dri/r200/r200_screen.c b/src/mesa/drivers/dri/r200/r200_screen.c index b34ba89e2d..868f623ee8 100644 --- a/src/mesa/drivers/dri/r200/r200_screen.c +++ b/src/mesa/drivers/dri/r200/r200_screen.c @@ -272,8 +272,6 @@ r200CreateScreen( __DRIscreenPrivate *sPriv ) RADEONDRIPtr dri_priv = (RADEONDRIPtr)sPriv->pDevPriv; unsigned char *RADEONMMIO; - if ( ! driCheckDriDdxDrmVersions( sPriv, "R200", 4, 0, 4, 0, 1, 5 ) ) - return NULL; /* Allocate the private area */ screen = (r200ScreenPtr) CALLOC( sizeof(*screen) ); @@ -672,7 +670,17 @@ void * __driCreateNewScreen( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc { __DRIscreenPrivate *psp; - + static const __DRIversion ddx_expected = { 4, 0, 0 }; + static const __DRIversion dri_expected = { 4, 0, 0 }; + static const __DRIversion drm_expected = { 1, 5, 0 }; + + if ( ! driCheckDriDdxDrmVersions2( "R200", + 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, frame_buffer, pSAREA, fd, diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index a85be20e86..25d5be5790 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -251,8 +251,6 @@ radeonScreenPtr radeonCreateScreen( __DRIscreenPrivate *sPriv ) RADEONDRIPtr dri_priv = (RADEONDRIPtr)sPriv->pDevPriv; unsigned char *RADEONMMIO; - if ( ! driCheckDriDdxDrmVersions( sPriv, "Radeon", 4, 0, 4, 0, 1, 3 ) ) - return NULL; /* Allocate the private area */ screen = (radeonScreenPtr) CALLOC( sizeof(*screen) ); @@ -600,6 +598,16 @@ void * __driCreateNewScreen( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc { __DRIscreenPrivate *psp; + static const __DRIversion ddx_expected = { 4, 0, 0 }; + static const __DRIversion dri_expected = { 4, 0, 0 }; + static const __DRIversion drm_expected = { 1, 3, 0 }; + + if ( ! driCheckDriDdxDrmVersions2( "Radeon", + 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, diff --git a/src/mesa/drivers/dri/tdfx/tdfx_screen.c b/src/mesa/drivers/dri/tdfx/tdfx_screen.c index b78da2ca8f..370f3283c8 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_screen.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_screen.c @@ -121,34 +121,6 @@ tdfxInitDriver( __DRIscreenPrivate *sPriv ) fprintf( stderr, "%s( %p )\n", __FUNCTION__, (void *)sPriv ); } - /* Check the DRI externsion version */ - if ( sPriv->driMajor != 4 || sPriv->driMinor < 0 ) { - __driUtilMessage( "tdfx DRI driver expected DRI version 4.0.x " - "but got version %d.%d.%d", - sPriv->driMajor, sPriv->driMinor, sPriv->driPatch ); - return GL_FALSE; - } - - /* Check that the DDX driver version is compatible */ - if ( sPriv->ddxMajor != 1 || - sPriv->ddxMinor < 0 ) { - __driUtilMessage( - "3dfx DRI driver expected DDX driver version 1.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 != 1 || - sPriv->drmMinor < 0 ) { - __driUtilMessage( - "3dfx DRI driver expected DRM driver version 1.0.x " - "but got version %d.%d.%d", - sPriv->drmMajor, sPriv->drmMinor, sPriv->drmPatch ); - return GL_FALSE; - } - if ( !tdfxCreateScreen( sPriv ) ) { tdfxDestroyScreen( sPriv ); return GL_FALSE; @@ -413,6 +385,16 @@ void * __driCreateNewScreen( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc __GLcontextModes ** driver_modes ) { __DRIscreenPrivate *psp; + static const __DRIversion ddx_expected = { 4, 0, 0 }; + static const __DRIversion dri_expected = { 1, 0, 0 }; + static const __DRIversion drm_expected = { 1, 0, 0 }; + + if ( ! driCheckDriDdxDrmVersions2( "tdfx", + 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, |