new version check to allow to test for a range of ddx major versions, instead of...
authorRoland Scheidegger <rscheidegger@gmx.ch>
Wed, 26 Jan 2005 18:02:19 +0000 (18:02 +0000)
committerRoland Scheidegger <rscheidegger@gmx.ch>
Wed, 26 Jan 2005 18:02:19 +0000 (18:02 +0000)
src/mesa/drivers/dri/common/dri_util.h
src/mesa/drivers/dri/common/utils.c
src/mesa/drivers/dri/common/utils.h

index 534a26785efe707ac03bb26ae8ce866ccd086404..9c6e71964368a28b86fcfab2bf33965cac779282 100644 (file)
@@ -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, ...);
index fcdd9f83777bd6b27e40edad155bcdfaa4193891..85527f9234773d4a2123f253ca380686a871c678 100644 (file)
@@ -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,
index 21d7ad269d415edc9586c30e0a217c7b3018839c..3346914fe604f7a168066e65a5b4e4aee5c0e40c 100644 (file)
@@ -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 );