Bug 1386487 - Check if D3D11Device is obsoleted in D3D11YCbCrImage::GetAsSourceSurface() r=nical a=lizzard
authorsotaro <sotaro.ikeda.g@gmail.com>
Mon, 04 Mar 2019 11:01:53 +0000
changeset 516284 494caa8f588da55abb9bf5eb1bfb045f77669693
parent 516283 e84952f939308cf1a262087b5d42c76600fd08c9
child 516285 dc39216dfad387efd439083045062e323869a428
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnical, lizzard
bugs1386487
milestone66.0
Bug 1386487 - Check if D3D11Device is obsoleted in D3D11YCbCrImage::GetAsSourceSurface() r=nical a=lizzard Differential Revision: https://phabricator.services.mozilla.com/D21830
gfx/layers/D3D11YCbCrImage.cpp
--- a/gfx/layers/D3D11YCbCrImage.cpp
+++ b/gfx/layers/D3D11YCbCrImage.cpp
@@ -138,16 +138,21 @@ already_AddRefed<SourceSurface> D3D11YCb
   RefPtr<ID3D11Texture2D> texCb = dxgiData->GetD3D11Texture(1);
   RefPtr<ID3D11Texture2D> texCr = dxgiData->GetD3D11Texture(2);
   RefPtr<ID3D11Texture2D> softTexY, softTexCb, softTexCr;
   D3D11_TEXTURE2D_DESC desc;
 
   RefPtr<ID3D11Device> dev;
   texY->GetDevice(getter_AddRefs(dev));
 
+  if (!dev || dev != gfx::DeviceManagerDx::Get()->GetImageDevice()) {
+    gfxCriticalError() << "D3D11Device is obsoleted";
+    return nullptr;
+  }
+
   RefPtr<ID3D10Multithread> mt;
   hr = dev->QueryInterface((ID3D10Multithread**)getter_AddRefs(mt));
 
   if (FAILED(hr) || !mt) {
     gfxCriticalError() << "Multithread safety interface not supported.";
     return nullptr;
   }