Backed out changeset 21222476d9d9 (bug 1249640)
authorSebastian Hengst <archaeopteryx@coole-files.de>
Wed, 24 Feb 2016 19:01:29 +0100
changeset 285346 bf721b828cce2ee13b55c7cf5654651848ca67f7
parent 285345 0db0d77b32a976e085f019168dbc881e30a15b9e
child 285347 0c971e22e81cc388eb28cbcb4359ef53ca4cdc0a
push id72333
push userarchaeopteryx@coole-files.de
push dateWed, 24 Feb 2016 18:02:27 +0000
treeherdermozilla-inbound@80baf2babce0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1249640
milestone47.0a1
backs out21222476d9d9336ffdb22b362ea1e896f05f7a14
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
Backed out changeset 21222476d9d9 (bug 1249640)
gfx/thebes/gfxAndroidPlatform.cpp
gfx/thebes/gfxAndroidPlatform.h
widget/android/GfxInfo.cpp
widget/android/GfxInfo.h
--- a/gfx/thebes/gfxAndroidPlatform.cpp
+++ b/gfx/thebes/gfxAndroidPlatform.cpp
@@ -409,16 +409,33 @@ gfxAndroidPlatform::RequiresLinearZoom()
     return XRE_IsContentProcess() &&
            ContentChild::GetSingleton()->IsForBrowser();
 #endif
 
     NS_NOTREACHED("oops, what platform is this?");
     return gfxPlatform::RequiresLinearZoom();
 }
 
+bool
+gfxAndroidPlatform::UseAcceleratedSkiaCanvas()
+{
+    return HaveChoiceOfHWAndSWCanvas() && gfxPlatform::UseAcceleratedSkiaCanvas();
+}
+
+bool gfxAndroidPlatform::HaveChoiceOfHWAndSWCanvas()
+{
+#ifdef MOZ_WIDGET_ANDROID
+    if (!AndroidBridge::Bridge() || AndroidBridge::Bridge()->GetAPIVersion() < 11) {
+        // It's slower than software due to not having a compositing fast path
+        return false;
+    }
+#endif
+    return gfxPlatform::HaveChoiceOfHWAndSWCanvas();
+}
+
 #ifdef MOZ_WIDGET_GONK
 class GonkVsyncSource final : public VsyncSource
 {
 public:
   GonkVsyncSource()
   {
   }
 
--- a/gfx/thebes/gfxAndroidPlatform.h
+++ b/gfx/thebes/gfxAndroidPlatform.h
@@ -80,16 +80,18 @@ public:
     virtual bool RequiresLinearZoom() override;
 
     FT_Library GetFTLibrary();
 
     virtual bool CanRenderContentToDataSurface() const override {
       return true;
     }
 
+    virtual bool HaveChoiceOfHWAndSWCanvas() override;
+    virtual bool UseAcceleratedSkiaCanvas() override;
     virtual already_AddRefed<mozilla::gfx::VsyncSource> CreateHardwareVsyncSource() override;
 
 #ifdef MOZ_WIDGET_GONK
     virtual bool IsInGonkEmulator() const { return mIsInGonkEmulator; }
 #endif
 
     virtual bool SupportsApzTouchInput() const override {
       return true;
--- a/widget/android/GfxInfo.cpp
+++ b/widget/android/GfxInfo.cpp
@@ -120,18 +120,16 @@ public:
 
 #ifdef DEBUG
 NS_IMPL_ISUPPORTS_INHERITED(GfxInfo, GfxInfoBase, nsIGfxInfoDebug)
 #endif
 
 GfxInfo::GfxInfo()
   : mInitialized(false)
   , mGLStrings(new GLStrings)
-  , mOSVersionInteger(0)
-  , mSDKVersion(0)
 {
 }
 
 GfxInfo::~GfxInfo()
 {
 }
 
 /* GetD2DEnabled and GetDwriteEnabled shouldn't be called until after gfxPlatform initialization
@@ -178,24 +176,23 @@ GfxInfo::EnsureInitialized()
   if (mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "PRODUCT", mProduct)) {
     mAdapterDescription.AppendPrintf(", Product: %s", NS_LossyConvertUTF16toASCII(mProduct).get());
   }
 
   if (mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "MANUFACTURER", mManufacturer)) {
     mAdapterDescription.AppendPrintf(", Manufacturer: %s", NS_LossyConvertUTF16toASCII(mManufacturer).get());
   }
 
-  if (mozilla::AndroidBridge::Bridge()->GetStaticIntField("android/os/Build$VERSION", "SDK_INT", &mSDKVersion)) {
-    // the HARDWARE field isn't available on Android SDK < 8, but we require 9+ anyway.
-    MOZ_ASSERT(mSDKVersion >= 8);
-    if (mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "HARDWARE", mHardware)) {
-      mAdapterDescription.AppendPrintf(", Hardware: %s", NS_LossyConvertUTF16toASCII(mHardware).get());
-    }
-  } else {
-    mSDKVersion = 0;
+  int32_t sdkVersion;
+  if (!mozilla::AndroidBridge::Bridge()->GetStaticIntField("android/os/Build$VERSION", "SDK_INT", &sdkVersion))
+    sdkVersion = 0;
+
+  // the HARDWARE field isn't available on Android SDK < 8
+  if (sdkVersion >= 8 && mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "HARDWARE", mHardware)) {
+    mAdapterDescription.AppendPrintf(", Hardware: %s", NS_LossyConvertUTF16toASCII(mHardware).get());
   }
 
   nsString release;
   mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build$VERSION", "RELEASE", release);
   mOSVersion = NS_LossyConvertUTF16toASCII(release);
 
   mOSVersionInteger = 0;
   char a[5], b[5], c[5], d[5];
@@ -405,22 +402,16 @@ GfxInfo::GetFeatureStatusImpl(int32_t aF
 
   if (mGLStrings->Vendor().IsEmpty() || mGLStrings->Renderer().IsEmpty()) {
     *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
     return NS_OK;
   }
 
   // Don't evaluate special cases when evaluating the downloaded blocklist.
   if (aDriverInfo.IsEmpty()) {
-    if (aFeature == nsIGfxInfo::FEATURE_CANVAS2D_ACCELERATION) {
-      // It's slower than software due to not having a compositing fast path
-      *aStatus = (mSDKVersion >= 11) ? nsIGfxInfo::FEATURE_STATUS_OK : nsIGfxInfo::FEATURE_BLOCKED_OS_VERSION;
-      return NS_OK;
-    }
-
     if (aFeature == FEATURE_WEBGL_OPENGL) {
       if (mGLStrings->Renderer().Find("Adreno 200") != -1 ||
           mGLStrings->Renderer().Find("Adreno 205") != -1)
       {
         *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
         return NS_OK;
       }
 
--- a/widget/android/GfxInfo.h
+++ b/widget/android/GfxInfo.h
@@ -87,15 +87,14 @@ private:
 
   nsCString mAdapterDescription;
 
   OperatingSystem mOS;
 
   nsString mModel, mHardware, mManufacturer, mProduct;
   nsCString mOSVersion;
   uint32_t mOSVersionInteger;
-  int32_t mSDKVersion;
 };
 
 } // namespace widget
 } // namespace mozilla
 
 #endif /* __mozilla_widget_GfxInfo_h__ */