Bug 1138735 - Fallback to software vsync if CVDisplayLink fails to initialize. r=mstange

This commit is contained in:
Mason Chang 2015-03-04 14:37:55 -08:00
parent 4f6edc655f
commit 3cccf0671a

View File

@ -549,6 +549,14 @@ already_AddRefed<mozilla::gfx::VsyncSource>
gfxPlatformMac::CreateHardwareVsyncSource()
{
nsRefPtr<VsyncSource> osxVsyncSource = new OSXVsyncSource();
VsyncSource::Display& primaryDisplay = osxVsyncSource->GetGlobalDisplay();
primaryDisplay.EnableVsync();
if (!primaryDisplay.IsVsyncEnabled()) {
NS_WARNING("OS X Vsync source not enabled. Falling back to software vsync.\n");
return gfxPlatform::CreateHardwareVsyncSource();
}
primaryDisplay.DisableVsync();
return osxVsyncSource.forget();
}