Loading gfx/ipc/GraphicsMessages.ipdlh +1 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ struct D3D11DeviceStatus uint32_t featureLevel; DxgiAdapterDesc adapter; int32_t sequenceNumber; bool useNV12; }; struct DevicePrefs Loading gfx/layers/D3D11ShareHandleImage.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -34,7 +34,8 @@ bool D3D11ShareHandleImage::AllocateTexture(D3D11RecycleAllocator* aAllocator, ID3D11Device* aDevice) { if (aAllocator) { if (gfxPrefs::PDMWMFUseNV12Format()) { if (gfxPrefs::PDMWMFUseNV12Format() && gfx::DeviceManagerDx::Get()->CanUseNV12()) { mTextureClient = aAllocator->CreateOrRecycleClient(gfx::SurfaceFormat::NV12, mSize); } else { mTextureClient = aAllocator->CreateOrRecycleClient(gfx::SurfaceFormat::B8G8R8A8, mSize); Loading gfx/thebes/D3D11Checks.cpp +17 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "D3D11Checks.h" #include "DXVA2Manager.h" #include "gfxConfig.h" #include "GfxDriverInfo.h" #include "gfxPrefs.h" Loading Loading @@ -409,5 +410,21 @@ D3D11Checks::DoesRemotePresentWork(IDXGIAdapter* adapter) return SUCCEEDED(hr) && check; } /* static */ bool D3D11Checks::DoesNV12Work(ID3D11Device* device) { DXGI_ADAPTER_DESC desc; PodZero(&desc); if (!GetDxgiDesc(device, &desc)) { // Failed to retrieve device information, assume it works return true; } nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo(); nsString version; gfxInfo->GetAdapterDriverVersion(version); return DXVA2Manager::IsNV12Supported(desc.VendorId, desc.DeviceId, version); } } // namespace gfx } // namespace mozilla gfx/thebes/D3D11Checks.h +3 −2 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ struct D3D11Checks static void WarnOnAdapterMismatch(ID3D11Device* device); static bool GetDxgiDesc(ID3D11Device* device, DXGI_ADAPTER_DESC* out); static bool DoesRemotePresentWork(IDXGIAdapter* adapter); static bool DoesNV12Work(ID3D11Device* device); }; } // namespace gfx Loading gfx/thebes/DeviceManagerDx.cpp +17 −2 Original line number Diff line number Diff line Loading @@ -395,6 +395,7 @@ DeviceManagerDx::CreateCompositorDevice(FeatureState& d3d11) } uint32_t featureLevel = device->GetFeatureLevel(); bool useNV12 = D3D11Checks::DoesNV12Work(device); { MutexAutoLock lock(mDeviceLock); mCompositorDevice = device; Loading @@ -405,7 +406,8 @@ DeviceManagerDx::CreateCompositorDevice(FeatureState& d3d11) textureSharingWorks, featureLevel, DxgiAdapterDesc::From(desc), sequenceNumber)); sequenceNumber, useNV12)); } mCompositorDevice->SetExceptionMode(0); } Loading Loading @@ -501,6 +503,8 @@ DeviceManagerDx::CreateWARPCompositorDevice() PodZero(&nullAdapter); int featureLevel = device->GetFeatureLevel(); bool useNV12 = D3D11Checks::DoesNV12Work(device); { MutexAutoLock lock(mDeviceLock); mCompositorDevice = device; Loading @@ -511,7 +515,8 @@ DeviceManagerDx::CreateWARPCompositorDevice() textureSharingWorks, featureLevel, nullAdapter, sequenceNumber)); sequenceNumber, useNV12)); } mCompositorDevice->SetExceptionMode(0); Loading Loading @@ -1001,6 +1006,16 @@ DeviceManagerDx::IsWARP() return mDeviceStatus->isWARP(); } bool DeviceManagerDx::CanUseNV12() { MutexAutoLock lock(mDeviceLock); if (!mDeviceStatus) { return true; } return mDeviceStatus->useNV12(); } void DeviceManagerDx::InitializeDirectDraw() { Loading Loading
gfx/ipc/GraphicsMessages.ipdlh +1 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ struct D3D11DeviceStatus uint32_t featureLevel; DxgiAdapterDesc adapter; int32_t sequenceNumber; bool useNV12; }; struct DevicePrefs Loading
gfx/layers/D3D11ShareHandleImage.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -34,7 +34,8 @@ bool D3D11ShareHandleImage::AllocateTexture(D3D11RecycleAllocator* aAllocator, ID3D11Device* aDevice) { if (aAllocator) { if (gfxPrefs::PDMWMFUseNV12Format()) { if (gfxPrefs::PDMWMFUseNV12Format() && gfx::DeviceManagerDx::Get()->CanUseNV12()) { mTextureClient = aAllocator->CreateOrRecycleClient(gfx::SurfaceFormat::NV12, mSize); } else { mTextureClient = aAllocator->CreateOrRecycleClient(gfx::SurfaceFormat::B8G8R8A8, mSize); Loading
gfx/thebes/D3D11Checks.cpp +17 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "D3D11Checks.h" #include "DXVA2Manager.h" #include "gfxConfig.h" #include "GfxDriverInfo.h" #include "gfxPrefs.h" Loading Loading @@ -409,5 +410,21 @@ D3D11Checks::DoesRemotePresentWork(IDXGIAdapter* adapter) return SUCCEEDED(hr) && check; } /* static */ bool D3D11Checks::DoesNV12Work(ID3D11Device* device) { DXGI_ADAPTER_DESC desc; PodZero(&desc); if (!GetDxgiDesc(device, &desc)) { // Failed to retrieve device information, assume it works return true; } nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo(); nsString version; gfxInfo->GetAdapterDriverVersion(version); return DXVA2Manager::IsNV12Supported(desc.VendorId, desc.DeviceId, version); } } // namespace gfx } // namespace mozilla
gfx/thebes/D3D11Checks.h +3 −2 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ struct D3D11Checks static void WarnOnAdapterMismatch(ID3D11Device* device); static bool GetDxgiDesc(ID3D11Device* device, DXGI_ADAPTER_DESC* out); static bool DoesRemotePresentWork(IDXGIAdapter* adapter); static bool DoesNV12Work(ID3D11Device* device); }; } // namespace gfx Loading
gfx/thebes/DeviceManagerDx.cpp +17 −2 Original line number Diff line number Diff line Loading @@ -395,6 +395,7 @@ DeviceManagerDx::CreateCompositorDevice(FeatureState& d3d11) } uint32_t featureLevel = device->GetFeatureLevel(); bool useNV12 = D3D11Checks::DoesNV12Work(device); { MutexAutoLock lock(mDeviceLock); mCompositorDevice = device; Loading @@ -405,7 +406,8 @@ DeviceManagerDx::CreateCompositorDevice(FeatureState& d3d11) textureSharingWorks, featureLevel, DxgiAdapterDesc::From(desc), sequenceNumber)); sequenceNumber, useNV12)); } mCompositorDevice->SetExceptionMode(0); } Loading Loading @@ -501,6 +503,8 @@ DeviceManagerDx::CreateWARPCompositorDevice() PodZero(&nullAdapter); int featureLevel = device->GetFeatureLevel(); bool useNV12 = D3D11Checks::DoesNV12Work(device); { MutexAutoLock lock(mDeviceLock); mCompositorDevice = device; Loading @@ -511,7 +515,8 @@ DeviceManagerDx::CreateWARPCompositorDevice() textureSharingWorks, featureLevel, nullAdapter, sequenceNumber)); sequenceNumber, useNV12)); } mCompositorDevice->SetExceptionMode(0); Loading Loading @@ -1001,6 +1006,16 @@ DeviceManagerDx::IsWARP() return mDeviceStatus->isWARP(); } bool DeviceManagerDx::CanUseNV12() { MutexAutoLock lock(mDeviceLock); if (!mDeviceStatus) { return true; } return mDeviceStatus->useNV12(); } void DeviceManagerDx::InitializeDirectDraw() { Loading