Bug 764125; sort out preferred and fallback Azure backends for all platforms (gfxInfo). r=Bas
authorNicholas Cameron <ncameron@mozilla.com>
Wed, 25 Jul 2012 12:46:20 +1200
changeset 100593 79a562f4b12d410c818cd5e25b51f9f596004711
parent 100592 03e169cce29ae3a69b93cbc65c87d7f5c4b3477f
child 100594 148d57e5d0620b5a8bdda9eec325eafdfac49b57
push id1490
push userakeybl@mozilla.com
push dateMon, 08 Oct 2012 18:29:50 +0000
treeherdermozilla-esr52@fd72dbbd6920 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersBas
bugs764125
milestone17.0a1
Bug 764125; sort out preferred and fallback Azure backends for all platforms (gfxInfo). r=Bas
widget/android/GfxInfo.cpp
widget/android/GfxInfo.h
widget/cocoa/GfxInfo.h
widget/cocoa/GfxInfo.mm
widget/windows/GfxInfo.cpp
widget/windows/GfxInfo.h
widget/xpwidgets/GfxInfoBase.cpp
widget/xpwidgets/GfxInfoBase.h
widget/xpwidgets/GfxInfoX11.cpp
widget/xpwidgets/GfxInfoX11.h
--- a/widget/android/GfxInfo.cpp
+++ b/widget/android/GfxInfo.cpp
@@ -38,22 +38,16 @@ GfxInfo::GetD2DEnabled(bool *aEnabled)
 }
 
 nsresult
 GfxInfo::GetDWriteEnabled(bool *aEnabled)
 {
   return NS_ERROR_FAILURE;
 }
 
-nsresult
-GfxInfo::GetAzureEnabled(bool *aEnabled)
-{
-  return NS_ERROR_FAILURE;
-}
-
 /* readonly attribute DOMString DWriteVersion; */
 NS_IMETHODIMP
 GfxInfo::GetDWriteVersion(nsAString & aDwriteVersion)
 {
   return NS_ERROR_FAILURE;
 }
 
 /* readonly attribute DOMString cleartypeParameters; */
