Bug 1120753 - Fallback to software vsync if hardware vsync fails to initialize on b2g. r=kats,mwu

This commit is contained in:
Mason Chang 2015-01-15 07:56:12 -08:00
parent d8cde2ed0d
commit 5ee7bd3f46
3 changed files with 10 additions and 5 deletions

View File

@ -65,10 +65,9 @@ public:
void RemoveCompositorVsyncDispatcher(CompositorVsyncDispatcher* aCompositorVsyncDispatcher);
nsRefPtr<RefreshTimerVsyncDispatcher> GetRefreshTimerVsyncDispatcher();
protected:
virtual Display& GetGlobalDisplay() = 0; // Works across all displays
protected:
virtual ~VsyncSource() {}
};

View File

@ -437,7 +437,6 @@ public:
return mGlobalDisplay;
}
protected:
class GonkDisplay MOZ_FINAL : public VsyncSource::Display
{
public:
@ -486,6 +485,10 @@ gfxAndroidPlatform::CreateHardwareVsyncSource()
{
#ifdef MOZ_WIDGET_GONK
nsRefPtr<VsyncSource> vsyncSource = new GonkVsyncSource();
if (!vsyncSource->GetGlobalDisplay().IsVsyncEnabled()) {
NS_WARNING("Error enabling gonk vsync. Falling back to software vsync\n");
return gfxPlatform::CreateHardwareVsyncSource();
}
return vsyncSource.forget();
#else
NS_WARNING("Hardware vsync not supported on android yet");

View File

@ -116,6 +116,9 @@ HwcComposer2D::HwcComposer2D()
, mHasHWVsync(false)
, mLock("mozilla.HwcComposer2D.mLock")
{
#if ANDROID_VERSION >= 17
RegisterHwcEventCallback();
#endif
}
HwcComposer2D::~HwcComposer2D() {
@ -154,8 +157,6 @@ HwcComposer2D::Init(hwc_display_t dpy, hwc_surface_t sur, gl::GLContext* aGLCont
mColorFill = false;
mRBSwapSupport = false;
}
RegisterHwcEventCallback();
#else
char propValue[PROPERTY_VALUE_MAX];
property_get("ro.display.colorfill", propValue, "0");
@ -196,6 +197,8 @@ HwcComposer2D::EnableVsync(bool aEnable)
device->eventControl(device, HWC_DISPLAY_PRIMARY, HWC_EVENT_VSYNC, aEnable);
return aEnable;
#else
return false;
#endif
}