Bug 623338 - Block old drivers for ATI & NVIDIA (older than June 2010) - r=joe, a=blocking2.0
authorBenoit Jacob <bjacob@mozilla.com>
Fri, 28 Jan 2011 21:12:25 -0500
changeset 61594 983c98ba560baf911b79efc18e3ac5d98bc5f610
parent 61593 a76570899a34e5cc44d72ad7b530b3c10a336894
child 61595 ba84db82eed5945f6f1cf0ebef383d3e905c8ae7
push id1
push userroot
push dateTue, 10 Dec 2013 15:46:25 +0000
reviewersjoe, blocking2
bugs623338
milestone2.0b11pre
Bug 623338 - Block old drivers for ATI & NVIDIA (older than June 2010) - r=joe, a=blocking2.0
widget/src/windows/GfxInfo.cpp
widget/src/xpwidgets/GfxDriverInfo.cpp
widget/src/xpwidgets/GfxDriverInfo.h
--- a/widget/src/windows/GfxInfo.cpp
+++ b/widget/src/windows/GfxInfo.cpp
@@ -62,16 +62,21 @@ using namespace mozilla::widget;
 NS_IMPL_ISUPPORTS_INHERITED1(GfxInfo, GfxInfoBase, nsIGfxInfoDebug)
 #endif
 
 static const PRUint32 allWindowsVersions = 0xffffffff;
 static const PRUint64 allDriverVersions = 0xffffffffffffffffULL;
 
 static const PRUint32 vendorIntel = 0x8086;
 
