Bug 1249640: Part 4 Android to use new blocking. r=snorp
authorMilan Sreckovic <milan@mozilla.com>
Mon, 22 Feb 2016 14:23:00 +0100
changeset 322148 1e882a4bf894ecfec2c8ce56d8b4e2ae036d8c77
parent 322147 dd3df45a85da5ba1b06c85493343f38b18d773a5
child 322149 a085ea2d24bbff3026f0c54639f64787776a20b6
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp
bugs1249640
milestone47.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 1249640: Part 4 Android to use new blocking. r=snorp
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,33 +409,16 @@ 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,18 +80,16 @@ 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,16 +120,18 @@ 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
@@ -176,23 +178,24 @@ 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());
   }
 
-  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());
+  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;
   }
 
   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];
@@ -402,16 +405,22 @@ 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,14 +87,15 @@ 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__ */