Bug 1187466 - check compositor status in TextureHost::lock(). r=dvander
authorJerryShih <hshih@mozilla.com>
Sat, 28 May 2016 10:38:00 +0200
changeset 340639 98a0044f91bd3a629440382271584ba958666c92
parent 340638 7e6f2545d6e35df5c79640d544485087bd4ca079
child 340640 910f449ac11a507e35ecbe3e8ecd6e6b38e63d3f
push id1183
push userraliiev@mozilla.com
push dateMon, 05 Sep 2016 20:01:49 +0000
treeherdermozilla-release@3148731bed45 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdvander
bugs1187466
milestone49.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 1187466 - check compositor status in TextureHost::lock(). r=dvander If the compositor is a nullptr during lock() call, it means that the compositor is not compatible with current textureHost. So return false in lock().
gfx/layers/d3d11/TextureD3D11.cpp
gfx/layers/d3d9/TextureD3D9.cpp
--- a/gfx/layers/d3d11/TextureD3D11.cpp
+++ b/gfx/layers/d3d11/TextureD3D11.cpp
@@ -682,20 +682,26 @@ DXGITextureHostD3D11::SetCompositor(Comp
   if (mTextureSource) {
     mTextureSource->SetCompositor(aCompositor);
   }
 }
 
 bool
 DXGITextureHostD3D11::Lock()
 {
+  if (!mCompositor) {
+    NS_WARNING("no suitable compositor");
+    return false;
+  }
+
   if (!GetDevice()) {
     NS_WARNING("trying to lock a TextureHost without a D3D device");
     return false;
   }
+
   if (!mTextureSource) {
     if (!mTexture && !OpenSharedHandle()) {
       gfxWindowsPlatform::GetPlatform()->ForceDeviceReset(ForcedDeviceResetReason::OPENSHAREDHANDLE);
       return false;
     }
 
     mTextureSource = new DataTextureSourceD3D11(mFormat, mCompositor, mTexture);
   }
@@ -799,16 +805,21 @@ DXGIYCbCrTextureHostD3D11::SetCompositor
   if (mTextureSources[0]) {
     mTextureSources[0]->SetCompositor(aCompositor);
   }
 }
 
 bool
 DXGIYCbCrTextureHostD3D11::Lock()
 {
+  if (!mCompositor) {
+    NS_WARNING("no suitable compositor");
+    return false;
+  }
+
   if (!GetDevice()) {
     NS_WARNING("trying to lock a TextureHost without a D3D device");
     return false;
   }
   if (!mTextureSources[0]) {
     if (!mTextures[0] && !OpenSharedHandle()) {
       return false;
     }
--- a/gfx/layers/d3d9/TextureD3D9.cpp
+++ b/gfx/layers/d3d9/TextureD3D9.cpp
@@ -1048,16 +1048,21 @@ DXGITextureHostD3D9::BindTextureSource(C
   return !!aTexture;
 }
 
 bool
 DXGITextureHostD3D9::Lock()
 {
   MOZ_ASSERT(!mIsLocked);
 
+  if (!mCompositor) {
+    NS_WARNING("no suitable compositor");
+    return false;
+  }
+
   if (!GetDevice()) {
     return false;
   }
 
   if (!mTextureSource) {
     OpenSharedHandle();
   }
   mIsLocked = !!mTextureSource;
@@ -1117,16 +1122,21 @@ DXGIYCbCrTextureHostD3D9::SetCompositor(
     mTextureSources[1] = nullptr;
     mTextureSources[2] = nullptr;
   }
 }
 
 bool
 DXGIYCbCrTextureHostD3D9::Lock()
 {
+  if (!mCompositor) {
+    NS_WARNING("no suitable compositor");
+    return false;
+  }
+
   if (!GetDevice()) {
     NS_WARNING("trying to lock a TextureHost without a D3D device");
     return false;
   }
   if (!mTextureSources[0]) {
     if (!mHandles[0]) {
       return false;
     }