From e2a5d6b1756c24a251b909fe1303ade9d83650c2 Mon Sep 17 00:00:00 2001 From: "dmu@mozilla.com" Date: Fri, 29 Sep 2017 06:53:27 +0000 Subject: [PATCH] Bug 1402749 - Part 2: Only allow updating VR controller amount at Vsync time; r=kip MozReview-Commit-ID: EwXpyGnTYTD --HG-- extra : rebase_source : b969991e31dcb612e81dd47129168a535427ce0a --- dom/vr/test/mochitest/mochitest.ini | 1 + dom/vr/test/reftest/reftest.list | 1 + gfx/vr/ipc/VRManagerParent.cpp | 7 ++++--- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/dom/vr/test/mochitest/mochitest.ini b/dom/vr/test/mochitest/mochitest.ini index ac7e710d136e..8a9379d5e144 100644 --- a/dom/vr/test/mochitest/mochitest.ini +++ b/dom/vr/test/mochitest/mochitest.ini @@ -1,3 +1,4 @@ +# Please confirm there is no other VR display connected. Otherwise, VRPuppetDisplay can't be attached. [DEFAULT] support-files = VRSimulationDriver.js diff --git a/dom/vr/test/reftest/reftest.list b/dom/vr/test/reftest/reftest.list index 9efc62f9469a..b8cdfe53a291 100644 --- a/dom/vr/test/reftest/reftest.list +++ b/dom/vr/test/reftest/reftest.list @@ -1,4 +1,5 @@ # WebVR Reftests +# Please confirm there is no other VR display connected. Otherwise, VRPuppetDisplay can't be attached. default-preferences pref(dom.vr.puppet.enabled,true) pref(dom.vr.test.enabled,true) pref(dom.vr.require-gesture,false) pref(dom.vr.puppet.submitframe,1) # VR SubmitFrame is only implemented for D3D11.1 and MacOSX now. diff --git a/gfx/vr/ipc/VRManagerParent.cpp b/gfx/vr/ipc/VRManagerParent.cpp index 5922cbbf3239..32a002956cd1 100644 --- a/gfx/vr/ipc/VRManagerParent.cpp +++ b/gfx/vr/ipc/VRManagerParent.cpp @@ -279,18 +279,19 @@ VRManagerParent::RecvSetHaveEventListener(const bool& aHaveEventListener) mozilla::ipc::IPCResult VRManagerParent::RecvControllerListenerAdded() { + // Force update the available controllers for GamepadManager, + // remove the existing controllers and sync them by NotifyVsync(). VRManager* vm = VRManager::Get(); + vm->RemoveControllers(); mHaveControllerListener = true; - // Ask the connected gamepads to be added to GamepadManager - vm->ScanForControllers(); return IPC_OK(); } mozilla::ipc::IPCResult VRManagerParent::RecvControllerListenerRemoved() { - VRManager* vm = VRManager::Get(); mHaveControllerListener = false; + VRManager* vm = VRManager::Get(); vm->RemoveControllers(); return IPC_OK(); }