Bug 1242659 - Only check for version if DLLs are in the recognized list. r=jrmuizel
authorMilan Sreckovic <milan@mozilla.com>
Fri, 10 Feb 2017 12:08:00 -0500
changeset 343227 bcc9785affeb9bb0f24f8773cfac3defa75ca518
parent 343226 0b83dd97c786bfc2641d1733e278faa35475d09c
child 343228 ee6c8b224924cb972a9b5d09a3ca154cecc665a8
push id31372
push usercbook@mozilla.com
push dateThu, 16 Feb 2017 12:16:10 +0000
treeherdermozilla-central@2737f66ad6ac [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs1242659
milestone54.0a1
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
Bug 1242659 - Only check for version if DLLs are in the recognized list. r=jrmuizel
widget/windows/GfxInfo.cpp
--- a/widget/windows/GfxInfo.cpp
+++ b/widget/windows/GfxInfo.cpp
@@ -560,50 +560,63 @@ GfxInfo::Init()
     }
   }
 
   mHasDriverVersionMismatch = false;
   if (mAdapterVendorID[mActiveGPUIndex] == GfxDriverInfo::GetDeviceVendor(VendorIntel)) {
     // we've had big crashers (bugs 590373 and 595364) apparently correlated
     // with bad Intel driver installations where the DriverVersion reported
     // by the registry was not the version of the DLL.
+
+    // Note that these start without the .dll extension but eventually gain it.
     bool is64bitApp = sizeof(void*) == 8;
-    const char16_t *dllFileName = is64bitApp
-                                 ? u"igd10umd64.dll"
-                                 : u"igd10umd32.dll",
-                    *dllFileName2 = is64bitApp
-                                 ? u"igd10iumd64.dll"
-                                 : u"igd10iumd32.dll";
+    nsAutoString dllFileName(is64bitApp ? u"igd10umd64" : u"igd10umd32");
+    nsAutoString dllFileName2(is64bitApp ? u"igd10iumd64" : u"igd10iumd32");
+
     nsString dllVersion, dllVersion2;
-    gfxWindowsPlatform::GetDLLVersion((char16_t*)dllFileName, dllVersion);
-    gfxWindowsPlatform::GetDLLVersion((char16_t*)dllFileName2, dllVersion2);
-
     uint64_t dllNumericVersion = 0, dllNumericVersion2 = 0,
              driverNumericVersion = 0, knownSafeMismatchVersion = 0;
-    ParseDriverVersion(dllVersion, &dllNumericVersion);
-    ParseDriverVersion(dllVersion2, &dllNumericVersion2);
+
+    // Only parse the DLL version for those found in the driver list
+    nsAutoString elligibleDLLs;
+    if (NS_SUCCEEDED(GetAdapterDriver(elligibleDLLs))) {
+      if (FindInReadable(dllFileName, elligibleDLLs)) {
+        dllFileName += NS_LITERAL_STRING(".dll");
+        gfxWindowsPlatform::GetDLLVersion(dllFileName.get(), dllVersion);
+        ParseDriverVersion(dllVersion, &dllNumericVersion);
+      }
+      if (FindInReadable(dllFileName2, elligibleDLLs)) {
+        dllFileName2 += NS_LITERAL_STRING(".dll");
+        gfxWindowsPlatform::GetDLLVersion(dllFileName2.get(), dllVersion2);
+        ParseDriverVersion(dllVersion2, &dllNumericVersion2);
+      }
+    }
 
     ParseDriverVersion(mDriverVersion[mActiveGPUIndex], &driverNumericVersion);
     ParseDriverVersion(NS_LITERAL_STRING("9.17.10.0"), &knownSafeMismatchVersion);
 
     // If there's a driver version mismatch, consider this harmful only when
     // the driver version is less than knownSafeMismatchVersion.  See the
     // above comment about crashes with old mismatches.  If the GetDllVersion
     // call fails, we are not calling it a mismatch.
     if ((dllNumericVersion != 0 && dllNumericVersion != driverNumericVersion) ||
         (dllNumericVersion2 != 0 && dllNumericVersion2 != driverNumericVersion)) {
       if (driverNumericVersion < knownSafeMismatchVersion ||
           std::max(dllNumericVersion, dllNumericVersion2) < knownSafeMismatchVersion) {
         mHasDriverVersionMismatch = true;
-        gfxCriticalNoteOnce << "Mismatched driver versions between the registry " << mDriverVersion[mActiveGPUIndex].get() << " and DLL(s) " << NS_ConvertUTF16toUTF8(dllVersion).get() << ", " << NS_ConvertUTF16toUTF8(dllVersion2).get() << " reported.";
+        gfxCriticalNoteOnce << "Mismatched driver versions between the registry " << NS_ConvertUTF16toUTF8(mDriverVersion[mActiveGPUIndex]).get() << " and DLL(s) " << NS_ConvertUTF16toUTF8(dllVersion).get() << ", " << NS_ConvertUTF16toUTF8(dllVersion2).get() << " reported.";
       }
     } else if (dllNumericVersion == 0 && dllNumericVersion2 == 0) {
       // Leave it as an asserting error for now, to see if we can find
       // a system that exhibits this kind of a problem internally.
-      gfxCriticalErrorOnce() << "Potential driver version mismatch ignored due to missing DLLs " << NS_ConvertUTF16toUTF8(dllVersion).get() << " and " << NS_ConvertUTF16toUTF8(dllVersion2).get();
+      gfxCriticalErrorOnce() << "Potential driver version mismatch ignored due to missing DLLs "
+                             << NS_ConvertUTF16toUTF8(dllFileName).get() << " v="
+                             << NS_ConvertUTF16toUTF8(dllVersion).get() << " and "
+                             << NS_ConvertUTF16toUTF8(dllFileName2).get() << " v="
+                             << NS_ConvertUTF16toUTF8(dllVersion2).get();
     }
   }
 
   const char *spoofedDriverVersionString = PR_GetEnv("MOZ_GFX_SPOOF_DRIVER_VERSION");
   if (spoofedDriverVersionString) {
     mDriverVersion[mActiveGPUIndex].AssignASCII(spoofedDriverVersionString);
   }