Bug 1202700 - Use d3d9 device to upload YCbCr surfaces on the client side if possible. r=Bas
authorMatt Woodrow <mwoodrow@mozilla.com>
Thu, 10 Sep 2015 13:21:43 -0400
changeset 294440 c05f9ff38eaa173484411b9d0843fcc4914d445e
parent 294439 aa8cbb652d86253c379eb5628f72e44c5d6919e2
child 294441 a08998668652dc3b24467bbcc2195fcafa798ad7
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersBas
bugs1202700
milestone43.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 1202700 - Use d3d9 device to upload YCbCr surfaces on the client side if possible. r=Bas
gfx/layers/IMFYCbCrImage.cpp
--- a/gfx/layers/IMFYCbCrImage.cpp
+++ b/gfx/layers/IMFYCbCrImage.cpp
@@ -151,16 +151,19 @@ static bool UploadData(IDirect3DDevice9*
 
   return FinishTextures(aDevice, aTexture, surf);
 }
 
 TextureClient*
 IMFYCbCrImage::GetD3D9TextureClient(CompositableClient* aClient)
 {
   IDirect3DDevice9* device = gfxWindowsPlatform::GetPlatform()->GetD3D9Device();
+  if (!device) {
+    return nullptr;
+  }
 
   RefPtr<IDirect3DTexture9> textureY;
   HANDLE shareHandleY = 0;
   if (!UploadData(device, textureY, shareHandleY,
                   mData.mYChannel, mData.mYSize, mData.mYStride)) {
     return nullptr;
   }
 
@@ -214,22 +217,22 @@ IMFYCbCrImage::GetD3D9TextureClient(Comp
                                                   mData.mCbCrSize);
 
   return mTextureClient;
 }
 
 TextureClient*
 IMFYCbCrImage::GetTextureClient(CompositableClient* aClient)
 {
+  LayersBackend backend = aClient->GetForwarder()->GetCompositorBackendType();
   ID3D11Device* device = gfxWindowsPlatform::GetPlatform()->GetD3D11ImageBridgeDevice();
-  if (!device ||
-      aClient->GetForwarder()->GetCompositorBackendType() != LayersBackend::LAYERS_D3D11) {
 
-    IDirect3DDevice9* d3d9device = gfxWindowsPlatform::GetPlatform()->GetD3D9Device();
-    if (d3d9device && aClient->GetForwarder()->GetCompositorBackendType() == LayersBackend::LAYERS_D3D9) {
+  if (!device || backend != LayersBackend::LAYERS_D3D11) {
+    if (backend == LayersBackend::LAYERS_D3D9 ||
+        backend == LayersBackend::LAYERS_D3D11) {
       return GetD3D9TextureClient(aClient);
     }
     return nullptr;
   }
 
   if (mTextureClient) {
     return mTextureClient;
   }