Bug 756601 - Enable OMTC by default on OSX 10.7 and 10.8. r=roc

This commit is contained in:
Matt Woodrow 2013-06-21 09:32:04 +12:00
parent 01d48b90ce
commit d6069876ed
7 changed files with 56 additions and 17 deletions

View File

@ -300,23 +300,6 @@ gfxPlatform::Init()
sCmapDataLog = PR_NewLogModule("cmapdata");;
#endif
bool useOffMainThreadCompositing = false;
useOffMainThreadCompositing = GetPrefLayersOffMainThreadCompositionEnabled() ||
Preferences::GetBool("browser.tabs.remote", false);
#ifdef MOZ_X11
useOffMainThreadCompositing &= (PR_GetEnv("MOZ_USE_OMTC") != NULL) ||
(PR_GetEnv("MOZ_OMTC_ENABLED") != NULL);
#endif
if (useOffMainThreadCompositing && (XRE_GetProcessType() ==
GeckoProcessType_Default)) {
CompositorParent::StartUp();
if (Preferences::GetBool("layers.async-video.enabled",false)) {
ImageBridgeChild::StartUp();
}
}
/* Initialize the GfxInfo service.
* Note: we can't call functions on GfxInfo that depend
* on gPlatform until after it has been initialized
@ -348,6 +331,19 @@ gfxPlatform::Init()
mozilla::gl::GLContext::StaticInit();
#endif
bool useOffMainThreadCompositing = GetPrefLayersOffMainThreadCompositionEnabled() ||
Preferences::GetBool("browser.tabs.remote", false);
useOffMainThreadCompositing &= GetPlatform()->SupportsOffMainThreadCompositing();
if (useOffMainThreadCompositing && (XRE_GetProcessType() ==
GeckoProcessType_Default)) {
CompositorParent::StartUp();
if (Preferences::GetBool("layers.async-video.enabled",false)) {
ImageBridgeChild::StartUp();
}
}
nsresult rv;
#if defined(XP_MACOSX) || defined(XP_WIN) || defined(ANDROID) // temporary, until this is implemented on others
@ -1815,6 +1811,7 @@ gfxPlatform::GetOrientationSyncMillis() const
*/
static bool sPrefLayersOffMainThreadCompositionEnabled = false;
static bool sPrefLayersOffMainThreadCompositionTestingEnabled = false;
static bool sPrefLayersOffMainThreadCompositionForceEnabled = false;
static bool sPrefLayersAccelerationForceEnabled = false;
static bool sPrefLayersAccelerationDisabled = false;
static bool sPrefLayersPreferOpenGL = false;
@ -1827,6 +1824,7 @@ void InitLayersAccelerationPrefs()
{
sPrefLayersOffMainThreadCompositionEnabled = Preferences::GetBool("layers.offmainthreadcomposition.enabled", false);
sPrefLayersOffMainThreadCompositionTestingEnabled = Preferences::GetBool("layers.offmainthreadcomposition.testing.enabled", false);
sPrefLayersOffMainThreadCompositionForceEnabled = Preferences::GetBool("layers.offmainthreadcomposition.force-enabled", false);
sPrefLayersAccelerationForceEnabled = Preferences::GetBool("layers.acceleration.force-enabled", false) ||
Preferences::GetBool("browser.tabs.remote", false);
sPrefLayersAccelerationDisabled = Preferences::GetBool("layers.acceleration.disabled", false);
@ -1841,9 +1839,16 @@ bool gfxPlatform::GetPrefLayersOffMainThreadCompositionEnabled()
{
InitLayersAccelerationPrefs();
return sPrefLayersOffMainThreadCompositionEnabled ||
sPrefLayersOffMainThreadCompositionForceEnabled ||
sPrefLayersOffMainThreadCompositionTestingEnabled;
}
bool gfxPlatform::GetPrefLayersOffMainThreadCompositionForceEnabled()
{
InitLayersAccelerationPrefs();
return sPrefLayersOffMainThreadCompositionForceEnabled;
}
bool gfxPlatform::GetPrefLayersAccelerationForceEnabled()
{
InitLayersAccelerationPrefs();

View File

@ -462,6 +462,7 @@ public:
* only once, and remain the same until restart.
*/
static bool GetPrefLayersOffMainThreadCompositionEnabled();
static bool GetPrefLayersOffMainThreadCompositionForceEnabled();
static bool GetPrefLayersAccelerationForceEnabled();
static bool GetPrefLayersAccelerationDisabled();
static bool GetPrefLayersPreferOpenGL();
@ -629,6 +630,8 @@ private:
virtual qcms_profile* GetPlatformCMSOutputProfile();
virtual bool SupportsOffMainThreadCompositing() { return true; }
nsRefPtr<gfxASurface> mScreenReferenceSurface;
nsTArray<uint32_t> mCJKPrefLangs;
nsCOMPtr<nsIObserver> mSRGBOverrideObserver;

View File

@ -9,6 +9,7 @@
#endif
#include "gfxPlatformGtk.h"
#include "prenv.h"
#include "nsUnicharUtils.h"
#include "nsUnicodeProperties.h"
@ -498,6 +499,17 @@ gfxPlatformGtk::GetScreenDepth() const
return sDepth;
}
bool
gfxPlatformGtk::SupportsOffMainThreadCompositing()
{
#ifdef MOZ_X11
return (PR_GetEnv("MOZ_USE_OMTC") != nullptr) ||
(PR_GetEnv("MOZ_OMTC_ENABLED") != nullptr);
#else
return true;
#endif
}
qcms_profile *
gfxPlatformGtk::GetPlatformCMSOutputProfile()
{

View File

@ -130,6 +130,8 @@ protected:
private:
virtual qcms_profile *GetPlatformCMSOutputProfile();
virtual bool SupportsOffMainThreadCompositing();
#ifdef MOZ_X11
static bool sUseXRender;
#endif

View File

@ -431,6 +431,17 @@ gfxPlatformMac::UseAcceleratedCanvas()
return OSXVersion() >= 0x1070 && Preferences::GetBool("gfx.canvas.azure.accelerated", false);
}
bool
gfxPlatformMac::SupportsOffMainThreadCompositing()
{
// 10.6.X has crashes on tinderbox with OMTC, so disable it
// for now.
if (OSXVersion() >= 0x1070) {
return true;
}
return GetPrefLayersOffMainThreadCompositionForceEnabled();
}
qcms_profile *
gfxPlatformMac::GetPlatformCMSOutputProfile()
{

View File

@ -89,6 +89,8 @@ public:
private:
virtual qcms_profile* GetPlatformCMSOutputProfile();
virtual bool SupportsOffMainThreadCompositing();
// read in the pref value for the lower threshold on font anti-aliasing
static uint32_t ReadAntiAliasingThreshold();

View File

@ -4015,7 +4015,11 @@ pref("layers.acceleration.draw-fps", false);
pref("layers.draw-borders", false);
#ifdef XP_MACOSX
pref("layers.offmainthreadcomposition.enabled", true);
#else
pref("layers.offmainthreadcomposition.enabled", false);
#endif
// same effect as layers.offmainthreadcomposition.enabled, but specifically for
// use with tests.
pref("layers.offmainthreadcomposition.testing.enabled", false);