Bug 1128690 - Ensure Talos Performance Tests still work with silk enabled. r=mstange

This commit is contained in:
Mason Chang 2015-03-03 08:14:22 -08:00
parent ce76729963
commit a9182f7264
4 changed files with 44 additions and 2 deletions

View File

@ -403,6 +403,24 @@ MessageLoop* CompositorParent::CompositorLoop()
return CompositorThread() ? CompositorThread()->message_loop() : nullptr;
}
static bool
IsInCompositorAsapMode()
{
// Returns true if the compositor is allowed to be in ASAP mode
// and layout is not in ASAP mode
return gfxPrefs::LayersCompositionFrameRate() == 0 &&
!gfxPlatform::IsInLayoutAsapMode();
}
static bool
UseVsyncComposition()
{
return gfxPrefs::VsyncAlignedCompositor()
&& gfxPrefs::HardwareVsyncEnabled()
&& !IsInCompositorAsapMode()
&& !gfxPlatform::IsInLayoutAsapMode();
}
CompositorParent::CompositorParent(nsIWidget* aWidget,
bool aUseExternalSurfaceSize,
int aSurfaceWidth, int aSurfaceHeight)
@ -445,7 +463,8 @@ CompositorParent::CompositorParent(nsIWidget* aWidget,
mApzcTreeManager = new APZCTreeManager();
}
if (gfxPrefs::VsyncAlignedCompositor() && gfxPrefs::HardwareVsyncEnabled()) {
if (UseVsyncComposition()) {
NS_WARNING("Enabling vsync compositor\n");
mCompositorVsyncObserver = new CompositorVsyncObserver(this, aWidget);
}

View File

@ -2303,3 +2303,15 @@ gfxPlatform::CreateHardwareVsyncSource()
nsRefPtr<mozilla::gfx::VsyncSource> softwareVsync = new SoftwareVsyncSource();
return softwareVsync.forget();
}
/* static */ bool
gfxPlatform::IsInLayoutAsapMode()
{
// There are 2 modes of ASAP mode.
// 1 is that the refresh driver and compositor are in lock step
// the second is that the compositor goes ASAP and the refresh driver
// goes at whatever the configurated rate is. This only checks the version
// talos uses, which is the refresh driver and compositor are in lockstep.
return Preferences::GetInt("layout.frame_rate", -1) == 0;
}

View File

@ -608,6 +608,13 @@ public:
return mVsyncSource;
}
/**
* True if layout rendering should use ASAP mode, which means
* the refresh driver and compositor should render ASAP.
* Used for talos testing purposes
*/
static bool IsInLayoutAsapMode();
protected:
gfxPlatform();
virtual ~gfxPlatform();

View File

@ -849,10 +849,14 @@ CreateVsyncRefreshTimer()
// ready.
gfxPrefs::GetSingleton();
if (!gfxPrefs::VsyncAlignedRefreshDriver() || !gfxPrefs::HardwareVsyncEnabled()) {
if (!gfxPrefs::VsyncAlignedRefreshDriver()
|| !gfxPrefs::HardwareVsyncEnabled()
|| gfxPlatform::IsInLayoutAsapMode()) {
return;
}
NS_WARNING("Enabling vsync refresh driver\n");
if (XRE_IsParentProcess()) {
// Make sure all vsync systems are ready.
gfxPlatform::GetPlatform();