Bug 1068199 - Disable e10s when hardware acceleration is disabled on win, macos. r=Bas, jmuizelaar

This commit is contained in:
Jim Mathies 2014-09-17 16:48:07 -05:00
Родитель d504c7dcfb
Коммит 5cd6e4c98d
4 изменённых файлов: 66 добавлений и 6 удалений

Просмотреть файл

@ -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<nsIGfxInfo> 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);

Просмотреть файл

@ -19,6 +19,7 @@ public:
static bool OnMavericksOrLater();
static bool OnYosemiteOrLater();
static bool SupportCoreAnimationPlugins();
static bool AccelerateByDefault();
private:
static void InitializeVersionNumbers();

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -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