Bug 696437 - Add OpenGL Gfx AppNotes for mobile. r=bjacob
authorBenoit Girard <b56girard@gmail.com>
Tue, 01 Nov 2011 08:00:09 -0700
changeset 79572 98892c213475a5c07dfa4ee79226be8772050028
parent 79571 1cab0ad00ce7ddb46b5843850f91516499f22120
child 79573 05ec576d7b3b3745b2db7ff372e24f5645c2e3d8
push id3056
push userb56girard@gmail.com
push dateWed, 02 Nov 2011 14:09:44 +0000
treeherdermozilla-inbound@05ec576d7b3b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbjacob
bugs696437
milestone10.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 696437 - Add OpenGL Gfx AppNotes for mobile. r=bjacob
widget/src/android/GfxInfo.cpp
widget/src/android/GfxInfo.h
--- a/widget/src/android/GfxInfo.cpp
+++ b/widget/src/android/GfxInfo.cpp
@@ -82,16 +82,17 @@ NS_IMETHODIMP
 GfxInfo::GetCleartypeParameters(nsAString & aCleartypeParams)
 {
   return NS_ERROR_FAILURE;
 }
 
 nsresult
 GfxInfo::Init()
 {
+  mSetCrashReportAnnotations = false;
   return GfxInfoBase::Init();
 }
 
 /* readonly attribute DOMString adapterDescription; */
 NS_IMETHODIMP
 GfxInfo::GetAdapterDescription(nsAString & aAdapterDescription)
 {
   aAdapterDescription.AssignASCII(mozilla::gl::GetVendor());
@@ -215,53 +216,46 @@ GfxInfo::GetAdapterDeviceID2(PRUint32 *a
 /* readonly attribute boolean isGPU2Active; */
 NS_IMETHODIMP
 GfxInfo::GetIsGPU2Active(bool* aIsGPU2Active)
 {
   return NS_ERROR_FAILURE;
 }
 
 void
-GfxInfo::AddCrashReportAnnotations()
+GfxInfo::AddOpenGLCrashReportAnnotations()
 {
-#if 0
 #if defined(MOZ_CRASHREPORTER)
   nsCAutoString deviceIDString, vendorIDString;
+  nsAutoString adapterDescriptionString;
   PRUint32 deviceID, vendorID;
 
   GetAdapterDeviceID(&deviceID);
   GetAdapterVendorID(&vendorID);
+  GetAdapterDescription(adapterDescriptionString);
 
   deviceIDString.AppendPrintf("%04x", deviceID);
   vendorIDString.AppendPrintf("%04x", vendorID);
 
   CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AdapterVendorID"),
       vendorIDString);
   CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AdapterDeviceID"),
       deviceIDString);
 
   /* Add an App Note for now so that we get the data immediately. These
    * can go away after we store the above in the socorro db */
   nsCAutoString note;
   /* AppendPrintf only supports 32 character strings, mrghh. */
   note.AppendPrintf("AdapterVendorID: %04x, ", vendorID);
-  note.AppendPrintf("AdapterDeviceID: %04x", deviceID);
-
-  if (vendorID == 0) {
-      /* if we didn't find a valid vendorID lets append the mDeviceID string to try to find out why */
-      note.Append(", ");
-      note.AppendWithConversion(mDeviceID);
-      note.Append(", ");
-      note.AppendWithConversion(mDeviceKeyDebug);
-  }
+  note.AppendPrintf("AdapterDeviceID: %04x.", deviceID);
+  note.Append("\n");
+  note.AppendPrintf("AdapterDescription: '%s'.", NS_ConvertUTF16toUTF8(adapterDescriptionString).get());
   note.Append("\n");
 
   CrashReporter::AppendAppNotesToCrashReport(note);
-
-#endif
 #endif
 }
 
 nsresult
 GfxInfo::GetFeatureStatusImpl(PRInt32 aFeature, PRInt32 *aStatus, nsAString & aSuggestedDriverVersion,
                               GfxDriverInfo* aDriverInfo /* = nsnull */)
 {
   PRInt32 status = nsIGfxInfo::FEATURE_NO_INFO;
@@ -270,16 +264,21 @@ GfxInfo::GetFeatureStatusImpl(PRInt32 aF
 
   // For now, we don't implement the downloaded blacklist.
   if (aDriverInfo) {
     *aStatus = status;
     return NS_OK;
   }
 
   if (aFeature == FEATURE_OPENGL_LAYERS) {
+    if (!mSetCrashReportAnnotations) {
+      AddOpenGLCrashReportAnnotations();
+      mSetCrashReportAnnotations = true;
+    }
+
     /* 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;
     //   }
     // }
--- a/widget/src/android/GfxInfo.h
+++ b/widget/src/android/GfxInfo.h
@@ -79,17 +79,18 @@ public:
   virtual nsresult Init();
 
 protected:
 
   virtual nsresult GetFeatureStatusImpl(PRInt32 aFeature, PRInt32 *aStatus, nsAString & aSuggestedDriverVersion, GfxDriverInfo* aDriverInfo = nsnull);
 
 private:
 
-  void AddCrashReportAnnotations();
+  void     AddOpenGLCrashReportAnnotations();
+  bool     mSetCrashReportAnnotations;
   nsString mRendererIDsString;
   nsString mAdapterRAMString;
 
   nsString mDeviceID;
   nsString mDriverVersion;
   nsString mDriverDate;
   nsString mDeviceKey;