Bug 1318468 - Update VR controller inputs on every VR Vsync rather than every 2D vsync r=daoshengmu
authorKearwood Gilbert <kgilbert@mozilla.com>
Wed, 30 Nov 2016 14:24:29 -0800
changeset 324877 766c351e817226d1f8bbd00565ad4d54955d25b8
parent 324876 76b7a868d3a1879b58e44ac6e40856fe497d19f6
child 324878 f4508c74eafe57b28539780665bb09b3b7ca1d8d
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewersdaoshengmu
bugs1318468
milestone53.0a1
Bug 1318468 - Update VR controller inputs on every VR Vsync rather than every 2D vsync r=daoshengmu MozReview-Commit-ID: ICuIw4e56VC
gfx/vr/VRManager.cpp
--- a/gfx/vr/VRManager.cpp
+++ b/gfx/vr/VRManager.cpp
@@ -176,19 +176,16 @@ VRManager::NotifyVsync(const TimeStamp& 
   }
 
   for (auto iter = mVRDisplays.Iter(); !iter.Done(); iter.Next()) {
     gfx::VRDisplayHost* display = iter.UserData();
     display->NotifyVSync();
   }
 
   if (bHaveEventListener) {
-    for (uint32_t i = 0; i < mControllerManagers.Length(); ++i) {
-      mControllerManagers[i]->HandleInput();
-    }
     // If content has set an EventHandler to be notified of VR display events
     // we must continually refresh the VR display enumeration to check
     // for events that we must fire such as Window.onvrdisplayconnect
     // Note that enumeration itself may activate display hardware, such
     // as Oculus, so we only do this when we know we are displaying content
     // that is looking for VR displays.
     if (mLastRefreshTime.IsNull()) {
       // This is the first vsync, must refresh VR displays
@@ -206,16 +203,19 @@ VRManager::NotifyVsync(const TimeStamp& 
       }
     }
   }
 }
 
 void
 VRManager::NotifyVRVsync(const uint32_t& aDisplayID)
 {
+  for (uint32_t i = 0; i < mControllerManagers.Length(); ++i) {
+    mControllerManagers[i]->HandleInput();
+  }
   for (auto iter = mVRManagerParents.Iter(); !iter.Done(); iter.Next()) {
     Unused << iter.Get()->GetKey()->SendNotifyVRVSync(aDisplayID);
   }
 }
 
 void
 VRManager::RefreshVRDisplays(bool aMustDispatch)
 {