Backed out changeset e0034670b26a (bug 1514417) as requested by daoshengmu
authorCoroiu Cristina <ccoroiu@mozilla.com>
Sat, 26 Jan 2019 01:46:32 +0200
changeset 515528 6b9d943ecc2affe25094a0046dbc498ff2d1b96c
parent 515527 bb5d37aec5da39e6994de97e0c08b6d20050de43
child 515529 0f8a67bf322646794f0b47427f0b74b289f4a2a7
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1514417
milestone66.0a1
backs oute0034670b26aaea119876ed739167136b75e1ec9
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
Backed out changeset e0034670b26a (bug 1514417) as requested by daoshengmu
gfx/vr/gfxVRExternal.cpp
gfx/vr/gfxVRExternal.h
gfx/vr/service/VRService.cpp
gfx/vr/service/VRService.h
--- a/gfx/vr/gfxVRExternal.cpp
+++ b/gfx/vr/gfxVRExternal.cpp
@@ -421,18 +421,18 @@ bool VRDisplayExternal::PullState() {
                             mDisplayInfo.mControllerState);
 }
 #endif
 
 VRSystemManagerExternal::VRSystemManagerExternal(
     VRExternalShmem* aAPIShmem /* = nullptr*/)
     : mExternalShmem(aAPIShmem)
 #if !defined(MOZ_WIDGET_ANDROID)
-    , mMutex("VRSystemManagerExternal::mMutex")
-    , mSameProcess(aAPIShmem != nullptr)
+      ,
+      mSameProcess(aAPIShmem != nullptr)
 #endif
 {
 #if defined(XP_MACOSX)
   mShmemFD = 0;
 #elif defined(XP_WIN)
   mShmemFile = NULL;
 #elif defined(MOZ_WIDGET_ANDROID)
   mExternalStructFailed = false;
@@ -839,19 +839,15 @@ void VRSystemManagerExternal::PushState(
       memcpy((void*)&(mExternalShmem->browserState), aBrowserState,
              sizeof(VRBrowserState));
       if (aNotifyCond) {
         pthread_cond_signal((pthread_cond_t*)&(mExternalShmem->browserCond));
       }
       pthread_mutex_unlock((pthread_mutex_t*)&(mExternalShmem->browserMutex));
     }
 #else
-    // We need this MutexAutoLock to avoid mAPIShmem happens deadlock issue
-    // when both of VRService and VRSubmitFrame threads are writing/reading
-    // it from the memory.
-    MutexAutoLock lock(mMutex);
     mExternalShmem->browserGenerationA++;
     memcpy((void*)&(mExternalShmem->browserState), (void*)aBrowserState,
            sizeof(VRBrowserState));
     mExternalShmem->browserGenerationB++;
 #endif  // defined(MOZ_WIDGET_ANDROID)
   }
 }
--- a/gfx/vr/gfxVRExternal.h
+++ b/gfx/vr/gfxVRExternal.h
@@ -129,17 +129,16 @@ class VRSystemManagerExternal : public V
 
   bool mExternalStructFailed;
   bool mEnumerationCompleted;
 #endif
   bool mDoShutdown;
 
   volatile VRExternalShmem* mExternalShmem;
 #if !defined(MOZ_WIDGET_ANDROID)
-  Mutex mMutex;
   bool mSameProcess;
 #endif
   TimeStamp mEarliestRestartTime;
 
   void OpenShmem();
   void CloseShmem();
   void CheckForShutdown();
 };
--- a/gfx/vr/service/VRService.cpp
+++ b/gfx/vr/service/VRService.cpp
@@ -63,19 +63,16 @@ VRService::VRService()
       mBrowserState{},
       mBrowserGeneration(0),
       mServiceThread(nullptr),
       mShutdownRequested(false),
       mAPIShmem(nullptr),
       mTargetShmemFile(0),
       mLastHapticState{},
       mFrameStartTime{},
-#if !defined(MOZ_WIDGET_ANDROID)
-      mMutex("VRService::mMutex"),
-#endif
       mVRProcessEnabled(gfxPrefs::VRProcessEnabled()) {
   // When we have the VR process, we map the memory
   // of mAPIShmem from GPU process.
   // If we don't have the VR process, we will instantiate
   // mAPIShmem in VRService.
   if (!mVRProcessEnabled) {
     mAPIShmem = new VRExternalShmem();
     memset(mAPIShmem, 0, sizeof(VRExternalShmem));
@@ -454,20 +451,16 @@ void VRService::PullState(mozilla::gfx::
 
 #if defined(MOZ_WIDGET_ANDROID)
   if (pthread_mutex_lock((pthread_mutex_t*)&(mExternalShmem->browserMutex)) ==
       0) {
     memcpy(&aState, &tmp.browserState, sizeof(VRBrowserState));
     pthread_mutex_unlock((pthread_mutex_t*)&(mExternalShmem->browserMutex));
   }
 #else
-  // We need this MutexAutoLock to avoid mAPIShmem happens deadlock issue
-  // when both of VRService and VRSubmitFrame threads are writing/reading
-  // it from the memory.
-  MutexAutoLock lock(mMutex);
   VRExternalShmem tmp;
   if (mAPIShmem->browserGenerationA != mBrowserGeneration) {
     memcpy(&tmp, mAPIShmem, sizeof(VRExternalShmem));
     if (tmp.browserGenerationA == tmp.browserGenerationB &&
         tmp.browserGenerationA != 0 && tmp.browserGenerationA != -1) {
       memcpy(&aState, &tmp.browserState, sizeof(VRBrowserState));
       mBrowserGeneration = tmp.browserGenerationA;
     }
--- a/gfx/vr/service/VRService.h
+++ b/gfx/vr/service/VRService.h
@@ -58,19 +58,16 @@ class VRService {
   UniquePtr<VRSession> mSession;
   base::Thread* mServiceThread;
   bool mShutdownRequested;
 
   VRExternalShmem* MOZ_OWNING_REF mAPIShmem;
   base::ProcessHandle mTargetShmemFile;
   VRHapticState mLastHapticState[kVRHapticsMaxCount];
   TimeStamp mFrameStartTime[kVRFrameTimingHistoryDepth];
-#if !defined(MOZ_WIDGET_ANDROID)
-  Mutex mMutex;
-#endif
   // We store the value of gfxPrefs::VRProcessEnabled() in mVRProcessEnabled.
   // This allows us to read the value in the VRService destructor, after
   // gfxPrefs has been shut down.  We should investigate why gfxPrefs
   // is shutting down earlier - See bug xxx
   bool mVRProcessEnabled;
 
   bool IsInServiceThread();
   void UpdateHaptics();