From: Roland Scheidegger Date: Wed, 26 Jan 2005 18:02:19 +0000 (+0000) Subject: new version check to allow to test for a range of ddx major versions, instead of... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7104ce0a0e8f25bf097ad695d007b1a4b3e5d051;p=mesa.git new version check to allow to test for a range of ddx major versions, instead of just one major version --- diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index 534a26785ef..9c6e7196436 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -77,6 +77,7 @@ typedef struct __DRIscreenPrivateRec __DRIscreenPrivate; typedef struct __DRIcontextPrivateRec __DRIcontextPrivate; typedef struct __DRIdrawablePrivateRec __DRIdrawablePrivate; typedef struct __DRIswapInfoRec __DRIswapInfo; +typedef struct __DRIutilversionRec2 __DRIutilversion2; /** @@ -526,6 +527,17 @@ struct __DRIscreenPrivateRec { }; +/** + * Used to store a version which includes a major range instead of a single + * major version number. + */ +struct __DRIutilversionRec2 { + int major_min; /** min allowed Major version number. */ + int major_max; /** max allowed Major version number. */ + int minor; /**< Minor version number. */ + int patch; /**< Patch-level. */ +}; + extern void __driUtilMessage(const char *f, ...); diff --git a/src/mesa/drivers/dri/common/utils.c b/src/mesa/drivers/dri/common/utils.c index fcdd9f83777..85527f92347 100644 --- a/src/mesa/drivers/dri/common/utils.c +++ b/src/mesa/drivers/dri/common/utils.c @@ -257,7 +257,7 @@ driCheckDriDdxDrmVersions(__DRIscreenPrivate *sPriv, * \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 ddxExpected Minimum DDX minor and range of DDX major version required by the driver. * \param drmActual Actual DRM version supplied __driCreateNewScreen. * \param drmExpected Minimum DRM version required by the driver. * @@ -267,16 +267,18 @@ driCheckDriDdxDrmVersions(__DRIscreenPrivate *sPriv, * \sa __driCreateNewScreen, driCheckDriDdxDrmVersions, __driUtilMessage */ GLboolean -driCheckDriDdxDrmVersions2(const char * driver_name, +driCheckDriDdxDrmVersions3(const char * driver_name, const __DRIversion * driActual, const __DRIversion * driExpected, const __DRIversion * ddxActual, - const __DRIversion * ddxExpected, + const __DRIutilversion2 * 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"; + static const char format2[] = "%s DRI driver expected %s version %d-%d.%d.x " + "but got version %d.%d.%d"; /* Check the DRI version */ @@ -289,10 +291,11 @@ driCheckDriDdxDrmVersions2(const char * driver_name, } /* Check that the DDX driver version is compatible */ - if ( (ddxActual->major != ddxExpected->major) + if ( (ddxActual->major < ddxExpected->major_min) + || (ddxActual->major > ddxExpected->major_max) || (ddxActual->minor < ddxExpected->minor) ) { - __driUtilMessage(format, driver_name, "DDX", - ddxExpected->major, ddxExpected->minor, + __driUtilMessage(format2, driver_name, "DDX", + ddxExpected->major_min, ddxExpected->major_max, ddxExpected->minor, ddxActual->major, ddxActual->minor, ddxActual->patch); return GL_FALSE; } @@ -309,6 +312,26 @@ driCheckDriDdxDrmVersions2(const char * driver_name, return GL_TRUE; } +GLboolean +driCheckDriDdxDrmVersions2(const char * driver_name, + const __DRIversion * driActual, + const __DRIversion * driExpected, + const __DRIversion * ddxActual, + const __DRIversion * ddxExpected, + const __DRIversion * drmActual, + const __DRIversion * drmExpected) +{ + __DRIutilversion2 ddx_expected; + ddx_expected.major_min = ddxExpected->major; + ddx_expected.major_max = ddxExpected->major; + ddx_expected.minor = ddxExpected->minor; + ddx_expected.patch = ddxExpected->patch; + return driCheckDriDdxDrmVersions3(driver_name, driActual, + driExpected, ddxActual, & ddx_expected, + drmActual, drmExpected); +} + + 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 21d7ad269d4..3346914fe60 100644 --- a/src/mesa/drivers/dri/common/utils.h +++ b/src/mesa/drivers/dri/common/utils.h @@ -58,6 +58,11 @@ extern GLboolean driCheckDriDdxDrmVersions2(const char * driver_name, const __DRIversion * ddxActual, const __DRIversion * ddxExpected, const __DRIversion * drmActual, const __DRIversion * drmExpected); +extern GLboolean driCheckDriDdxDrmVersions3(const char * driver_name, + const __DRIversion * driActual, const __DRIversion * driExpected, + const __DRIversion * ddxActual, const __DRIutilversion2 * ddxExpected, + const __DRIversion * drmActual, const __DRIversion * drmExpected); + extern GLboolean driClipRectToFramebuffer( const GLframebuffer *buffer, GLint *x, GLint *y, GLsizei *width, GLsizei *height );