Backed out changeset 0f40b745a669 (bug 1323834) for bustage. r=backout on a CLOSED TREE
authorSebastian Hengst <archaeopteryx@coole-files.de>
Tue, 20 Dec 2016 17:37:16 +0100
changeset 326656 10e3ea2d5f6bb79d263c5c4a52df59f29959e5be
parent 326655 20dc8f3fa6ed662f4d8b5fd9306d4445db4ceb29
child 326657 1f6800191787b2d77acaa0b4f11ee351e14e5ceb
push id85010
push userphilringnalda@gmail.com
push dateWed, 21 Dec 2016 04:21:25 +0000
treeherdermozilla-inbound@009bb9bc85e4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1323834
milestone53.0a1
backs out0f40b745a66919b09fe289c797a2cb7fd6b9079b
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset 0f40b745a669 (bug 1323834) for bustage. r=backout on a CLOSED TREE
widget/GfxInfoBase.cpp
--- a/widget/GfxInfoBase.cpp
+++ b/widget/GfxInfoBase.cpp
@@ -662,74 +662,62 @@ int32_t
 GfxInfoBase::FindBlocklistedDeviceInList(const nsTArray<GfxDriverInfo>& info,
                                          nsAString& aSuggestedVersion,
                                          int32_t aFeature,
                                          nsACString& aFailureId,
                                          OperatingSystem os)
 {
   int32_t status = nsIGfxInfo::FEATURE_STATUS_UNKNOWN;
 
-  // Get the adapters once then reuse below
-  nsAutoString adapterVendorID[2];
-  nsAutoString adapterDeviceID[2];
-  nsAutoString adapterDriverVersionString[2];
-  bool adapterInfoFailed[2];
-  uint64_t driverVersion[2] = {0, 0};
-
-  adapterInfoFailed[0] = (NS_FAILED(GetAdapterVendorID(adapterVendorID[0])) ||
-			  NS_FAILED(GetAdapterDeviceID(adapterDeviceID[0])) ||
-			  NS_FAILED(GetAdapterDriverVersion(adapterDriverVersionString[0])));
-  adapterInfoFailed[1] = (NS_FAILED(GetAdapterVendorID2(adapterVendorID[1])) ||
-			  NS_FAILED(GetAdapterDeviceID2(adapterDeviceID[1])) ||
-			  NS_FAILED(GetAdapterDriverVersion2(adapterDriverVersionString[1])));
-  // No point in going on if we don't have adapter info
-  if (adapterInfoFailed[0] && adapterInfoFailed[1]) {
-    return 0;
-  }
-
-#if defined(XP_WIN) || defined(ANDROID)
-  if (!adapterInfoFailed[0]) {
-    ParseDriverVersion(adapterDriverVersionString[0], &driverVersion[0]);
-  }
-  if (!adapterInfoFailed[1]) {
-    ParseDriverVersion(adapterDriverVersionString[1], &driverVersion[1]);
-  }
-#endif
-
   uint32_t i = 0;
   for (; i < info.Length(); i++) {
-    // If we don't have the info for this GPU, no need to check further.
-    // It is unclear that we would ever have a mixture of 1st and 2nd
-    // GPU, but leaving the code in for that possibility for now.
-    // (Actually, currently mGpu2 will never be true, so this can
-    // be optimized out.)
-    uint32_t infoIndex = info[i].mGpu2 ? 1 : 0;
-    if (adapterInfoFailed[infoIndex]) {
-      continue;
-    }
-
     // Do the operating system check first, no point in getting the driver
     // info if we won't need to use it.
     if (!MatchingOperatingSystems(info[i].mOperatingSystem, os)) {
       continue;
     }
 
     if (info[i].mOperatingSystemVersion && info[i].mOperatingSystemVersion != OperatingSystemVersion()) {
         continue;
     }
 
+    // XXX: it would be better not to do this everytime round the loop
+    nsAutoString adapterVendorID;
+    nsAutoString adapterDeviceID;
+    nsAutoString adapterDriverVersionString;
+    if (info[i].mGpu2) {
+      if (NS_FAILED(GetAdapterVendorID2(adapterVendorID)) ||
+          NS_FAILED(GetAdapterDeviceID2(adapterDeviceID)) ||
+          NS_FAILED(GetAdapterDriverVersion2(adapterDriverVersionString)))
+      {
+        return 0;
+      }
+    } else {
+      if (NS_FAILED(GetAdapterVendorID(adapterVendorID)) ||
+          NS_FAILED(GetAdapterDeviceID(adapterDeviceID)) ||
+          NS_FAILED(GetAdapterDriverVersion(adapterDriverVersionString)))
+      {
+        return 0;
+      }
+    }
+
+#if defined(XP_WIN) || defined(ANDROID)
+    uint64_t driverVersion;
+    ParseDriverVersion(adapterDriverVersionString, &driverVersion);
+#endif
+
     if (!info[i].mAdapterVendor.Equals(GfxDriverInfo::GetDeviceVendor(VendorAll), nsCaseInsensitiveStringComparator()) &&
-        !info[i].mAdapterVendor.Equals(adapterVendorID[infoIndex], nsCaseInsensitiveStringComparator())) {
+        !info[i].mAdapterVendor.Equals(adapterVendorID, nsCaseInsensitiveStringComparator())) {
       continue;
     }
 
     if (info[i].mDevices != GfxDriverInfo::allDevices && info[i].mDevices->Length()) {
         bool deviceMatches = false;
         for (uint32_t j = 0; j < info[i].mDevices->Length(); j++) {
-            if ((*info[i].mDevices)[j].Equals(adapterDeviceID[infoIndex], nsCaseInsensitiveStringComparator())) {
+            if ((*info[i].mDevices)[j].Equals(adapterDeviceID, nsCaseInsensitiveStringComparator())) {
                 deviceMatches = true;
                 break;
             }
         }
 
         if (!deviceMatches) {
             continue;
         }
@@ -748,47 +736,47 @@ GfxInfoBase::FindBlocklistedDeviceInList
     }
     if (!info[i].mManufacturer.IsEmpty() && !info[i].mManufacturer.Equals(Manufacturer())) {
         continue;
     }
 
 #if defined(XP_WIN) || defined(ANDROID)
     switch (info[i].mComparisonOp) {
     case DRIVER_LESS_THAN:
-      match = driverVersion[infoIndex] < info[i].mDriverVersion;
+      match = driverVersion < info[i].mDriverVersion;
       break;
     case DRIVER_BUILD_ID_LESS_THAN:
-      match = (driverVersion[infoIndex] & 0xFFFF) < info[i].mDriverVersion;
+      match = (driverVersion & 0xFFFF) < info[i].mDriverVersion;
       break;
     case DRIVER_LESS_THAN_OR_EQUAL:
-      match = driverVersion[infoIndex] <= info[i].mDriverVersion;
+      match = driverVersion <= info[i].mDriverVersion;
       break;
     case DRIVER_BUILD_ID_LESS_THAN_OR_EQUAL:
-      match = (driverVersion[infoIndex] & 0xFFFF) <= info[i].mDriverVersion;
+      match = (driverVersion & 0xFFFF) <= info[i].mDriverVersion;
       break;
     case DRIVER_GREATER_THAN:
-      match = driverVersion[infoIndex] > info[i].mDriverVersion;
+      match = driverVersion > info[i].mDriverVersion;
       break;
     case DRIVER_GREATER_THAN_OR_EQUAL:
-      match = driverVersion[infoIndex] >= info[i].mDriverVersion;
+      match = driverVersion >= info[i].mDriverVersion;
       break;
     case DRIVER_EQUAL:
-      match = driverVersion[infoIndex] == info[i].mDriverVersion;
+      match = driverVersion == info[i].mDriverVersion;
       break;
     case DRIVER_NOT_EQUAL:
-      match = driverVersion[infoIndex] != info[i].mDriverVersion;
+      match = driverVersion != info[i].mDriverVersion;
       break;
     case DRIVER_BETWEEN_EXCLUSIVE:
-      match = driverVersion[infoIndex] > info[i].mDriverVersion && driverVersion[infoIndex] < info[i].mDriverVersionMax;
+      match = driverVersion > info[i].mDriverVersion && driverVersion < info[i].mDriverVersionMax;
       break;
     case DRIVER_BETWEEN_INCLUSIVE:
-      match = driverVersion[infoIndex] >= info[i].mDriverVersion && driverVersion[infoIndex] <= info[i].mDriverVersionMax;
+      match = driverVersion >= info[i].mDriverVersion && driverVersion <= info[i].mDriverVersionMax;
       break;
     case DRIVER_BETWEEN_INCLUSIVE_START:
-      match = driverVersion[infoIndex] >= info[i].mDriverVersion && driverVersion[infoIndex] < info[i].mDriverVersionMax;
+      match = driverVersion >= info[i].mDriverVersion && driverVersion < info[i].mDriverVersionMax;
       break;
     case DRIVER_COMPARISON_IGNORED:
       // We don't have a comparison op, so we match everything.
       match = true;
       break;
     default:
       NS_WARNING("Bogus op in GfxDriverInfo");
       break;
@@ -817,21 +805,25 @@ GfxInfoBase::FindBlocklistedDeviceInList
 #if defined(XP_WIN)
   // As a very special case, we block D2D on machines with an NVidia 310M GPU
   // as either the primary or secondary adapter.  D2D is also blocked when the
   // NV 310M is the primary adapter (using the standard blocklisting mechanism).
   // If the primary GPU already matched something in the blocklist then we
   // ignore this special rule.  See bug 1008759.
   if (status == nsIGfxInfo::FEATURE_STATUS_UNKNOWN &&
     (aFeature == nsIGfxInfo::FEATURE_DIRECT2D)) {
-    if (!adapterInfoFailed[1]) {
+    nsAutoString adapterVendorID2;
+    nsAutoString adapterDeviceID2;
+    if ((!NS_FAILED(GetAdapterVendorID2(adapterVendorID2))) &&
+      (!NS_FAILED(GetAdapterDeviceID2(adapterDeviceID2))))
+    {
       nsAString &nvVendorID = (nsAString &)GfxDriverInfo::GetDeviceVendor(VendorNVIDIA);
       const nsString nv310mDeviceId = NS_LITERAL_STRING("0x0A70");
-      if (nvVendorID.Equals(adapterVendorID[1], nsCaseInsensitiveStringComparator()) &&
-        nv310mDeviceId.Equals(adapterDeviceID[1], nsCaseInsensitiveStringComparator())) {
+      if (nvVendorID.Equals(adapterVendorID2, nsCaseInsensitiveStringComparator()) &&
+        nv310mDeviceId.Equals(adapterDeviceID2, nsCaseInsensitiveStringComparator())) {
         status = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
         aFailureId = "FEATURE_FAILURE_D2D_NV310M_BLOCK";
       }
     }
   }
 
   // Depends on Windows driver versioning. We don't pass a GfxDriverInfo object
   // back to the Windows handler, so we must handle this here.