From 584704be9c6e420feaf4cc41cd657172080997c2 Mon Sep 17 00:00:00 2001 From: Matt Woodrow Date: Wed, 28 Sep 2016 13:29:46 +1300 Subject: [PATCH] Bug 1305326 - Use D3DChecks::DoesAlphaTextureSharingWork again. r=dvander --HG-- extra : rebase_source : 78b458c0c4f6967e5bed9da58fc00d143645e437 --- gfx/ipc/GraphicsMessages.ipdlh | 1 + gfx/layers/IMFYCbCrImage.cpp | 3 ++- gfx/thebes/DeviceManagerDx.cpp | 15 +++++++++++++++ gfx/thebes/DeviceManagerDx.h | 1 + 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/gfx/ipc/GraphicsMessages.ipdlh b/gfx/ipc/GraphicsMessages.ipdlh index 3b9fb1f4d79a..655ab707d2ef 100644 --- a/gfx/ipc/GraphicsMessages.ipdlh +++ b/gfx/ipc/GraphicsMessages.ipdlh @@ -19,6 +19,7 @@ struct D3D11DeviceStatus { bool isWARP; bool textureSharingWorks; + bool alphaTextureSharingWorks; uint32_t featureLevel; DxgiAdapterDesc adapter; }; diff --git a/gfx/layers/IMFYCbCrImage.cpp b/gfx/layers/IMFYCbCrImage.cpp index 439283faa2cc..8233982879e6 100644 --- a/gfx/layers/IMFYCbCrImage.cpp +++ b/gfx/layers/IMFYCbCrImage.cpp @@ -237,7 +237,8 @@ IMFYCbCrImage::GetTextureClient(KnowsCompositor* aForwarder) return nullptr; } - if (!gfx::DeviceManagerDx::Get()->CanInitializeKeyedMutexTextures()) { + if (!gfx::DeviceManagerDx::Get()->CanInitializeKeyedMutexTextures() || + !gfx::DeviceManagerDx::Get()->AlphaTextureSharingWorks()) { return nullptr; } diff --git a/gfx/thebes/DeviceManagerDx.cpp b/gfx/thebes/DeviceManagerDx.cpp index 03fd46731ba2..599272f4a609 100644 --- a/gfx/thebes/DeviceManagerDx.cpp +++ b/gfx/thebes/DeviceManagerDx.cpp @@ -328,6 +328,7 @@ DeviceManagerDx::CreateCompositorDevice(FeatureState& d3d11) // Only test this when not using WARP since it can fail and cause // GetDeviceRemovedReason to return weird values. bool textureSharingWorks = D3D11Checks::DoesTextureSharingWork(device); + bool alphaTextureSharingWorks = D3D11Checks::DoesAlphaTextureSharingWork(device); DXGI_ADAPTER_DESC desc; PodZero(&desc); @@ -355,6 +356,7 @@ DeviceManagerDx::CreateCompositorDevice(FeatureState& d3d11) mDeviceStatus = Some(D3D11DeviceStatus( false, textureSharingWorks, + alphaTextureSharingWorks, featureLevel, DxgiAdapterDesc::From(desc))); } @@ -409,8 +411,10 @@ DeviceManagerDx::CreateWARPCompositorDevice() // Only test for texture sharing on Windows 8 since it puts the device into // an unusable state if used on Windows 7 bool textureSharingWorks = false; + bool alphaTextureSharingWorks = false; if (IsWin8OrLater()) { textureSharingWorks = D3D11Checks::DoesTextureSharingWork(device); + alphaTextureSharingWorks = D3D11Checks::DoesAlphaTextureSharingWork(device); } DxgiAdapterDesc nullAdapter; @@ -423,6 +427,7 @@ DeviceManagerDx::CreateWARPCompositorDevice() mDeviceStatus = Some(D3D11DeviceStatus( true, textureSharingWorks, + alphaTextureSharingWorks, featureLevel, nullAdapter)); } @@ -670,6 +675,16 @@ DeviceManagerDx::TextureSharingWorks() return mDeviceStatus->textureSharingWorks(); } +bool +DeviceManagerDx::AlphaTextureSharingWorks() +{ + MutexAutoLock lock(mDeviceLock); + if (!mDeviceStatus) { + return false; + } + return mDeviceStatus->alphaTextureSharingWorks(); +} + bool DeviceManagerDx::CanInitializeKeyedMutexTextures() { diff --git a/gfx/thebes/DeviceManagerDx.h b/gfx/thebes/DeviceManagerDx.h index 617b098e5186..713fc48d9a29 100644 --- a/gfx/thebes/DeviceManagerDx.h +++ b/gfx/thebes/DeviceManagerDx.h @@ -58,6 +58,7 @@ public: unsigned GetCompositorFeatureLevel() const; bool TextureSharingWorks(); + bool AlphaTextureSharingWorks(); bool IsWARP(); // Returns true if we can create a texture with