Bug 1340398 - Part 3: Use NV12 format by default. r=mattwoodrow

MozReview-Commit-ID: DcP40U81FBQ
This commit is contained in:
Bas Schouten 2017-03-07 20:55:20 +00:00
Родитель ddb41fcc63
Коммит 2f08c8af36
3 изменённых файлов: 21 добавлений и 9 удалений

Просмотреть файл

@ -699,7 +699,7 @@ D3D11DXVA2Manager::Init(layers::KnowsCompositor* aKnowsCompositor,
mTextureClientAllocator = new D3D11RecycleAllocator(
layers::ImageBridgeChild::GetSingleton().get(), mDevice);
if (ImageBridgeChild::GetSingleton()) {
if (ImageBridgeChild::GetSingleton() && gfxPrefs::PDMWMFUseSyncTexture()) {
// We use a syncobject to avoid the cost of the mutex lock when compositing,
// and because it allows color conversion ocurring directly from this texture
// DXVA does not seem to accept IDXGIKeyedMutex textures as input.
@ -711,12 +711,14 @@ D3D11DXVA2Manager::Init(layers::KnowsCompositor* aKnowsCompositor,
} else {
mTextureClientAllocator =
new D3D11RecycleAllocator(aKnowsCompositor, mDevice);
// We use a syncobject to avoid the cost of the mutex lock when compositing,
// and because it allows color conversion ocurring directly from this texture
// DXVA does not seem to accept IDXGIKeyedMutex textures as input.
mSyncObject =
layers::SyncObject::CreateSyncObject(aKnowsCompositor->GetTextureFactoryIdentifier().mSyncHandle,
mDevice);
if (gfxPrefs::PDMWMFUseSyncTexture()) {
// We use a syncobject to avoid the cost of the mutex lock when compositing,
// and because it allows color conversion ocurring directly from this texture
// DXVA does not seem to accept IDXGIKeyedMutex textures as input.
mSyncObject =
layers::SyncObject::CreateSyncObject(aKnowsCompositor->GetTextureFactoryIdentifier().mSyncHandle,
mDevice);
}
}
mTextureClientAllocator->SetMaxPoolSize(5);

Просмотреть файл

@ -31,7 +31,11 @@ bool
D3D11ShareHandleImage::AllocateTexture(D3D11RecycleAllocator* aAllocator, ID3D11Device* aDevice)
{
if (aAllocator) {
mTextureClient = aAllocator->CreateOrRecycleClient(gfx::SurfaceFormat::B8G8R8A8, mSize);
if (gfxPrefs::PDMWMFUseNV12Format()) {
mTextureClient = aAllocator->CreateOrRecycleClient(gfx::SurfaceFormat::NV12, mSize);
} else {
mTextureClient = aAllocator->CreateOrRecycleClient(gfx::SurfaceFormat::B8G8R8A8, mSize);
}
if (mTextureClient) {
mTexture = static_cast<D3D11TextureData*>(mTextureClient->GetInternalData())->GetD3D11Texture();
return true;
@ -188,12 +192,16 @@ already_AddRefed<TextureClient>
D3D11RecycleAllocator::CreateOrRecycleClient(gfx::SurfaceFormat aFormat,
const gfx::IntSize& aSize)
{
TextureAllocationFlags allocFlags = TextureAllocationFlags::ALLOC_DEFAULT;
if (gfxPrefs::PDMWMFUseSyncTexture()) {
allocFlags = TextureAllocationFlags::ALLOC_MANUAL_SYNCHRONIZATION;
}
RefPtr<TextureClient> textureClient =
CreateOrRecycle(aFormat,
aSize,
BackendSelector::Content,
layers::TextureFlags::DEFAULT,
TextureAllocationFlags::ALLOC_DEFAULT);
allocFlags);
return textureClient.forget();
}

Просмотреть файл

@ -576,6 +576,8 @@ private:
#ifdef XP_WIN
DECL_GFX_PREF(Live, "media.windows-media-foundation.allow-d3d11-dxva", PDMWMFAllowD3D11, bool, true);
DECL_GFX_PREF(Live, "media.windows-media-foundation.max-dxva-videos", PDMWMFMaxDXVAVideos, uint32_t, 8);
DECL_GFX_PREF(Live, "media.windows-media-foundation.use-nv12-format", PDMWMFUseNV12Format, bool, true);
DECL_GFX_PREF(Once, "media.windows-media-foundation.use-sync-texture", PDMWMFUseSyncTexture, bool, true);
DECL_GFX_PREF(Live, "media.wmf.low-latency.enabled", PDMWMFLowLatencyEnabled, bool, false);
DECL_GFX_PREF(Live, "media.wmf.skip-blacklist", PDMWMFSkipBlacklist, bool, false);
#endif