--- a/widget/android/GfxInfo.h
+++ b/widget/android/GfxInfo.h
@@ -20,17 +20,16 @@ class GfxInfo : public GfxInfoBase
 {
 public:
   GfxInfo();
 
   // We only declare the subset of nsIGfxInfo that we actually implement. The
   // rest is brought forward from GfxInfoBase.
   NS_IMETHOD GetD2DEnabled(bool *aD2DEnabled);
   NS_IMETHOD GetDWriteEnabled(bool *aDWriteEnabled);
-  NS_IMETHOD GetAzureEnabled(bool *aAzureEnabled);
   NS_IMETHOD GetDWriteVersion(nsAString & aDwriteVersion);
   NS_IMETHOD GetCleartypeParameters(nsAString & aCleartypeParams);
   NS_IMETHOD GetAdapterDescription(nsAString & aAdapterDescription);
   NS_IMETHOD GetAdapterDriver(nsAString & aAdapterDriver);
   NS_IMETHOD GetAdapterVendorID(nsAString & aAdapterVendorID);
   NS_IMETHOD GetAdapterDeviceID(nsAString & aAdapterDeviceID);
   NS_IMETHOD GetAdapterRAM(nsAString & aAdapterRAM);
   NS_IMETHOD GetAdapterDriverVersion(nsAString & aAdapterDriverVersion);
@@ -41,16 +40,17 @@ public:
   NS_IMETHOD GetAdapterDeviceID2(nsAString & aAdapterDeviceID);
   NS_IMETHOD GetAdapterRAM2(nsAString & aAdapterRAM);
   NS_IMETHOD GetAdapterDriverVersion2(nsAString & aAdapterDriverVersion);
   NS_IMETHOD GetAdapterDriverDate2(nsAString & aAdapterDriverDate);
   NS_IMETHOD GetIsGPU2Active(bool *aIsGPU2Active);
   using GfxInfoBase::GetFeatureStatus;
   using GfxInfoBase::GetFeatureSuggestedDriverVersion;
   using GfxInfoBase::GetWebGLParameter;
+  using GfxInfoBase::GetAzureEnabled;
 
   void EnsureInitializedFromGfxInfoData();
 
 #ifdef DEBUG
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSIGFXINFODEBUG
 #endif
 
--- a/widget/cocoa/GfxInfo.h
+++ b/widget/cocoa/GfxInfo.h
@@ -19,17 +19,16 @@ class GfxInfo : public GfxInfoBase
 {
 public:
 
   GfxInfo();
   // We only declare the subset of nsIGfxInfo that we actually implement. The
   // rest is brought forward from GfxInfoBase.
   NS_IMETHOD GetD2DEnabled(bool *aD2DEnabled);
   NS_IMETHOD GetDWriteEnabled(bool *aDWriteEnabled);
-  NS_IMETHOD GetAzureEnabled(bool *aAzureEnabled);
   NS_IMETHOD GetDWriteVersion(nsAString & aDwriteVersion);
   NS_IMETHOD GetCleartypeParameters(nsAString & aCleartypeParams);
   NS_IMETHOD GetAdapterDescription(nsAString & aAdapterDescription);
   NS_IMETHOD GetAdapterDriver(nsAString & aAdapterDriver);
   NS_IMETHOD GetAdapterVendorID(nsAString & aAdapterVendorID);
   NS_IMETHOD GetAdapterDeviceID(nsAString & aAdapterDeviceID);
   NS_IMETHOD GetAdapterRAM(nsAString & aAdapterRAM);
   NS_IMETHOD GetAdapterDriverVersion(nsAString & aAdapterDriverVersion);
@@ -41,16 +40,17 @@ public:
   NS_IMETHOD GetAdapterRAM2(nsAString & aAdapterRAM);
   NS_IMETHOD GetAdapterDriverVersion2(nsAString & aAdapterDriverVersion);
   NS_IMETHOD GetAdapterDriverDate2(nsAString & aAdapterDriverDate);
   NS_IMETHOD GetIsGPU2Active(bool *aIsGPU2Active);
 
   using GfxInfoBase::GetFeatureStatus;
   using GfxInfoBase::GetFeatureSuggestedDriverVersion;
   using GfxInfoBase::GetWebGLParameter;
+  using GfxInfoBase::GetAzureEnabled;
 
   virtual nsresult Init();
 
 #ifdef DEBUG
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSIGFXINFODEBUG
 #endif
 
--- a/widget/cocoa/GfxInfo.mm
+++ b/widget/cocoa/GfxInfo.mm
@@ -150,30 +150,16 @@ GfxInfo::Init()
 
 NS_IMETHODIMP
 GfxInfo::GetD2DEnabled(bool *aEnabled)
 {
   return NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
-GfxInfo::GetAzureEnabled(bool *aEnabled)
-{
-  bool azure = false;
-  nsresult rv = mozilla::Preferences::GetBool("gfx.canvas.azure.enabled", &azure);
-  
-  if (NS_SUCCEEDED(rv) && azure) {
-    *aEnabled = true;
-  } else {
-    *aEnabled = false;
-  }
-  return NS_OK;
-}
-
-NS_IMETHODIMP
 GfxInfo::GetDWriteEnabled(bool *aEnabled)
 {
   return NS_ERROR_FAILURE;
 }
 
 /* readonly attribute DOMString DWriteVersion; */
 NS_IMETHODIMP
 GfxInfo::GetDWriteVersion(nsAString & aDwriteVersion)
--- a/widget/windows/GfxInfo.cpp
+++ b/widget/windows/GfxInfo.cpp
@@ -54,36 +54,16 @@ GfxInfo::GetD2DEnabled(bool *aEnabled)
 
 nsresult
 GfxInfo::GetDWriteEnabled(bool *aEnabled)
 {
   *aEnabled = gfxWindowsPlatform::GetPlatform()->DWriteEnabled();
   return NS_OK;
 }
 
-nsresult
-GfxInfo::GetAzureEnabled(bool *aEnabled)
-{
-  *aEnabled = false;
-
-  bool d2dEnabled = 
-    gfxWindowsPlatform::GetPlatform()->GetRenderMode() == gfxWindowsPlatform::RENDER_DIRECT2D;
-
-  if (d2dEnabled) {
-    bool azure = false;
-    nsresult rv = mozilla::Preferences::GetBool("gfx.canvas.azure.enabled", &azure);
-
-    if (NS_SUCCEEDED(rv) && azure) {
-      *aEnabled = true;
-    }
-  }
-
-  return NS_OK;
-}
-
 /* readonly attribute DOMString DWriteVersion; */
 NS_IMETHODIMP
 GfxInfo::GetDWriteVersion(nsAString & aDwriteVersion)
 {
   gfxWindowsPlatform::GetDLLVersion(L"dwrite.dll", aDwriteVersion);
   return NS_OK;
 }
 
--- a/widget/windows/GfxInfo.h
+++ b/widget/windows/GfxInfo.h
@@ -17,17 +17,16 @@ class GfxInfo : public GfxInfoBase
 {
 public:
   GfxInfo();
 
   // We only declare the subset of nsIGfxInfo that we actually implement. The
   // rest is brought forward from GfxInfoBase.
   NS_IMETHOD GetD2DEnabled(bool *aD2DEnabled);
   NS_IMETHOD GetDWriteEnabled(bool *aDWriteEnabled);
-  NS_IMETHOD GetAzureEnabled(bool *aAzureEnabled);
   NS_IMETHOD GetDWriteVersion(nsAString & aDwriteVersion);
   NS_IMETHOD GetCleartypeParameters(nsAString & aCleartypeParams);
   NS_IMETHOD GetAdapterDescription(nsAString & aAdapterDescription);
   NS_IMETHOD GetAdapterDriver(nsAString & aAdapterDriver);
   NS_IMETHOD GetAdapterVendorID(nsAString & aAdapterVendorID);
   NS_IMETHOD GetAdapterDeviceID(nsAString & aAdapterDeviceID);
   NS_IMETHOD GetAdapterRAM(nsAString & aAdapterRAM);
   NS_IMETHOD GetAdapterDriverVersion(nsAString & aAdapterDriverVersion);
@@ -38,16 +37,17 @@ public:
   NS_IMETHOD GetAdapterDeviceID2(nsAString & aAdapterDeviceID);
   NS_IMETHOD GetAdapterRAM2(nsAString & aAdapterRAM);
   NS_IMETHOD GetAdapterDriverVersion2(nsAString & aAdapterDriverVersion);
   NS_IMETHOD GetAdapterDriverDate2(nsAString & aAdapterDriverDate);
   NS_IMETHOD GetIsGPU2Active(bool *aIsGPU2Active);
   using GfxInfoBase::GetFeatureStatus;
   using GfxInfoBase::GetFeatureSuggestedDriverVersion;
   using GfxInfoBase::GetWebGLParameter;
+  using GfxInfoBase::GetAzureEnabled;
 
   virtual nsresult Init();
 
 #ifdef DEBUG
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSIGFXINFODEBUG
 #endif
 
--- a/widget/xpwidgets/GfxInfoBase.cpp
+++ b/widget/xpwidgets/GfxInfoBase.cpp
@@ -719,16 +719,32 @@ GfxInfoBase::GetFeatureSuggestedDriverVe
 
 NS_IMETHODIMP
 GfxInfoBase::GetWebGLParameter(const nsAString& aParam,
                                nsAString& aResult)
 {
   return GfxInfoWebGL::GetWebGLParameter(aParam, aResult);
 }
 
+nsresult
+GfxInfoBase::GetAzureEnabled(bool *aEnabled)
+{
+  static bool azure = false;
+  static bool azureInited = false;
+
+  if (!azureInited) {
+    azure = mozilla::Preferences::GetBool("gfx.canvas.azure.enabled", false);
+    azureInited = true;
+  }
+
+  *aEnabled = azure;
+
+  return NS_OK;
+}
+
 void
 GfxInfoBase::EvaluateDownloadedBlacklist(nsTArray<GfxDriverInfo>& aDriverInfo)
 {
   PRInt32 features[] = {
     nsIGfxInfo::FEATURE_DIRECT2D,
     nsIGfxInfo::FEATURE_DIRECT3D_9_LAYERS,
     nsIGfxInfo::FEATURE_DIRECT3D_10_LAYERS,
     nsIGfxInfo::FEATURE_DIRECT3D_10_1_LAYERS,
--- a/widget/xpwidgets/GfxInfoBase.h
+++ b/widget/xpwidgets/GfxInfoBase.h
@@ -36,20 +36,22 @@ public:
   NS_DECL_NSIOBSERVER
 
   // We only declare a subset of the nsIGfxInfo interface. It's up to derived
   // classes to implement the rest of the interface.  
   // Derived classes need to use
   // using GfxInfoBase::GetFeatureStatus;
   // using GfxInfoBase::GetFeatureSuggestedDriverVersion;
   // using GfxInfoBase::GetWebGLParameter;
+  // using GfxInfoBase::GetAzureEnabled;
   // to import the relevant methods into their namespace.
   NS_IMETHOD GetFeatureStatus(PRInt32 aFeature, PRInt32 *_retval);
   NS_IMETHOD GetFeatureSuggestedDriverVersion(PRInt32 aFeature, nsAString & _retval);
   NS_IMETHOD GetWebGLParameter(const nsAString & aParam, nsAString & _retval);
+  NS_IMETHOD GetAzureEnabled(bool *aAzureEnabled);
 
   NS_IMETHOD GetFailures(PRUint32 *failureCount, char ***failures);
   NS_IMETHOD_(void) LogFailure(const nsACString &failure);
   NS_IMETHOD GetInfo(JSContext*, jsval*);
 
   // Initialization function. If you override this, you must call this class's
   // version of Init first.
   // We need Init to be called separately from the constructor so we can
--- a/widget/xpwidgets/GfxInfoX11.cpp
+++ b/widget/xpwidgets/GfxInfoX11.cpp
@@ -365,22 +365,16 @@ GfxInfo::GetD2DEnabled(bool *aEnabled)
 }
 
 NS_IMETHODIMP
 GfxInfo::GetDWriteEnabled(bool *aEnabled)
 {
   return NS_ERROR_FAILURE;
 }
 
-NS_IMETHODIMP
-GfxInfo::GetAzureEnabled(bool *aEnabled)
-{
-  return NS_ERROR_FAILURE;
-}
-
 /* readonly attribute DOMString DWriteVersion; */
 NS_IMETHODIMP
 GfxInfo::GetDWriteVersion(nsAString & aDwriteVersion)
 {
   return NS_ERROR_FAILURE;
 }
 
 /* readonly attribute DOMString cleartypeParameters; */
--- a/widget/xpwidgets/GfxInfoX11.h
+++ b/widget/xpwidgets/GfxInfoX11.h
@@ -16,17 +16,16 @@ namespace widget {
 class GfxInfo : public GfxInfoBase
 {
 public:
 
   // We only declare the subset of nsIGfxInfo that we actually implement. The
   // rest is brought forward from GfxInfoBase.
   NS_IMETHOD GetD2DEnabled(bool *aD2DEnabled);
   NS_IMETHOD GetDWriteEnabled(bool *aDWriteEnabled);
-  NS_IMETHOD GetAzureEnabled(bool *aAzureEnabled);
   NS_IMETHOD GetDWriteVersion(nsAString & aDwriteVersion);
   NS_IMETHOD GetCleartypeParameters(nsAString & aCleartypeParams);
   NS_IMETHOD GetAdapterDescription(nsAString & aAdapterDescription);
   NS_IMETHOD GetAdapterDriver(nsAString & aAdapterDriver);
   NS_IMETHOD GetAdapterVendorID(nsAString & aAdapterVendorID);
   NS_IMETHOD GetAdapterDeviceID(nsAString & aAdapterDeviceID);
   NS_IMETHOD GetAdapterRAM(nsAString & aAdapterRAM);
   NS_IMETHOD GetAdapterDriverVersion(nsAString & aAdapterDriverVersion);
@@ -37,16 +36,17 @@ public:
   NS_IMETHOD GetAdapterDeviceID2(nsAString & aAdapterDeviceID);
   NS_IMETHOD GetAdapterRAM2(nsAString & aAdapterRAM);
   NS_IMETHOD GetAdapterDriverVersion2(nsAString & aAdapterDriverVersion);
   NS_IMETHOD GetAdapterDriverDate2(nsAString & aAdapterDriverDate);
   NS_IMETHOD GetIsGPU2Active(bool *aIsGPU2Active);
   using GfxInfoBase::GetFeatureStatus;
   using GfxInfoBase::GetFeatureSuggestedDriverVersion;
   using GfxInfoBase::GetWebGLParameter;
+  using GfxInfoBase::GetAzureEnabled;
 
   virtual nsresult Init();
   
   NS_IMETHOD_(void) GetData();
 
 #ifdef DEBUG
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSIGFXINFODEBUG