BUG 1428174 - Add Qualcomm to Windows GPU Whitelist draft
authorJon Kunkee <jonathan.kunkee+bugzilla@gmail.com>
Fri, 05 Jan 2018 17:28:02 -0800
changeset 721704 d6b13477633625e96e44fa2e10d168f038a0cd1a
parent 721703 e7a33d4b7271602c41347a99be1512d74ce78d91
child 746430 3789d3a602562cb54d25a21c1c37123327538fd4
push id95941
push userbmo:jonathan.kunkee+bugzilla@gmail.com
push dateWed, 17 Jan 2018 20:29:36 +0000
bugs1428174
milestone59.0a1
BUG 1428174 - Add Qualcomm to Windows GPU Whitelist 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"))
     {