Bug 711656: potentially fixed devices not being caught by blocklist, r=joe, a=jpr
authorDoug Sherk <doug@sherk.me>
Tue, 21 Feb 2012 14:49:06 -0500
changeset 87224 da24c3793fa877fa0cb02383624c2d8e80082576
parent 87223 7d7576bb68148d24ce54eed5523acdc0245d1e1d
child 87225 77a5d4052be1992042088743d17c58a2bee82c51
push id883
push userbjacob@mozilla.com
push dateTue, 21 Feb 2012 19:56:33 +0000
treeherdermozilla-aurora@da24c3793fa8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjoe, jpr
bugs711656
milestone12.0a2
Bug 711656: potentially fixed devices not being caught by blocklist, r=joe, a=jpr This doesn't necessarily fix the bug, but I think the problem was that the device IDs were in upper case but we store them statically in lower case, all the while using case-sensitive comparators. This patch switches all comparators that I could find to use case-insensitive instead, hopefully solving this.
widget/cocoa/GfxInfo.mm
widget/windows/GfxInfo.cpp
widget/xpwidgets/GfxInfoBase.cpp
--- a/widget/cocoa/GfxInfo.mm
+++ b/widget/cocoa/GfxInfo.mm
@@ -445,17 +445,17 @@ GfxInfo::GetFeatureStatusImpl(PRInt32 aF
               foundGoodDevice = true;
         }
       }
 #endif
 
     if (aFeature == nsIGfxInfo::FEATURE_WEBGL_MSAA) {
       // Blacklist all ATI cards on OSX, except for
       // 0x6760 and 0x9488
-      if (mAdapterVendorID == GfxDriverInfo::GetDeviceVendor(VendorATI) && 
+      if (mAdapterVendorID.Equals(GfxDriverInfo::GetDeviceVendor(VendorATI), nsCaseInsensitiveStringComparator()) && 
           (mAdapterDeviceID.LowerCaseEqualsLiteral("0x6760") ||
            mAdapterDeviceID.LowerCaseEqualsLiteral("0x9488"))) {
         *aStatus = nsIGfxInfo::FEATURE_NO_INFO;
         return NS_OK;
       }
     }
   }
 
--- a/widget/windows/GfxInfo.cpp
+++ b/widget/windows/GfxInfo.cpp
@@ -954,20 +954,20 @@ GfxInfo::GetFeatureStatusImpl(PRInt32 aF
     nsAutoString adapterDriverVersionString;
     if (NS_FAILED(GetAdapterVendorID(adapterVendorID)) ||
         NS_FAILED(GetAdapterDeviceID(adapterDeviceID)) ||
         NS_FAILED(GetAdapterDriverVersion(adapterDriverVersionString)))
     {
       return NS_ERROR_FAILURE;
     }
 
-    if (adapterVendorID != GfxDriverInfo::GetDeviceVendor(VendorIntel) &&
-        adapterVendorID != GfxDriverInfo::GetDeviceVendor(VendorNVIDIA) &&
-        adapterVendorID != GfxDriverInfo::GetDeviceVendor(VendorAMD) &&
-        adapterVendorID != GfxDriverInfo::GetDeviceVendor(VendorATI) &&
+    if (!adapterVendorID.Equals(GfxDriverInfo::GetDeviceVendor(VendorIntel), nsCaseInsensitiveStringComparator()) &&
+        !adapterVendorID.Equals(GfxDriverInfo::GetDeviceVendor(VendorNVIDIA), nsCaseInsensitiveStringComparator()) &&
+        !adapterVendorID.Equals(GfxDriverInfo::GetDeviceVendor(VendorAMD), nsCaseInsensitiveStringComparator()) &&
+        !adapterVendorID.Equals(GfxDriverInfo::GetDeviceVendor(VendorATI), nsCaseInsensitiveStringComparator()) &&
         // FIXME - these special hex values are currently used in xpcshell tests introduced by
         // bug 625160 patch 8/8. Maybe these tests need to be adjusted now that we're only whitelisting
         // intel/ati/nvidia.
         !adapterVendorID.LowerCaseEqualsLiteral("0xabcd") &&
         !adapterVendorID.LowerCaseEqualsLiteral("0xdcba") &&
         !adapterVendorID.LowerCaseEqualsLiteral("0xabab") &&
         !adapterVendorID.LowerCaseEqualsLiteral("0xdcdc"))
     {
@@ -979,17 +979,17 @@ GfxInfo::GetFeatureStatusImpl(PRInt32 aF
     if (!ParseDriverVersion(adapterDriverVersionString, &driverVersion)) {
       return NS_ERROR_FAILURE;
     }
 
     // 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 (mWindowsVersion == gfxWindowsPlatform::kWindowsXP &&
-        adapterVendorID == GfxDriverInfo::GetDeviceVendor(VendorNVIDIA) &&
+        adapterVendorID.Equals(GfxDriverInfo::GetDeviceVendor(VendorNVIDIA), nsCaseInsensitiveStringComparator()) &&
         adapterDeviceID.LowerCaseEqualsLiteral("0x0861") && // GeForce 9400
         driverVersion == V(6,14,11,7756))
     {
       *aStatus = FEATURE_NO_INFO;
       return NS_OK;
     }
 
     if (aFeature == FEATURE_DIRECT3D_9_LAYERS &&
--- a/widget/xpwidgets/GfxInfoBase.cpp
+++ b/widget/xpwidgets/GfxInfoBase.cpp
@@ -42,16 +42,17 @@
 #include "GfxInfoBase.h"
 
 #include "GfxInfoWebGL.h"
 #include "GfxDriverInfo.h"
 #include "nsCOMPtr.h"
 #include "nsCOMArray.h"
 #include "nsAutoPtr.h"
 #include "nsString.h"
+#include "nsUnicharUtils.h"
 #include "mozilla/Services.h"
 #include "mozilla/Observer.h"
 #include "nsIObserver.h"
 #include "nsIObserverService.h"
 #include "nsIDOMElement.h"
 #include "nsIDOMNode.h"
 #include "nsIDOMNodeList.h"
 #include "nsTArray.h"
@@ -638,25 +639,25 @@ GfxInfoBase::FindBlocklistedDeviceInList
   PRUint32 i = 0;
   for (; i < info.Length(); i++) {
     if (info[i].mOperatingSystem != DRIVER_OS_ALL &&
         info[i].mOperatingSystem != os)
     {
       continue;
     }
 
-    if (info[i].mAdapterVendor != GfxDriverInfo::GetDeviceVendor(VendorAll) &&
-        info[i].mAdapterVendor != adapterVendorID) {
+    if (!info[i].mAdapterVendor.Equals(GfxDriverInfo::GetDeviceVendor(VendorAll), nsCaseInsensitiveStringComparator()) &&
+        !info[i].mAdapterVendor.Equals(adapterVendorID, nsCaseInsensitiveStringComparator())) {
       continue;
     }
 
     if (info[i].mDevices != GfxDriverInfo::allDevices && info[i].mDevices->Length()) {
         bool deviceMatches = false;
         for (PRUint32 j = 0; j < info[i].mDevices->Length(); j++) {
-            if ((*info[i].mDevices)[j] == adapterDeviceID) {
+            if ((*info[i].mDevices)[j].Equals(adapterDeviceID, nsCaseInsensitiveStringComparator())) {
                 deviceMatches = true;
                 break;
             }
         }
 
         if (!deviceMatches) {
             continue;
         }