Bug 1345564 - Reduce sync IPC calls used by WebVR r=daoshengmu,Ehsan,kanru
authorKearwood Gilbert <kgilbert@mozilla.com>
Fri, 03 Mar 2017 16:21:18 -0800
changeset 395489 d8de58d33e08bda56ab1592082f498304a5cf0f6
parent 395488 55359c6c4724bdbc57a134f923f0de2bdd97fc4e
child 395490 7e5582c0d934215e7bdeca844a994e47de0c31ce
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdaoshengmu, Ehsan, kanru
bugs1345564
milestone55.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 1345564 - Reduce sync IPC calls used by WebVR r=daoshengmu,Ehsan,kanru - Eliminated the VRDisplay.GetImmediateSensorState sync call and associated code as it is no longer needed. MozReview-Commit-ID: 7BsCKC9EbsY
gfx/vr/VRDisplayClient.cpp
gfx/vr/VRDisplayClient.h
gfx/vr/VRDisplayHost.h
gfx/vr/gfxVROSVR.cpp
gfx/vr/gfxVROSVR.h
gfx/vr/gfxVROculus.cpp
gfx/vr/gfxVROculus.h
gfx/vr/gfxVROpenVR.cpp
gfx/vr/gfxVROpenVR.h
gfx/vr/gfxVRPuppet.cpp
gfx/vr/gfxVRPuppet.h
gfx/vr/ipc/PVRManager.ipdl
gfx/vr/ipc/VRManagerParent.cpp
gfx/vr/ipc/VRManagerParent.h
ipc/ipdl/sync-messages.ini
--- a/gfx/vr/VRDisplayClient.cpp
+++ b/gfx/vr/VRDisplayClient.cpp
@@ -71,26 +71,16 @@ VRHMDSensorState
 VRDisplayClient::GetSensorState()
 {
   VRHMDSensorState sensorState;
   VRManagerChild *vm = VRManagerChild::Get();
   Unused << vm->SendGetSensorState(mDisplayInfo.mDisplayID, &sensorState);
   return sensorState;
 }
 
-VRHMDSensorState
-VRDisplayClient::GetImmediateSensorState()
-{
-  VRHMDSensorState sensorState;
-
-  VRManagerChild *vm = VRManagerChild::Get();
-  Unused << vm->SendGetImmediateSensorState(mDisplayInfo.mDisplayID, &sensorState);
-  return sensorState;
-}
-
 const double kVRDisplayRAFMaxDuration = 32; // milliseconds
 
 void
 VRDisplayClient::NotifyVsync()
 {
   VRManagerChild *vm = VRManagerChild::Get();
 
   bool isPresenting = GetIsPresenting();
--- a/gfx/vr/VRDisplayClient.h
+++ b/gfx/vr/VRDisplayClient.h
@@ -24,17 +24,16 @@ public:
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(VRDisplayClient)
 
   explicit VRDisplayClient(const VRDisplayInfo& aDisplayInfo);
 
   void UpdateDisplayInfo(const VRDisplayInfo& aDisplayInfo);
 
   const VRDisplayInfo& GetDisplayInfo() const { return mDisplayInfo; }
   virtual VRHMDSensorState GetSensorState();
-  virtual VRHMDSensorState GetImmediateSensorState();
 
   virtual void ZeroSensor();
 
   already_AddRefed<VRDisplayPresentation> BeginPresentation(const nsTArray<dom::VRLayer>& aLayers);
   void PresentationDestroyed();
 
   void NotifyVsync();
   void NotifyVRVsync();
--- a/gfx/vr/VRDisplayHost.h
+++ b/gfx/vr/VRDisplayHost.h
@@ -33,17 +33,16 @@ public:
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(VRDisplayHost)
 
   const VRDisplayInfo& GetDisplayInfo() const { return mDisplayInfo; }
 
   void AddLayer(VRLayerParent* aLayer);
   void RemoveLayer(VRLayerParent* aLayer);
 
   virtual VRHMDSensorState GetSensorState() = 0;
-  virtual VRHMDSensorState GetImmediateSensorState() = 0;
   virtual void ZeroSensor() = 0;
   virtual void StartPresentation() = 0;
   virtual void StopPresentation() = 0;
   virtual void NotifyVSync() { };
 
   void SubmitFrame(VRLayerParent* aLayer,
                    const int32_t& aInputFrameID,
                    mozilla::layers::PTextureParent* aTexture,
--- a/gfx/vr/gfxVROSVR.cpp
+++ b/gfx/vr/gfxVROSVR.cpp
@@ -316,22 +316,16 @@ VRDisplayOSVR::GetSensorState()
     result.position[0] = position.data[0];
     result.position[1] = position.data[1];
     result.position[2] = position.data[2];
   }
 
   return result;
 }
 