+static const PRUint32 vendorNVIDIA = 0x10de;
+
+static const PRUint32 vendorAMD = 0x1022;
+static const PRUint32 vendorATI = 0x1002;
+
 #define V(a,b,c,d) GFX_DRIVER_VERSION(a,b,c,d)
 
 
 GfxInfo::GfxInfo()
   : mAdapterVendorID(0),
     mAdapterDeviceID(0),
     mWindowsVersion(0)
 {
@@ -352,17 +357,17 @@ GfxInfo::Init()
     // with bad Intel driver installations where the DriverVersion reported by the registry was
     // not the version of the DLL.
     PRBool is64bitApp = sizeof(void*) == 8;
     const PRUnichar *dllFileName = is64bitApp
                                  ? L"igd10umd64.dll"
                                  : L"igd10umd32.dll";
     nsString dllVersion;
     // if GetDLLVersion fails, it gives "0.0.0.0"
-    gfxWindowsPlatform::GetPlatform()->GetDLLVersion(dllFileName, dllVersion);
+    gfxWindowsPlatform::GetPlatform()->GetDLLVersion((PRUnichar*)dllFileName, dllVersion);
 
     PRUint64 dllNumericVersion = 0, driverNumericVersion = 0;
     // so if GetDLLVersion failed, we get dllNumericVersion = 0
     ParseDriverVersion(dllVersion, &dllNumericVersion);
     ParseDriverVersion(mDriverVersion, &driverNumericVersion);
 
     // so this test implicitly handles the case where GetDLLVersion failed
     if (dllNumericVersion != driverNumericVersion)
@@ -590,16 +595,37 @@ static const PRUint32 deviceFamilyIntelG
 };
 
 static const GfxDriverInfo gDriverInfo[] = {
   /*
    * Notice that the first match defines the result. So always implement special cases firsts and general case last.
    */
 
   /*
+   * NVIDIA entries
+   */
+  GfxDriverInfo( DRIVER_OS_ALL,
+    vendorNVIDIA, GfxDriverInfo::allDevices,
+    GfxDriverInfo::allFeatures, nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION,
+    DRIVER_LESS_THAN, V(8,17,12,5721), "257.21" ),
+
+  /*
+   * AMD/ATI entries
+   */
+  GfxDriverInfo( DRIVER_OS_ALL,
+    vendorATI, GfxDriverInfo::allDevices,
+    GfxDriverInfo::allFeatures, nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION,
+    DRIVER_LESS_THAN, V(8,741,0,0), "10.6" ),
+  GfxDriverInfo( DRIVER_OS_ALL,
+    vendorAMD, GfxDriverInfo::allDevices,
+    GfxDriverInfo::allFeatures, nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION,
+    DRIVER_LESS_THAN, V(8,741,0,0), "10.6" ),
+
+
+  /*
    * Intel entries
    */
 
   /*
    * Implement special Direct2D blocklist from bug 595364
    */
   GfxDriverInfo( DRIVER_OS_ALL,
     vendorIntel, (GfxDeviceFamily) deviceFamilyIntelBlockDirect2D,
@@ -696,18 +722,16 @@ GfxInfo::GetFeatureStatusImpl(PRInt32 aF
     return NS_ERROR_FAILURE;
   }
 
   PRUint64 driverVersion;
   if (!ParseDriverVersion(adapterDriverVersionString, &driverVersion)) {
     return NS_ERROR_FAILURE;
   }
   
-  PRUint64 suggestedDriverVersion = 0;
-
   if (aFeature == FEATURE_DIRECT3D_9_LAYERS &&
       mWindowsVersion < gfxWindowsPlatform::kWindowsXP)
   {
     *aStatus = FEATURE_BLOCKED_OS_VERSION;
     return NS_OK;
   }
 
   OperatingSystem os = WindowsVersionToOperatingSystem(mWindowsVersion);
@@ -723,16 +747,27 @@ GfxInfo::GetFeatureStatusImpl(PRInt32 aF
         aFeature == nsIGfxInfo::FEATURE_DIRECT3D_10_1_LAYERS ||
         aFeature == nsIGfxInfo::FEATURE_DIRECT2D)
     {
       *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION;
       return NS_OK;
     }
   }
 
+  // special-case the WinXP test slaves: they have out-of-date drivers, but we still want to
+  // whitelist them, actually we do know that this combination of device and driver version
+  // works well.
+  if (os == DRIVER_OS_WINDOWS_XP &&
+      adapterVendor == vendorNVIDIA &&
+      adapterDeviceID == 0x0861 && // GeForce 9400
+      driverVersion == V(6,14,11,7756))
+  {
+    return NS_OK;
+  }
+
   while (info->mOperatingSystem) {
 
     if (info->mOperatingSystem != DRIVER_OS_ALL &&
         info->mOperatingSystem != os)
     {
       info++;
       continue;
     }
@@ -758,17 +793,16 @@ GfxInfo::GetFeatureStatusImpl(PRInt32 aF
         }
     }
 
     bool match = false;
 
     switch (info->mComparisonOp) {
     case DRIVER_LESS_THAN:
       match = driverVersion < info->mDriverVersion;
-      suggestedDriverVersion = info->mDriverVersion;
       break;
     case DRIVER_LESS_THAN_OR_EQUAL:
       match = driverVersion <= info->mDriverVersion;
       break;
     case DRIVER_GREATER_THAN:
       match = driverVersion > info->mDriverVersion;
       break;
     case DRIVER_GREATER_THAN_OR_EQUAL:
@@ -803,22 +837,28 @@ GfxInfo::GetFeatureStatusImpl(PRInt32 aF
       }
     }
 
     info++;
   }
 
   *aStatus = status;
 
-  if (status == FEATURE_BLOCKED_DRIVER_VERSION && suggestedDriverVersion) {
-      aSuggestedDriverVersion.AppendPrintf("%lld.%lld.%lld.%lld",
-                                           (suggestedDriverVersion & 0xffff000000000000) >> 48,
-                                           (suggestedDriverVersion & 0x0000ffff00000000) >> 32,
-                                           (suggestedDriverVersion & 0x00000000ffff0000) >> 16,
-                                           (suggestedDriverVersion & 0x000000000000ffff));
+  if (status == FEATURE_BLOCKED_DRIVER_VERSION) {
+      if (info->mSuggestedVersion) {
+          aSuggestedDriverVersion.AppendPrintf("%s", info->mSuggestedVersion);
+      } else if (info->mComparisonOp == DRIVER_LESS_THAN &&
+                 info->mDriverVersion != allDriverVersions)
+      {
+          aSuggestedDriverVersion.AppendPrintf("%lld.%lld.%lld.%lld",
+                                               (info->mDriverVersion & 0xffff000000000000) >> 48,
+                                               (info->mDriverVersion & 0x0000ffff00000000) >> 32,
+                                               (info->mDriverVersion & 0x00000000ffff0000) >> 16,
+                                               (info->mDriverVersion & 0x000000000000ffff));
+      }
   }
   
   return NS_OK;
 }
 
 #ifdef DEBUG
 
 // Implement nsIGfxInfoDebug
