Bug 1592713 - Avoid to update VR HMD sensor states when pages are not in the presenting mode. r=kip
authorDaosheng Mu <daoshengmu@gmail.com>
Thu, 31 Oct 2019 22:10:43 +0000
changeset 500127 e0bc987cf0a062426f95ecdf8d6a264fa4508a29
parent 500126 ca10c746267a543aaa63567024c610d5b39e542d
child 500128 6fab67ec8c3236848965eec3776a3b628d019124
push id114164
push useraiakab@mozilla.com
push dateTue, 05 Nov 2019 10:06:15 +0000
treeherdermozilla-inbound@4d585c7edc76 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskip
bugs1592713
milestone72.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1592713 - Avoid to update VR HMD sensor states when pages are not in the presenting mode. r=kip Differential Revision: https://phabricator.services.mozilla.com/D51288
dom/vr/VRDisplay.cpp
--- a/dom/vr/VRDisplay.cpp
+++ b/dom/vr/VRDisplay.cpp
@@ -388,17 +388,20 @@ void VRDisplay::UpdateFrameInfo() {
    * mFrameInfo is marked dirty at the end of the frame or start of a new
    * composition and lazily created here in order to receive mid-frame
    * pose-prediction updates while still ensuring conformance to the WebVR spec
    * requirements.
    *
    * If we are not presenting WebVR content, the frame will never end and we
    * should return the latest frame data always.
    */
-  if (mFrameInfo.IsDirty() || !mPresentation) {
+  mFrameInfo.Clear();
+
+  if ( (mFrameInfo.IsDirty() && IsPresenting()) ||
+      mClient->GetDisplayInfo().GetPresentingGroups() == 0) {
     const gfx::VRHMDSensorState& state = mClient->GetSensorState();
     const gfx::VRDisplayInfo& info = mClient->GetDisplayInfo();
     mFrameInfo.Update(info, state, mDepthNear, mDepthFar);
   }
 }
 
 bool VRDisplay::GetFrameData(VRFrameData& aFrameData) {
   UpdateFrameInfo();