-VRHMDSensorState
-VRDisplayOSVR::GetImmediateSensorState()
-{
-  return GetSensorState();
-}
-
 #if defined(XP_WIN)
 
 void
 VRDisplayOSVR::SubmitFrame(TextureSourceD3D11* aSource,
   const IntSize& aSize,
   const VRHMDSensorState& aSensorState,
   const gfx::Rect& aLeftEyeRect,
   const gfx::Rect& aRightEyeRect)
--- a/gfx/vr/gfxVROSVR.h
+++ b/gfx/vr/gfxVROSVR.h
@@ -21,17 +21,16 @@
 namespace mozilla {
 namespace gfx {
 namespace impl {
 
 class VRDisplayOSVR : public VRDisplayHost
 {
 public:
   VRHMDSensorState GetSensorState() override;
-  VRHMDSensorState GetImmediateSensorState() override;
   void ZeroSensor() override;
 
 protected:
   virtual void StartPresentation() override;
   virtual void StopPresentation() override;
 
 #if defined(XP_WIN)
   virtual void SubmitFrame(TextureSourceD3D11* aSource,
--- a/gfx/vr/gfxVROculus.cpp
+++ b/gfx/vr/gfxVROculus.cpp
@@ -429,22 +429,16 @@ VRDisplayOculus::GetSensorState()
   }
   result = GetSensorState(frameDelta);
   result.inputFrameID = mInputFrameID;
   mLastSensorState[result.inputFrameID % kMaxLatencyFrames] = result;
   return result;
 }
 
 VRHMDSensorState
-VRDisplayOculus::GetImmediateSensorState()
-{
-  return GetSensorState(0.0);
-}
-
-VRHMDSensorState
 VRDisplayOculus::GetSensorState(double timeOffset)
 {
   VRHMDSensorState result;
   result.Clear();
 
   ovrTrackingState state = ovr_GetTrackingState(mSession, timeOffset, true);
   ovrPoseStatef& pose(state.HeadPose);
 
--- a/gfx/vr/gfxVROculus.h
+++ b/gfx/vr/gfxVROculus.h
@@ -35,17 +35,16 @@ enum class OculusControllerAxisType : ui
   NumVRControllerAxisType
 };
 
 class VRDisplayOculus : public VRDisplayHost
 {
 public:
   virtual void NotifyVSync() override;
   virtual VRHMDSensorState GetSensorState() override;
-  virtual VRHMDSensorState GetImmediateSensorState() override;
   void ZeroSensor() override;
 
 protected:
   virtual void StartPresentation() override;
   virtual void StopPresentation() override;
   virtual void SubmitFrame(mozilla::layers::TextureSourceD3D11* aSource,
                            const IntSize& aSize,
                            const VRHMDSensorState& aSensorState,
--- a/gfx/vr/gfxVROpenVR.cpp
+++ b/gfx/vr/gfxVROpenVR.cpp
@@ -254,22 +254,16 @@ VRDisplayOpenVR::ZeroSensor()
 }
 
 VRHMDSensorState
 VRDisplayOpenVR::GetSensorState()
 {
   return GetSensorState(0.0f);
 }
 
-VRHMDSensorState
-VRDisplayOpenVR::GetImmediateSensorState()
-{
-  return GetSensorState(0.0f);
-}
-
 void
 VRDisplayOpenVR::PollEvents()
 {
   ::vr::VREvent_t event;
   while (mVRSystem->PollNextEvent(&event, sizeof(event))) {
     if (event.trackedDeviceIndex == ::vr::k_unTrackedDeviceIndex_Hmd) {
       switch (event.eventType) {
       case ::vr::VREvent_TrackedDeviceUserInteractionStarted:
--- a/gfx/vr/gfxVROpenVR.h
+++ b/gfx/vr/gfxVROpenVR.h
@@ -28,17 +28,16 @@ namespace mozilla {
 namespace gfx {
 namespace impl {
 
 class VRDisplayOpenVR : public VRDisplayHost
 {
 public:
   virtual void NotifyVSync() override;
   virtual VRHMDSensorState GetSensorState() override;
-  virtual VRHMDSensorState GetImmediateSensorState() override;
   void ZeroSensor() override;
 
 protected:
   virtual void StartPresentation() override;
   virtual void StopPresentation() override;
 #if defined(XP_WIN)
   virtual void SubmitFrame(mozilla::layers::TextureSourceD3D11* aSource,
                            const IntSize& aSize,
--- a/gfx/vr/gfxVRPuppet.cpp
+++ b/gfx/vr/gfxVRPuppet.cpp
@@ -135,22 +135,16 @@ VRDisplayPuppet::ZeroSensor()
 
 VRHMDSensorState
 VRDisplayPuppet::GetSensorState()
 {
   return GetSensorState(0.0f);
 }
 
 VRHMDSensorState
-VRDisplayPuppet::GetImmediateSensorState()
-{
-  return GetSensorState(0.0f);
-}
-
-VRHMDSensorState
 VRDisplayPuppet::GetSensorState(double timeOffset)
 {
   return mSensorState;
 }
 
 void
 VRDisplayPuppet::SetSensorState(const VRHMDSensorState& aSensorState)
 {
--- a/gfx/vr/gfxVRPuppet.h
+++ b/gfx/vr/gfxVRPuppet.h
@@ -16,17 +16,16 @@ namespace gfx {
 namespace impl {
 
 class VRDisplayPuppet : public VRDisplayHost
 {
 public:
   void SetDisplayInfo(const VRDisplayInfo& aDisplayInfo);
   virtual void NotifyVSync() override;
   virtual VRHMDSensorState GetSensorState() override;
-  virtual VRHMDSensorState GetImmediateSensorState() override;
   void SetSensorState(const VRHMDSensorState& aSensorState);
   void ZeroSensor() override;
 
 protected:
   virtual void StartPresentation() override;
   virtual void StopPresentation() override;
 #if defined(XP_WIN)
   virtual void SubmitFrame(mozilla::layers::TextureSourceD3D11* aSource,
--- a/gfx/vr/ipc/PVRManager.ipdl
+++ b/gfx/vr/ipc/PVRManager.ipdl
@@ -49,17 +49,16 @@ parent:
   // enumerated by RefreshDisplays() but does not enumerate new ones.
   sync GetDisplays() returns(VRDisplayInfo[] aDisplayInfo);
 
   // Reset the sensor of the display identified by aDisplayID so that the current
   // sensor state is the "Zero" position.
   async ResetSensor(uint32_t aDisplayID);
 
   sync GetSensorState(uint32_t aDisplayID) returns(VRHMDSensorState aState);
-  sync GetImmediateSensorState(uint32_t aDisplayID) returns(VRHMDSensorState aState);
   sync SetHaveEventListener(bool aHaveEventListener);
 
   async ControllerListenerAdded();
   async ControllerListenerRemoved();
   async CreateVRTestSystem();
   async CreateVRServiceTestDisplay(nsCString aID, uint32_t aPromiseID);
   async CreateVRServiceTestController(nsCString aID, uint32_t aPromiseID);
   async SetDisplayInfoToMockDisplay(uint32_t aDeviceID, VRDisplayInfo aDisplayInfo);
--- a/gfx/vr/ipc/VRManagerParent.cpp
+++ b/gfx/vr/ipc/VRManagerParent.cpp
@@ -267,27 +267,16 @@ VRManagerParent::RecvGetSensorState(cons
   VRManager* vm = VRManager::Get();
   RefPtr<gfx::VRDisplayHost> display = vm->GetDisplay(aDisplayID);
   if (display != nullptr) {
     *aState = display->GetSensorState();
   }
   return IPC_OK();
 }
 
-mozilla::ipc::IPCResult
-VRManagerParent::RecvGetImmediateSensorState(const uint32_t& aDisplayID, VRHMDSensorState* aState)
-{
-  VRManager* vm = VRManager::Get();
-  RefPtr<gfx::VRDisplayHost> display = vm->GetDisplay(aDisplayID);
-  if (display != nullptr) {
-    *aState = display->GetImmediateSensorState();
-  }
-  return IPC_OK();
-}
-
 bool
 VRManagerParent::HaveEventListener()
 {
   return mHaveEventListener;
 }
 
 bool
 VRManagerParent::HaveControllerListener()
--- a/gfx/vr/ipc/VRManagerParent.h
+++ b/gfx/vr/ipc/VRManagerParent.h
@@ -84,17 +84,16 @@ protected:
 
   virtual void ActorDestroy(ActorDestroyReason why) override;
   void OnChannelConnected(int32_t pid) override;
 
   virtual mozilla::ipc::IPCResult RecvRefreshDisplays() override;
   virtual mozilla::ipc::IPCResult RecvGetDisplays(nsTArray<VRDisplayInfo> *aDisplays) override;
   virtual mozilla::ipc::IPCResult RecvResetSensor(const uint32_t& aDisplayID) override;
   virtual mozilla::ipc::IPCResult RecvGetSensorState(const uint32_t& aDisplayID, VRHMDSensorState* aState) override;
-  virtual mozilla::ipc::IPCResult RecvGetImmediateSensorState(const uint32_t& aDisplayID, VRHMDSensorState* aState) override;
   virtual mozilla::ipc::IPCResult RecvSetHaveEventListener(const bool& aHaveEventListener) override;
   virtual mozilla::ipc::IPCResult RecvControllerListenerAdded() override;
   virtual mozilla::ipc::IPCResult RecvControllerListenerRemoved() override;
   virtual mozilla::ipc::IPCResult RecvCreateVRTestSystem() override;
   virtual mozilla::ipc::IPCResult RecvCreateVRServiceTestDisplay(const nsCString& aID, const uint32_t& aPromiseID) override;
   virtual mozilla::ipc::IPCResult RecvCreateVRServiceTestController(const nsCString& aID, const uint32_t& aPromiseID) override;
   virtual mozilla::ipc::IPCResult RecvSetDisplayInfoToMockDisplay(const uint32_t& aDeviceID,
                                                                   const VRDisplayInfo& aDisplayInfo) override;
--- a/ipc/ipdl/sync-messages.ini
+++ b/ipc/ipdl/sync-messages.ini
@@ -948,18 +948,16 @@ description =
 [PWebRenderBridge::DPSyncEnd]
 description =
 [PWebRenderBridge::DPGetSnapshot]
 description =
 [PVRManager::GetDisplays]
 description =
 [PVRManager::GetSensorState]
 description =
-[PVRManager::GetImmediateSensorState]
-description =
 [PVRManager::SetHaveEventListener]
 description =
 [PHal::GetCurrentBatteryInformation]
 description =
 [PHal::GetCurrentNetworkInformation]
 description =
 [PHal::GetScreenEnabled]
 description =