Bug 1071704 - HWC hooks registration should not depend on H/W Vsync. r=sotaro, a=bajaj
authorSushil Chauhan <sushilchauhan@codeaurora.org>
Tue, 23 Sep 2014 11:14:39 -0700
changeset 225126 61a3b1ea8af3474e4648199e507f52730000beb4
parent 225125 38791329385233206c92f963b5b228e455e8ce87
child 225127 c7a463892539ab08d0641e8a42844785303fe95a
push id3979
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 16:35:44 +0000
treeherdermozilla-beta@30f2cc610691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssotaro, bajaj
bugs1071704
milestone34.0a2
Bug 1071704 - HWC hooks registration should not depend on H/W Vsync. r=sotaro, a=bajaj
widget/gonk/HwcComposer2D.cpp
--- a/widget/gonk/HwcComposer2D.cpp
+++ b/widget/gonk/HwcComposer2D.cpp
@@ -191,32 +191,33 @@ HwcComposer2D::EnableVsync(bool aEnable)
     }
 #endif
 }
 
 #if ANDROID_VERSION >= 17
 bool
 HwcComposer2D::RegisterHwcEventCallback()
 {
-    if (!gfxPrefs::FrameUniformityHWVsyncEnabled()) {
-        return false;
-    }
-
     HwcDevice* device = (HwcDevice*)GetGonkDisplay()->GetHWCDevice();
     if (!device || !device->registerProcs) {
         LOGE("Failed to get hwc");
         return false;
     }
 
     // Disable Vsync first, and then register callback functions.
     device->eventControl(device, HWC_DISPLAY_PRIMARY, HWC_EVENT_VSYNC, false);
     device->registerProcs(device, &sHWCProcs);
+    mHasHWVsync = true;
 
-    mHasHWVsync = true;
-    return true;
+    if (!gfxPrefs::FrameUniformityHWVsyncEnabled()) {
+        device->eventControl(device, HWC_DISPLAY_PRIMARY, HWC_EVENT_VSYNC, false);
+        mHasHWVsync = false;
+    }
+
+    return mHasHWVsync;
 }
 
 void
 HwcComposer2D::RunVsyncEventControl(bool aEnable)
 {
     if (mHasHWVsync) {
         HwcDevice* device = (HwcDevice*)GetGonkDisplay()->GetHWCDevice();
         if (device && device->eventControl) {