diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp index 6b08de89a6d2..c1aa60a3eae0 100644 --- a/toolkit/xre/nsAppRunner.cpp +++ b/toolkit/xre/nsAppRunner.cpp @@ -82,6 +82,7 @@ #include "nsIDocShell.h" #include "nsAppShellCID.h" #include "mozilla/scache/StartupCache.h" +#include "nsIGfxInfo.h" #include "mozilla/unused.h" @@ -149,6 +150,7 @@ #ifdef XP_MACOSX #include "nsILocalFileMac.h" #include "nsCommandLineServiceMac.h" +#include "nsCocoaFeatures.h" #endif // for X remote support @@ -4543,6 +4545,59 @@ mozilla::BrowserTabsRemoteAutostart() Preferences::GetBool("browser.tabs.remote.autostart.1", false); bool disabledForA11y = Preferences::GetBool("browser.tabs.remote.autostart.disabled-because-using-a11y", false); gBrowserTabsRemoteAutostart = !gSafeMode && !disabledForA11y && prefEnabled; + +#if defined(XP_WIN) || defined(XP_MACOSX) + // If for any reason we suspect acceleration will be disabled, disabled + // e10s auto start. (bug 1068199) THIS IS A TEMPORARY WORKAROUND. + if (gBrowserTabsRemoteAutostart) { + // Check prefs + bool accelDisabled = Preferences::GetBool("layers.acceleration.disabled", false) && + !Preferences::GetBool("layers.acceleration.force-enabled", false); + // Check env flags + if (!accelDisabled) { + const char *acceleratedEnv = PR_GetEnv("MOZ_ACCELERATED"); + if (acceleratedEnv && (*acceleratedEnv != '0')) { + accelDisabled = false; + } + } + +#if defined(XP_MACOSX) + accelDisabled = !nsCocoaFeatures::AccelerateByDefault(); +#endif + + // Check for blocked drivers + if (!accelDisabled) { + nsCOMPtr gfxInfo = do_GetService("@mozilla.org/gfx/info;1"); + if (gfxInfo) { + int32_t status; +#if defined(XP_WIN) + long flagsToCheck[4] = { + nsIGfxInfo::FEATURE_DIRECT3D_9_LAYERS, + nsIGfxInfo::FEATURE_DIRECT3D_10_LAYERS, + nsIGfxInfo::FEATURE_DIRECT3D_10_1_LAYERS, + nsIGfxInfo::FEATURE_DIRECT3D_11_LAYERS + }; +#elif defined(XP_MACOSX) + long flagsToCheck[1] = { + nsIGfxInfo::FEATURE_OPENGL_LAYERS + }; +#endif + for (unsigned int idx = 0; idx < ArrayLength(flagsToCheck); idx++) { + if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(flagsToCheck[idx], &status))) { + if (status != nsIGfxInfo::FEATURE_STATUS_OK) { + accelDisabled = true; + break; + } + } + } + } + } + if (accelDisabled) { + gBrowserTabsRemoteAutostart = false; + } + } +#endif + gBrowserTabsRemoteAutostartInitialized = true; mozilla::Telemetry::Accumulate(mozilla::Telemetry::E10S_AUTOSTART, gBrowserTabsRemoteAutostart); diff --git a/widget/cocoa/nsCocoaFeatures.h b/widget/cocoa/nsCocoaFeatures.h index 593d7ccf6bf4..24c2266e7107 100644 --- a/widget/cocoa/nsCocoaFeatures.h +++ b/widget/cocoa/nsCocoaFeatures.h @@ -19,6 +19,7 @@ public: static bool OnMavericksOrLater(); static bool OnYosemiteOrLater(); static bool SupportCoreAnimationPlugins(); + static bool AccelerateByDefault(); private: static void InitializeVersionNumbers(); diff --git a/widget/cocoa/nsCocoaFeatures.mm b/widget/cocoa/nsCocoaFeatures.mm index 9829cab1057b..1f41973dacdb 100644 --- a/widget/cocoa/nsCocoaFeatures.mm +++ b/widget/cocoa/nsCocoaFeatures.mm @@ -147,3 +147,12 @@ nsCocoaFeatures::OnYosemiteOrLater() { return (OSXVersion() >= MAC_OS_X_VERSION_10_10_HEX); } + +/* static */ bool +nsCocoaFeatures::AccelerateByDefault() +{ + return !(OSXVersionMajor() == 10 && + OSXVersionMinor() == 6 && + OSXVersionBugFix() <= 2); +} + diff --git a/widget/xpwidgets/nsBaseWidget.cpp b/widget/xpwidgets/nsBaseWidget.cpp index 86f595847df3..95927b5a72da 100644 --- a/widget/xpwidgets/nsBaseWidget.cpp +++ b/widget/xpwidgets/nsBaseWidget.cpp @@ -784,12 +784,7 @@ nsBaseWidget::ComputeShouldAccelerate(bool aDefault) // those versions of the OS. // This will still let full-screen video be accelerated on OpenGL, because // that XUL widget opts in to acceleration, but that's probably OK. - SInt32 major = nsCocoaFeatures::OSXVersionMajor(); - SInt32 minor = nsCocoaFeatures::OSXVersionMinor(); - SInt32 bugfix = nsCocoaFeatures::OSXVersionBugFix(); - if (major == 10 && minor == 6 && bugfix <= 2) { - accelerateByDefault = false; - } + accelerateByDefault = nsCocoaFeatures::AccelerateByDefault(); #endif // we should use AddBoolPrefVarCache