BUG 1428174 - Add Qualcomm to Windows GPU Whitelist r=jrmuizel
authorJon Kunkee <jonathan.kunkee+bugzilla@gmail.com>
Fri, 05 Jan 2018 17:28:02 -0800
changeset 444388 c1f3acb9f5cce22e14f0639669058d4baa80d074
parent 444387 683dbd9a3330d378a950134970e0c7d152f6e0d5
child 444389 2fdccaab2e7c887b55455384c27f8c6344f01e4f
push id124
push userfmarier@mozilla.com
push dateTue, 30 Jan 2018 01:38:36 +0000
reviewersjrmuizel
bugs1428174
milestone59.0a1
BUG 1428174 - Add Qualcomm to Windows GPU Whitelist r=jrmuizel New Windows devices are coming out that have GPU Device ID strings of the form ACPI\VEN_QCOM&DEV_007C&SUBSYS_CLS08998&REV_007C as reported in the bug description. Since the VEN_ ID is not numeric, this change interprets the QCOM string so that it can be whitelisted and then whitelists it. MozReview-Commit-ID: 2ABRzvHKn6v
widget/GfxDriverInfo.cpp
widget/GfxDriverInfo.h
widget/windows/GfxInfo.cpp
--- a/widget/GfxDriverInfo.cpp
+++ b/widget/GfxDriverInfo.cpp
@@ -302,14 +302,17 @@ const nsAString& GfxDriverInfo::GetDevic
   switch (id) {
     DECLARE_VENDOR_ID(VendorAll, "");
     DECLARE_VENDOR_ID(VendorIntel, "0x8086");
     DECLARE_VENDOR_ID(VendorNVIDIA, "0x10de");
     DECLARE_VENDOR_ID(VendorAMD, "0x1022");
     DECLARE_VENDOR_ID(VendorATI, "0x1002");
     DECLARE_VENDOR_ID(VendorMicrosoft, "0x1414");
     DECLARE_VENDOR_ID(VendorParallels, "0x1ab8");
+    // Choose an arbitrary Qualcomm PCI VENdor ID for now.
+    // TODO: This should be "QCOM" when Windows device ID parsing is reworked.
+    DECLARE_VENDOR_ID(VendorQualcomm, "0x5143");
     // Suppress a warning.
     DECLARE_VENDOR_ID(DeviceVendorMax, "");
   }
 
   return *mDeviceVendors[id];
 }
--- a/widget/GfxDriverInfo.h
+++ b/widget/GfxDriverInfo.h
@@ -103,16 +103,17 @@ enum DeviceFamily {
 enum DeviceVendor {
   VendorAll, // There is an assumption that this is the first enum
   VendorIntel,
   VendorNVIDIA,
   VendorAMD,
   VendorATI,
   VendorMicrosoft,
   VendorParallels,
+  VendorQualcomm,
   DeviceVendorMax
 };
 
 /* Array of devices to match, or an empty array for all devices */
 typedef nsTArray<nsString> GfxDeviceFamily;
 
 struct GfxDriverInfo
 {
--- a/widget/windows/GfxInfo.cpp
+++ b/widget/windows/GfxInfo.cpp
@@ -260,16 +260,21 @@ ParseIDFromDeviceID(const nsAString &key
 {
   nsAutoString id(key);
   ToUpperCase(id);
   int32_t start = id.Find(prefix);
   if (start != -1) {
     id.Cut(0, start + strlen(prefix));
     id.Truncate(length);
   }
+  if (id.Equals(L"QCOM", nsCaseInsensitiveStringComparator())) {
+    // String format assumptions are broken, so use a Qualcomm PCI Vendor ID
+    // for now. See also GfxDriverInfo::GetDeviceVendor.
+    return 0x5143;
+  }
   nsresult err;
   return id.ToInteger(&err, 16);
 }
 
 // OS version in 16.16 major/minor form
 // based on http://msdn.microsoft.com/en-us/library/ms724834(VS.85).aspx
 enum {
   kWindowsUnknown = 0,
@@ -1405,16 +1410,17 @@ GfxInfo::GetFeatureStatusImpl(int32_t aF
     }
 
     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()) &&
         !adapterVendorID.Equals(GfxDriverInfo::GetDeviceVendor(VendorMicrosoft), nsCaseInsensitiveStringComparator()) &&
         !adapterVendorID.Equals(GfxDriverInfo::GetDeviceVendor(VendorParallels), nsCaseInsensitiveStringComparator()) &&
+        !adapterVendorID.Equals(GfxDriverInfo::GetDeviceVendor(VendorQualcomm), 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"))
     {