Cut down on compositor spam after a device reset. (bug 1363126 part 5, r=rhunt)
authorDavid Anderson <dvander@alliedmods.net>
Thu, 11 May 2017 22:44:28 -0700
changeset 358040 d376fc7d074a893dc07c95d1331ab5243cba1b5d
parent 358039 96669e08cf8f84ff6dcea0f40b243ab9f0642ccc
child 358041 c78b979c5c5965f97f66733caa77e1ae0510262f
push id31808
push usercbook@mozilla.com
push dateFri, 12 May 2017 12:37:49 +0000
treeherdermozilla-central@030c0a7c8781 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrhunt
bugs1363126
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
Cut down on compositor spam after a device reset. (bug 1363126 part 5, r=rhunt)
gfx/layers/d3d11/CompositorD3D11.cpp
gfx/layers/d3d11/DeviceAttachmentsD3D11.cpp
gfx/layers/d3d11/DeviceAttachmentsD3D11.h
--- a/gfx/layers/d3d11/CompositorD3D11.cpp
+++ b/gfx/layers/d3d11/CompositorD3D11.cpp
@@ -971,26 +971,29 @@ CompositorD3D11::BeginFrame(const nsIntR
     // We are not going to render, and not going to call EndFrame so we have to
     // read-unlock our textures to prevent them from accumulating.
     ReadUnlockTextures();
     *aRenderBoundsOut = IntRect();
     return;
   }
 
   if (mDevice->GetDeviceRemovedReason() != S_OK) {
-    gfxCriticalNote << "GFX: D3D11 skip BeginFrame with device-removed.";
     ReadUnlockTextures();
     *aRenderBoundsOut = IntRect();
 
-    // If we are in the GPU process then the main process doesn't
-    // know that a device reset has happened and needs to be informed
-    if (XRE_IsGPUProcess()) {
-      GPUParent::GetSingleton()->NotifyDeviceReset();
+    if (!mAttachments->IsDeviceReset()) {
+      gfxCriticalNote << "GFX: D3D11 skip BeginFrame with device-removed.";
+
+      // If we are in the GPU process then the main process doesn't
+      // know that a device reset has happened and needs to be informed
+      if (XRE_IsGPUProcess()) {
+        GPUParent::GetSingleton()->NotifyDeviceReset();
+      }
+      mAttachments->SetDeviceReset();
     }
-
     return;
   }
 
   LayoutDeviceIntSize oldSize = mSize;
 
   EnsureSize();
 
   IntRect intRect = IntRect(IntPoint(0, 0), mSize.ToUnknownSize());
--- a/gfx/layers/d3d11/DeviceAttachmentsD3D11.cpp
+++ b/gfx/layers/d3d11/DeviceAttachmentsD3D11.cpp
@@ -17,17 +17,18 @@ using namespace gfx;
 
 static const size_t kInitialMaximumTriangles = 64;
 
 DeviceAttachmentsD3D11::DeviceAttachmentsD3D11(ID3D11Device* device)
  : mSyncHandle(0),
    mMaximumTriangles(kInitialMaximumTriangles),
    mDevice(device),
    mContinueInit(true),
-   mInitialized(false)
+   mInitialized(false),
+   mDeviceReset(false)
 {
 }
 
 DeviceAttachmentsD3D11::~DeviceAttachmentsD3D11()
 {
 }
 
 /* static */ RefPtr<DeviceAttachmentsD3D11>
--- a/gfx/layers/d3d11/DeviceAttachmentsD3D11.h
+++ b/gfx/layers/d3d11/DeviceAttachmentsD3D11.h
@@ -68,16 +68,23 @@ public:
 
   RefPtr<ID3D11BlendState> mPremulBlendState;
   RefPtr<ID3D11BlendState> mNonPremulBlendState;
   RefPtr<ID3D11BlendState> mComponentBlendState;
   RefPtr<ID3D11BlendState> mDisabledBlendState;
   RefPtr<IDXGIResource> mSyncTexture;
   HANDLE mSyncHandle;
 
+  void SetDeviceReset() {
+    mDeviceReset = true;
+  }
+  bool IsDeviceReset() const {
+    return mDeviceReset;
+  }
+
 private:
   explicit DeviceAttachmentsD3D11(ID3D11Device* device);
   ~DeviceAttachmentsD3D11();
 
   bool Initialize();
   bool CreateShaders();
   bool InitSyncObject();
 
@@ -95,15 +102,16 @@ private:
 
 private:
   size_t mMaximumTriangles;
 
   // Only used during initialization.
   RefPtr<ID3D11Device> mDevice;
   bool mContinueInit;
   bool mInitialized;
+  bool mDeviceReset;
   nsCString mInitFailureId;
 };
 
 } // namespace layers
 } // namespace mozilla
 
 #endif // mozilla_gfx_layers_d3d11_DeviceAttachmentsD3D11_h