diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp index 851827eb8ab9..1cfad9029224 100644 --- a/gfx/thebes/gfxPlatform.cpp +++ b/gfx/thebes/gfxPlatform.cpp @@ -362,17 +362,18 @@ gfxPlatform::Init() mozilla::gl::GLContext::StaticInit(); #endif - bool useOffMainThreadCompositing = GetPrefLayersOffMainThreadCompositionEnabled() || - Preferences::GetBool("browser.tabs.remote", false); - useOffMainThreadCompositing &= GetPlatform()->SupportsOffMainThreadCompositing(); + bool useOffMainThreadCompositing = OffMainThreadCompositionRequired() || + GetPrefLayersOffMainThreadCompositionEnabled(); - if (useOffMainThreadCompositing && (XRE_GetProcessType() == - GeckoProcessType_Default)) { + if (!OffMainThreadCompositionRequired()) { + useOffMainThreadCompositing &= GetPlatform()->SupportsOffMainThreadCompositing(); + } + + if (useOffMainThreadCompositing && (XRE_GetProcessType() == GeckoProcessType_Default)) { CompositorParent::StartUp(); - if (Preferences::GetBool("layers.async-video.enabled",false)) { + if (Preferences::GetBool("layers.async-video.enabled", false)) { ImageBridgeChild::StartUp(); } - } nsresult rv; @@ -1886,6 +1887,7 @@ static bool sLayersSupportsD3D9 = true; static int sPrefLayoutFrameRate = -1; static bool sBufferRotationEnabled = false; static bool sComponentAlphaEnabled = true; +static bool sPrefBrowserTabsRemote = false; static bool sLayersAccelerationPrefsInitialized = false; @@ -1904,6 +1906,7 @@ InitLayersAccelerationPrefs() sPrefLayoutFrameRate = Preferences::GetInt("layout.frame_rate", -1); sBufferRotationEnabled = Preferences::GetBool("layers.bufferrotation.enabled", true); sComponentAlphaEnabled = Preferences::GetBool("layers.componentalpha.enabled", true); + sPrefBrowserTabsRemote = Preferences::GetBool("browser.tabs.remote", false); nsCOMPtr gfxInfo = do_GetService("@mozilla.org/gfx/info;1"); if (gfxInfo) { @@ -1942,6 +1945,12 @@ gfxPlatform::GetPrefLayersAccelerationForceEnabled() return sPrefLayersAccelerationForceEnabled; } +bool gfxPlatform::OffMainThreadCompositionRequired() +{ + InitLayersAccelerationPrefs(); + return sPrefBrowserTabsRemote; +} + bool gfxPlatform::GetPrefLayersAccelerationDisabled() { diff --git a/gfx/thebes/gfxPlatform.h b/gfx/thebes/gfxPlatform.h index d76995cfda4e..8dd721150a4b 100644 --- a/gfx/thebes/gfxPlatform.h +++ b/gfx/thebes/gfxPlatform.h @@ -487,6 +487,8 @@ public: static bool CanUseDirect3D9(); static int GetPrefLayoutFrameRate(); + static bool OffMainThreadCompositionRequired(); + /** * Is it possible to use buffer rotation */ diff --git a/gfx/thebes/gfxPlatformGtk.cpp b/gfx/thebes/gfxPlatformGtk.cpp index 09da1f803c18..619a5ddcb6e5 100644 --- a/gfx/thebes/gfxPlatformGtk.cpp +++ b/gfx/thebes/gfxPlatformGtk.cpp @@ -502,7 +502,8 @@ gfxPlatformGtk::GetScreenDepth() const bool gfxPlatformGtk::SupportsOffMainThreadCompositing() { -#ifdef MOZ_X11 + // Nightly builds have OMTC support by default for Electrolysis testing. +#if defined(MOZ_X11) && !defined(NIGHTLY_BUILD) return (PR_GetEnv("MOZ_USE_OMTC") != nullptr) || (PR_GetEnv("MOZ_OMTC_ENABLED") != nullptr); #else diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp index 2e33c77e958c..5e50450bc692 100644 --- a/toolkit/xre/nsAppRunner.cpp +++ b/toolkit/xre/nsAppRunner.cpp @@ -3370,11 +3370,19 @@ XREMain::XRE_mainStartup(bool* aExitFlag) // (called inside gdk_display_open). This is a requirement for off main tread compositing. // This is done only on X11 platforms if the environment variable MOZ_USE_OMTC is set so // as to avoid overhead when omtc is not used. + // + // On nightly builds, we call this by default to enable OMTC for Electrolysis testing. On + // aurora, beta, and release builds, there is a small tpaint regression from enabling this + // call, so it sits behind an environment variable. + // // An environment variable is used instead of a pref on X11 platforms because we start having // access to prefs long after the first call to XOpenDisplay which is hard to change due to // interdependencies in the initialization. +# ifndef NIGHTLY_BUILD if (PR_GetEnv("MOZ_USE_OMTC") || - PR_GetEnv("MOZ_OMTC_ENABLED")) { + PR_GetEnv("MOZ_OMTC_ENABLED")) +# endif + { XInitThreads(); } #endif diff --git a/widget/cocoa/nsChildView.mm b/widget/cocoa/nsChildView.mm index c51d7abc36bb..124b1d18accd 100644 --- a/widget/cocoa/nsChildView.mm +++ b/widget/cocoa/nsChildView.mm @@ -1534,8 +1534,7 @@ nsChildView::ComputeShouldAccelerate(bool aDefault) bool nsChildView::ShouldUseOffMainThreadCompositing() { - // Don't use OMTC (which requires OpenGL) for transparent windows or for - // popup windows. + // Don't use OMTC for transparent windows or for popup windows. if (!mView || ![[mView window] isOpaque] || [[mView window] isKindOfClass:[PopupWindow class]]) return false;