back out 8f7893e1c20c / Bug 705959 to allow backing out 8c075fee9be4 / Bug 704710
authorBenoit Jacob <bjacob@mozilla.com>
Thu, 08 Mar 2012 18:02:49 -0500
changeset 85552 08e1dd305b6bf6fe5204af3ef0ea71f1e2c6264f
parent 85551 2fccf5e774a79d3783d726975c4946551f969057
child 85553 9af0904f0486c84906eb0a2529404120b0fdc202
push id1
push usersledru@mozilla.com
push dateThu, 04 Dec 2014 17:57:20 +0000
bugs705959, 704710
milestone11.0
backs out8f7893e1c20c865f51f2f2688a91e4d2c0690b34
back out 8f7893e1c20c / Bug 705959 to allow backing out 8c075fee9be4 / Bug 704710
widget/src/android/GfxInfo.cpp
widget/src/cocoa/GfxInfo.mm
widget/src/xpwidgets/GfxDriverInfo.cpp
widget/src/xpwidgets/GfxDriverInfo.h
--- a/widget/src/android/GfxInfo.cpp
+++ b/widget/src/android/GfxInfo.cpp
@@ -273,29 +273,20 @@ GfxInfo::AddOpenGLCrashReportAnnotations
 
   CrashReporter::AppendAppNotesToCrashReport(note);
 #endif
 }
 
 const nsTArray<GfxDriverInfo>&
 GfxInfo::GetGfxDriverInfo()
 {
-  if (!mDriverInfo->Length()) {
-    /* The following entry, when uncommented, will allow us to whitelist a
-     * specific device. See the long comment in GetFeatureStatusImpl for more
-     * info. */
- // APPEND_TO_DRIVER_BLOCKLIST( DRIVER_OS_ALL,
- //   my_vendor_id, my_device_id,
- //   nsIGfxInfo::FEATURE_OPENGL_LAYERS, nsIGfxInfo::FEATURE_NO_INFO,
- //   DRIVER_LESS_THAN, GfxDriverInfo::allDevices );
-    APPEND_TO_DRIVER_BLOCKLIST2( DRIVER_OS_ALL,
-      (nsAString&) GfxDriverInfo::GetDeviceVendor(VendorAll), GfxDriverInfo::allDevices,
-      nsIGfxInfo::FEATURE_OPENGL_LAYERS, nsIGfxInfo::FEATURE_BLOCKED_DEVICE,
-      DRIVER_LESS_THAN, GfxDriverInfo::allDriverVersions );
-  }
+  // Nothing here yet.
+  //if (!mDriverInfo->Length()) {
+  //
+  //}
   return *mDriverInfo;
 }
 
 nsresult
 GfxInfo::GetFeatureStatusImpl(PRInt32 aFeature, 
                               PRInt32 *aStatus, 
                               nsAString & aSuggestedDriverVersion,
                               const nsTArray<GfxDriverInfo>& aDriverInfo, 
@@ -308,29 +299,26 @@ GfxInfo::GetFeatureStatusImpl(PRInt32 aF
   OperatingSystem os = DRIVER_OS_ANDROID;
 
   if (aFeature == FEATURE_OPENGL_LAYERS) {
     if (!mSetCrashReportAnnotations) {
       AddOpenGLCrashReportAnnotations();
       mSetCrashReportAnnotations = true;
     }
 
-    /* The following code is an old way to whitelist devices when we're ready.
-     * It is staying here for reference. The best way to do this now is to add
-     * an entry in the list above. There is a dummy entry which will whitelist a
-     * device when uncommented and device/vendor IDs are inserted. It is
-     * preferred that we stop whitelisting and instead go to blocklisting, where
-     * everything is assumed to be okay as long as it's not in the blocklist. */
+    /* XXX: Use this code when we're ready to whitelist devices. */
     // nsAutoString str;
     // /* Whitelist Galaxy S phones */
     // if (mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "HARDWARE", str)) {
     //   if (str != NS_LITERAL_STRING("smdkc110")) {
     //     status = FEATURE_BLOCKED_DEVICE;
     //   }
     // }
+
+    status = FEATURE_BLOCKED_DEVICE;
   }
 
   *aStatus = status;
   if (aOS)
     *aOS = os;
 
   return GfxInfoBase::GetFeatureStatusImpl(aFeature, aStatus, aSuggestedDriverVersion, aDriverInfo, &os);
 }
--- a/widget/src/cocoa/GfxInfo.mm
+++ b/widget/src/cocoa/GfxInfo.mm
@@ -107,16 +107,31 @@ GfxInfo::GetDeviceInfo()
   }
   CFTypeRef device_id_ref = SearchPortForProperty(dsp_port, CFSTR("device-id"));
   if (device_id_ref) {
     mAdapterDeviceID.AppendPrintf("0x%4x", IntValueOfCFData((CFDataRef)device_id_ref));
     CFRelease(device_id_ref);
   }
 }
 
