Bug 1249640: Part 4 Android to use new blocking. r=snorp

This commit is contained in:
Milan Sreckovic 2016-02-22 14:23:00 +01:00
parent ea90851b27
commit 73bd7cde21
4 changed files with 17 additions and 26 deletions

View File

@ -414,23 +414,6 @@ gfxAndroidPlatform::RequiresLinearZoom()
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
{

View File

@ -85,8 +85,6 @@ public:
return true;
}
virtual bool HaveChoiceOfHWAndSWCanvas() override;
virtual bool UseAcceleratedSkiaCanvas() override;
virtual already_AddRefed<mozilla::gfx::VsyncSource> CreateHardwareVsyncSource() override;
#ifdef MOZ_WIDGET_GONK

View File

@ -125,6 +125,8 @@ NS_IMPL_ISUPPORTS_INHERITED(GfxInfo, GfxInfoBase, nsIGfxInfoDebug)
GfxInfo::GfxInfo()
: mInitialized(false)
, mGLStrings(new GLStrings)
, mOSVersionInteger(0)
, mSDKVersion(0)
{
}
@ -181,14 +183,15 @@ GfxInfo::EnsureInitialized()
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)) {
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);
@ -407,6 +410,12 @@ GfxInfo::GetFeatureStatusImpl(int32_t aFeature,
// 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)

View File

@ -92,6 +92,7 @@ private:
nsString mModel, mHardware, mManufacturer, mProduct;
nsCString mOSVersion;
uint32_t mOSVersionInteger;
int32_t mSDKVersion;
};
} // namespace widget