Backed out changeset 8b06f81e24a8 (bug 1223270) for build/linker issues on a CLOSED TREE
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Tue, 20 Jun 2017 09:42:10 +0200
changeset 365002 e92b4f95ddf030c73484dab2257a7395a3086d67
parent 365001 3f095ad6ccc223ee864ef24602d949ea8d907bd3
child 365003 c658542cbb440f1ece710d66fd15186d33e6be6c
push id91680
push userkwierso@gmail.com
push dateWed, 21 Jun 2017 01:32:01 +0000
treeherdermozilla-inbound@f7b9dc31956c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1223270
milestone56.0a1
backs out8b06f81e24a8dcc3c59fc8b950f8ad10c8a51bf4
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 8b06f81e24a8 (bug 1223270) for build/linker issues on a CLOSED TREE
gfx/layers/IMFYCbCrImage.cpp
gfx/layers/d3d11/TextureD3D11.cpp
gfx/layers/d3d11/TextureD3D11.h
--- a/gfx/layers/IMFYCbCrImage.cpp
+++ b/gfx/layers/IMFYCbCrImage.cpp
@@ -26,16 +26,48 @@ IMFYCbCrImage::~IMFYCbCrImage()
   if (m2DBuffer) {
     m2DBuffer->Unlock2D();
   }
   else {
     mBuffer->Unlock();
   }
 }
 
+struct AutoLockTexture
+{
+  explicit AutoLockTexture(ID3D11Texture2D* aTexture)
+  {
+    aTexture->QueryInterface((IDXGIKeyedMutex**)getter_AddRefs(mMutex));
+    if (!mMutex) {
+      return;
+    }
+    HRESULT hr = mMutex->AcquireSync(0, 10000);
+    if (hr == WAIT_TIMEOUT) {
+      MOZ_CRASH("GFX: IMFYCbCrImage timeout");
+    }
+
+    if (FAILED(hr)) {
+      NS_WARNING("Failed to lock the texture");
+    }
+  }
+
+  ~AutoLockTexture()
+  {
+    if (!mMutex) {
+      return;
+    }
+    HRESULT hr = mMutex->ReleaseSync(0);
+    if (FAILED(hr)) {
+      NS_WARNING("Failed to unlock the texture");
+    }
+  }
+
+  RefPtr<IDXGIKeyedMutex> mMutex;
+};
+
 static already_AddRefed<IDirect3DTexture9>
 InitTextures(IDirect3DDevice9* aDevice,
              const IntSize &aSize,
             _D3DFORMAT aFormat,
             RefPtr<IDirect3DSurface9>& aSurface,
             HANDLE& aHandle,
             D3DLOCKED_RECT& aLockedRect)
 {
@@ -161,19 +193,19 @@ IMFYCbCrImage::GetD3D11TextureData(Data 
   // The documentation here seems to suggest using the immediate mode context
   // on more than one thread is not allowed:
   // https://msdn.microsoft.com/en-us/library/windows/desktop/ff476891(v=vs.85).aspx
   // The Debug Layer seems to imply it is though. When the ID3D10Multithread
   // layer is on. The Enter/Leave of the critical section shouldn't even be
   // required but were added for extra security.
 
   {
-    AutoLockD3D11Texture lockY(textureY);
-    AutoLockD3D11Texture lockCr(textureCr);
-    AutoLockD3D11Texture lockCb(textureCb);
+    AutoLockTexture lockY(textureY);
+    AutoLockTexture lockCr(textureCr);
+    AutoLockTexture lockCb(textureCb);
 
     mt->Enter();
 
     RefPtr<ID3D11DeviceContext> ctx;
     device->GetImmediateContext((ID3D11DeviceContext**)getter_AddRefs(ctx));
 
     D3D11_BOX box;
     box.front = box.top = box.left = 0;
--- a/gfx/layers/d3d11/TextureD3D11.cpp
+++ b/gfx/layers/d3d11/TextureD3D11.cpp
@@ -1390,37 +1390,10 @@ SyncObjectD3D11::FinalizeFrame()
 }
 
 uint32_t
 GetMaxTextureSizeFromDevice(ID3D11Device* aDevice)
 {
   return GetMaxTextureSizeForFeatureLevel(aDevice->GetFeatureLevel());
 }
 
-AutoLockD3D11Texture::AutoLockD3D11Texture(ID3D11Texture2D* aTexture)
-{
-  aTexture->QueryInterface((IDXGIKeyedMutex**)getter_AddRefs(mMutex));
-  if (!mMutex) {
-    return;
-  }
-  HRESULT hr = mMutex->AcquireSync(0, 10000);
-  if (hr == WAIT_TIMEOUT) {
-    MOZ_CRASH("GFX: IMFYCbCrImage timeout");
-  }
-
-  if (FAILED(hr)) {
-    NS_WARNING("Failed to lock the texture");
-  }
-}
-
-AutoLockD3D11Texture::~AutoLockD3D11Texture()
-{
-  if (!mMutex) {
-    return;
-  }
-  HRESULT hr = mMutex->ReleaseSync(0);
-  if (FAILED(hr)) {
-    NS_WARNING("Failed to unlock the texture");
-  }
-}
-
 } // namespace layers
 } // namespace mozilla
--- a/gfx/layers/d3d11/TextureD3D11.h
+++ b/gfx/layers/d3d11/TextureD3D11.h
@@ -469,22 +469,12 @@ inline uint32_t GetMaxTextureSizeForFeat
   default:
     maxTextureSize = D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION;
   }
   return maxTextureSize;
 }
 
 uint32_t GetMaxTextureSizeFromDevice(ID3D11Device* aDevice);
 
-class AutoLockD3D11Texture
-{
-public:
-  explicit AutoLockD3D11Texture(ID3D11Texture2D* aTexture);
-  ~AutoLockD3D11Texture();
-
-private:
-  RefPtr<IDXGIKeyedMutex> mMutex;
-};
-
 } // namespace layers
 } // namespace mozilla
 
 #endif /* MOZILLA_GFX_TEXTURED3D11_H */