Bug 1035101 - Don't fail when a shared D3D11 texture doesn't have a mutex. r=mattwoodrow
authorNicolas Silva <nsilva@mozilla.com>
Wed, 09 Jul 2014 11:59:45 +0200
changeset 193060 6292743f667ffcb1382f3878f6444ee6e2e47c01
parent 193059 cf143afd302919acd3e49ff02519ae02a3e556ba
child 193061 e072a46f0b6a12bbf3ab3c3c0536da22c903174e
push id27107
push userryanvm@gmail.com
push dateWed, 09 Jul 2014 19:45:31 +0000
treeherdermozilla-central@6db315bcdb6a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1035101
milestone33.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 1035101 - Don't fail when a shared D3D11 texture doesn't have a mutex. r=mattwoodrow
gfx/layers/d3d11/TextureD3D11.cpp
--- a/gfx/layers/d3d11/TextureD3D11.cpp
+++ b/gfx/layers/d3d11/TextureD3D11.cpp
@@ -100,31 +100,38 @@ DataTextureSourceD3D11::~DataTextureSour
 
 
 template<typename T> // ID3D10Texture2D or ID3D11Texture2D
 static bool LockD3DTexture(T* aTexture)
 {
   MOZ_ASSERT(aTexture);
   RefPtr<IDXGIKeyedMutex> mutex;
   aTexture->QueryInterface((IDXGIKeyedMutex**)byRef(mutex));
-  if (!mutex) {
-    return false;
+  // Textures created by the DXVA decoders don't have a mutex for synchronization
+  if (mutex) {
+    HRESULT hr = mutex->AcquireSync(0, INFINITE);
+    if (FAILED(hr)) {
+      NS_WARNING("Failed to lock the texture");
+      return false;
+    }
   }
-  mutex->AcquireSync(0, INFINITE);
   return true;
 }
 
 template<typename T> // ID3D10Texture2D or ID3D11Texture2D
 static void UnlockD3DTexture(T* aTexture)
 {
   MOZ_ASSERT(aTexture);
   RefPtr<IDXGIKeyedMutex> mutex;
   aTexture->QueryInterface((IDXGIKeyedMutex**)byRef(mutex));
   if (mutex) {
-    mutex->ReleaseSync(0);
+    HRESULT hr = mutex->ReleaseSync(0);
+    if (FAILED(hr)) {
+      NS_WARNING("Failed to unlock the texture");
+    }
   }
 }
 
 TemporaryRef<TextureHost>
 CreateTextureHostD3D11(const SurfaceDescriptor& aDesc,
                        ISurfaceAllocator* aDeallocator,
                        TextureFlags aFlags)
 {