--- a/widget/src/xpwidgets/GfxDriverInfo.cpp
+++ b/widget/src/xpwidgets/GfxDriverInfo.cpp
@@ -48,44 +48,48 @@ GfxDriverInfo::GfxDriverInfo()
   : mOperatingSystem(DRIVER_OS_UNKNOWN),
     mAdapterVendor(allAdapterVendors),
     mDevices(allDevices),
     mDeleteDevices(false),
     mFeature(allFeatures),
     mFeatureStatus(nsIGfxInfo::FEATURE_NO_INFO),
     mComparisonOp(DRIVER_UNKNOWN_COMPARISON),
     mDriverVersion(0),
-    mDriverVersionMax(0)
+    mDriverVersionMax(0),
+    mSuggestedVersion(nsnull)
 {}
 
 GfxDriverInfo::GfxDriverInfo(OperatingSystem os, PRUint32 vendor,
                              GfxDeviceFamily devices,
                              PRInt32 feature, PRInt32 featureStatus,
                              VersionComparisonOp op,
                              PRUint64 driverVersion,
+                             const char *suggestedVersion /* = nsnull */,
                              bool ownDevices /* = false */)
   : mOperatingSystem(os),
     mAdapterVendor(vendor),
     mDevices(devices),
     mDeleteDevices(ownDevices),
     mFeature(feature),
     mFeatureStatus(featureStatus),
     mComparisonOp(op),
     mDriverVersion(driverVersion),
-    mDriverVersionMax(0)
+    mDriverVersionMax(0),
+    mSuggestedVersion(suggestedVersion)
 {}
 
 GfxDriverInfo::GfxDriverInfo(const GfxDriverInfo& aOrig)
   : mOperatingSystem(aOrig.mOperatingSystem),
     mAdapterVendor(aOrig.mAdapterVendor),
     mFeature(aOrig.mFeature),
     mFeatureStatus(aOrig.mFeatureStatus),
     mComparisonOp(aOrig.mComparisonOp),
     mDriverVersion(aOrig.mDriverVersion),
-    mDriverVersionMax(aOrig.mDriverVersionMax)
+    mDriverVersionMax(aOrig.mDriverVersionMax),
+    mSuggestedVersion(aOrig.mSuggestedVersion)
 {
   // If we're managing the lifetime of the devices array, we have to make a
   // copy of the original's array.
   if (aOrig.mDeleteDevices) {
     PRUint32 count = 0;
     const PRUint32 *device = aOrig.mDevices;
     while (*device) {
       count++;
--- a/widget/src/xpwidgets/GfxDriverInfo.h
+++ b/widget/src/xpwidgets/GfxDriverInfo.h
@@ -74,17 +74,18 @@ enum VersionComparisonOp {
 typedef PRUint32 *GfxDeviceFamily;
 
 struct GfxDriverInfo
 {
   // If |ownDevices| is true, you are transferring ownership of the devices
   // array, and it will be deleted when this GfxDriverInfo is destroyed.
   GfxDriverInfo(OperatingSystem os, PRUint32 vendor, GfxDeviceFamily devices,
                 PRInt32 feature, PRInt32 featureStatus, VersionComparisonOp op,
-                PRUint64 driverVersion, bool ownDevices = false);
+                PRUint64 driverVersion, const char *suggestedVersion = nsnull,
+                bool ownDevices = false);
 
   GfxDriverInfo();
   GfxDriverInfo(const GfxDriverInfo&);
   ~GfxDriverInfo();
 
   OperatingSystem mOperatingSystem;
 
   PRUint32 mAdapterVendor;
@@ -104,16 +105,18 @@ struct GfxDriverInfo
   /* A feature status from nsIGfxInfo */
   PRInt32 mFeatureStatus;
 
   VersionComparisonOp mComparisonOp;
 
   /* versions are assumed to be A.B.C.D packed as 0xAAAABBBBCCCCDDDD */
   PRUint64 mDriverVersion;
   PRUint64 mDriverVersionMax;
+
+  const char *mSuggestedVersion;
 };
 
 #define GFX_DRIVER_VERSION(a,b,c,d) \
   ((PRUint64(a)<<48) | (PRUint64(b)<<32) | (PRUint64(c)<<16) | PRUint64(d))
 
 inline bool
 ParseDriverVersion(nsAString& aVersion, PRUint64 *aNumericVersion)
 {