+// TODO dRdR FIXME
+static bool
+IsATIRadeonX1000(nsAString& aVendorID, nsAString& aDeviceID)
+{
+  if (aVendorID.LowerCaseEqualsLiteral("0x1002")) {
+    // this list is from the ATIRadeonX1000.kext Info.plist
+    const char * devices[] = {"0x7187", "0x7210", "0x71de", "0x7146", "0x7142", "0x7109", "0x71c5", "0x71c0", "0x7240", "0x7249", "0x7291"};
+    for (size_t i = 0; i < ArrayLength(devices); i++) {
+      if (aDeviceID.LowerCaseEqualsASCII(devices[i]))
+        return true;
+    }
+  }
+  return false;
+}
+
 nsresult
 GfxInfo::Init()
 {
   NS_TIME_FUNCTION;
 
   nsresult rv = GfxInfoBase::Init();
 
   // Calling CGLQueryRendererInfo causes us to switch to the discrete GPU
@@ -349,22 +364,16 @@ GfxInfo::AddCrashReportAnnotations()
 
 const nsTArray<GfxDriverInfo>&
 GfxInfo::GetGfxDriverInfo()
 {
   if (!mDriverInfo->Length()) {
     IMPLEMENT_MAC_DRIVER_BLOCKLIST(DRIVER_OS_ALL,
       (nsAString&) GfxDriverInfo::GetDeviceVendor(VendorATI), GfxDriverInfo::allDevices,
       nsIGfxInfo::FEATURE_WEBGL_MSAA, nsIGfxInfo::FEATURE_BLOCKED_OS_VERSION);
-    IMPLEMENT_MAC_DRIVER_BLOCKLIST(DRIVER_OS_ALL,
-      (nsAString&) GfxDriverInfo::GetDeviceVendor(VendorATI), (GfxDeviceFamily*) GfxDriverInfo::GetDeviceFamily(RadeonX1000),
-      nsIGfxInfo::FEATURE_OPENGL_LAYERS, nsIGfxInfo::FEATURE_BLOCKED_DEVICE);
-    IMPLEMENT_MAC_DRIVER_BLOCKLIST(DRIVER_OS_ALL,
-      (nsAString&) GfxDriverInfo::GetDeviceVendor(VendorNVIDIA), (GfxDeviceFamily*) GfxDriverInfo::GetDeviceFamily(Geforce7300GT), 
-      nsIGfxInfo::FEATURE_WEBGL_OPENGL, nsIGfxInfo::FEATURE_BLOCKED_DEVICE);
   }
   return *mDriverInfo;
 }
 
 static OperatingSystem
 OSXVersionToOperatingSystem(PRUint32 aOSXVersion)
 {
   switch (aOSXVersion & MAC_OS_X_VERSION_MAJOR_MASK) {
@@ -398,17 +407,23 @@ GfxInfo::GetFeatureStatusImpl(PRInt32 aF
   //   * bug 631258: WebGL shader paints using textures belonging to other processes on Mac OS 10.5
   //   * bug 618848: Post process shaders and texture mapping crash OS X 10.5
   if (aFeature == nsIGfxInfo::FEATURE_WEBGL_OPENGL &&
       !nsToolkit::OnSnowLeopardOrLater())
   {
     status = nsIGfxInfo::FEATURE_BLOCKED_OS_VERSION;
   }
 
-  // The code around the following has been moved into the global blocklist.
+  if (aFeature == nsIGfxInfo::FEATURE_OPENGL_LAYERS) {
+    bool foundGoodDevice = false;
+
+    if (!IsATIRadeonX1000(mAdapterVendorID, mAdapterDeviceID)) {
+      foundGoodDevice = true;
+    }
+
 #if 0
     // CGL reports a list of renderers, some renderers are slow (e.g. software)
     // and AFAIK we can't decide which one will be used among them, so let's implement this by returning NO_INFO
     // if any not-known-to-be-bad renderer is found.
     // The assumption that we make here is that the system will spontaneously use the best/fastest renderer in the list.
     // Note that the presence of software renderer fallbacks means that slow software rendering may be automatically
     // used, which seems to be the case in bug 611292 where the user had a Intel GMA 945 card (non programmable hardware).
     // Therefore we need to explicitly blacklist non-OpenGL2 hardware, which could result in a software renderer
@@ -435,16 +450,33 @@ GfxInfo::GetFeatureStatusImpl(PRInt32 aF
         case kCGLRendererAppleSWID: // software renderer
           break;
         default:
           if (mRendererIDs[i])
             foundGoodDevice = true;
       }
     }
 #endif
+    if (!foundGoodDevice)
+      status = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
+  }
+
+  if (aFeature == nsIGfxInfo::FEATURE_WEBGL_OPENGL) {
+    // same comment as above for FEATURE_OPENGL_LAYERS.
+    bool foundGoodDevice = true;
+
+    // Blacklist the Geforce 7300 GT because of bug 678053
+    if (mAdapterVendorID.LowerCaseEqualsLiteral("0x10de") &&
+        mAdapterDeviceID.LowerCaseEqualsLiteral("0x0393")) {
+      foundGoodDevice = false;
+    }
+
+    if (!foundGoodDevice)
+      status = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
+  }
 
   if (aFeature == nsIGfxInfo::FEATURE_WEBGL_MSAA) {
     // Blacklist all ATI cards on OSX, except for
     // 0x6760 and 0x9488
     if (mAdapterVendorID == GfxDriverInfo::GetDeviceVendor(VendorATI) && 
         (mAdapterDeviceID.LowerCaseEqualsLiteral("0x6760") ||
          mAdapterDeviceID.LowerCaseEqualsLiteral("0x9488"))) {
       *aStatus = nsIGfxInfo::FEATURE_NO_INFO;
--- a/widget/src/xpwidgets/GfxDriverInfo.cpp
+++ b/widget/src/xpwidgets/GfxDriverInfo.cpp
@@ -210,33 +210,16 @@ const GfxDeviceFamily* GfxDriverInfo::Ge
       APPEND_DEVICE(0x0244); /* C51 [Geforce Go 6150 (TM)] */
       APPEND_DEVICE(0x0245); /* C51 [Quadro NVS 210S/GeForce 6150LE (TM)] */
       APPEND_DEVICE(0x0247); /* C51 [GeForce Go 6100 (TM)] */
       APPEND_DEVICE(0x03d0); /* C61 [GeForce 6150SE nForce 430 (TM)] */
       APPEND_DEVICE(0x03d1); /* C61 [GeForce 6100 nForce 405 (TM)] */
       APPEND_DEVICE(0x03d2); /* C61 [GeForce 6100 nForce 400 (TM)] */
       APPEND_DEVICE(0x03d5); /* C61 [GeForce 6100 nForce 420 (TM)] */
       break;
-    case RadeonX1000:
-      // This list is from the ATIRadeonX1000.kext Info.plist
-      APPEND_DEVICE(0x7187);
-      APPEND_DEVICE(0x7210);
-      APPEND_DEVICE(0x71de);
-      APPEND_DEVICE(0x7146);
-      APPEND_DEVICE(0x7142);
-      APPEND_DEVICE(0x7109);
-      APPEND_DEVICE(0x71c5);
-      APPEND_DEVICE(0x71c0);
-      APPEND_DEVICE(0x7240);
-      APPEND_DEVICE(0x7249);
-      APPEND_DEVICE(0x7291);
-      break;
-    case Geforce7300GT:
-      APPEND_DEVICE(0x0393);
-      break;
     // This should never happen, but we get a warning if we don't handle this.
     case DeviceFamilyMax:
       NS_WARNING("Invalid DeviceFamily id");
       break;
   }
 
   return deviceFamily;
 }
--- a/widget/src/xpwidgets/GfxDriverInfo.h
+++ b/widget/src/xpwidgets/GfxDriverInfo.h
@@ -83,18 +83,16 @@ enum VersionComparisonOp {
 enum DeviceFamily {
   IntelGMA500,
   IntelGMA900,
   IntelGMA950,
   IntelGMA3150,
   IntelGMAX3000,
   IntelGMAX4500HD,
   NvidiaBlockD3D9Layers,
-  RadeonX1000,
-  Geforce7300GT,
   DeviceFamilyMax
 };
 
 enum DeviceVendor {
   VendorAll,
   VendorIntel,
   VendorNVIDIA,
   VendorAMD,