Bug 1377950 - Stub in a function for resetting all compositors with GPUProcessManager. r=jrmuizel, a=gchang
authorRyan Hunt <rhunt@eqrion.net>
Fri, 11 Aug 2017 02:51:23 -0500
changeset 655604 b304b54bb8c6056bd76c2af1edc9aaa0bff03de1
parent 655603 c0e5a9ba27f69be8bc2ebedc9770a8415eccd2df
child 655605 f592e9f5e8d2a578a8e54e91514ec3e1124150a0
push id76942
push userbmo:scwwu@mozilla.com
push dateWed, 30 Aug 2017 08:27:15 +0000
reviewersjrmuizel, gchang
bugs1377950
milestone56.0
Bug 1377950 - Stub in a function for resetting all compositors with GPUProcessManager. r=jrmuizel, a=gchang MozReview-Commit-ID: HsKCGli3TOM
gfx/ipc/GPUProcessManager.cpp
gfx/ipc/GPUProcessManager.h
--- a/gfx/ipc/GPUProcessManager.cpp
+++ b/gfx/ipc/GPUProcessManager.cpp
@@ -402,16 +402,25 @@ ShouldLimitDeviceResets(uint32_t count, 
   } else if (hasCountLimit) {
     return triggeredCount;
   }
 
   return false;
 }
 
 void
+GPUProcessManager::ResetCompositors()
+{
+  // Note: this will recreate devices in addition to recreating compositors.
+  // This isn't optimal, but this is only used on linux where acceleration
+  // isn't enabled by default, and this way we don't need a new code path.
+  SimulateDeviceReset();
+}
+
+void
 GPUProcessManager::SimulateDeviceReset()
 {
   // Make sure we rebuild environment and configuration for accelerated features.
   gfxPlatform::GetPlatform()->CompositorUpdated();
 
   if (mProcess) {
     OnRemoteProcessDeviceReset(mProcess);
   } else {
--- a/gfx/ipc/GPUProcessManager.h
+++ b/gfx/ipc/GPUProcessManager.h
@@ -138,16 +138,19 @@ public:
   //
   // Note that a layer tree id is always allocated, even if this returns false.
   bool AllocateAndConnectLayerTreeId(
     PCompositorBridgeChild* aCompositorBridge,
     base::ProcessId aOtherPid,
     uint64_t* aOutLayersId,
     CompositorOptions* aOutCompositorOptions);
 
+  // Destroy and recreate all of the compositors
+  void ResetCompositors();
+
   void OnProcessLaunchComplete(GPUProcessHost* aHost) override;
   void OnProcessUnexpectedShutdown(GPUProcessHost* aHost) override;
   void SimulateDeviceReset();
   void OnInProcessDeviceReset();
   void OnRemoteProcessDeviceReset(GPUProcessHost* aHost) override;
   void NotifyListenersOnCompositeDeviceReset();
 
   // Notify the GPUProcessManager that a top-level PGPU protocol has been