/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
auto syncObject = allocator->GetSyncObject(); if (!syncObject) {
MOZ_ASSERT_UNREACHABLE("unexpected to be called"); return nullptr;
}
MOZ_ASSERT(allocator->GetUsableSurfaceFormat() == gfx::SurfaceFormat::NV12); if (allocator->GetUsableSurfaceFormat() != gfx::SurfaceFormat::NV12) {
MOZ_ASSERT_UNREACHABLE("unexpected to be called"); return nullptr;
}
RefPtr<ID3D11Texture2D> stagingTexture =
allocator->GetStagingTextureNV12(aData.YPictureSize()); if (!stagingTexture) { return nullptr;
}
bool ok = image->AllocateTexture(allocator, allocator->mDevice); if (!ok) { return nullptr;
}
RefPtr<TextureClient> client = image->GetTextureClient(nullptr); if (!client) { return nullptr;
}
// The texture does not have keyed mutex. When keyed mutex exists, the texture // could not be used for video overlay. Then it needs manual synchronization
RefPtr<ID3D11Texture2D> texture = image->GetTexture(); if (!texture) { return nullptr;
}
RefPtr<ID3D11DeviceContext> context;
allocator->mDevice->GetImmediateContext(getter_AddRefs(context)); if (!context) { return nullptr;
}
void D3D11RecycleAllocator::SetPreferredSurfaceFormat(
gfx::SurfaceFormat aPreferredFormat) { if ((aPreferredFormat == gfx::SurfaceFormat::NV12 && mCanUseNV12) ||
(aPreferredFormat == gfx::SurfaceFormat::P010 && mCanUseP010) ||
(aPreferredFormat == gfx::SurfaceFormat::P016 && mCanUseP016)) {
mUsableSurfaceFormat = aPreferredFormat; return;
} // We can't handle the native source format, set it to BGRA which will // force the caller to convert it later.
mUsableSurfaceFormat = gfx::SurfaceFormat::B8G8R8A8;
}
already_AddRefed<TextureClient> D3D11RecycleAllocator::CreateOrRecycleClient(
gfx::ColorSpace2 aColorSpace, gfx::ColorRange aColorRange, const gfx::IntSize& aSize) { // When CompositorDevice or ContentDevice is updated, // we could not reuse old D3D11Textures. It could cause video flickering.
RefPtr<ID3D11Device> device = gfx::DeviceManagerDx::Get()->GetImageDevice(); if (!!mImageDevice && mImageDevice != device) {
ShrinkToMinimumSize();
}
mImageDevice = device;
TextureAllocationFlags allocFlags = TextureAllocationFlags::ALLOC_DEFAULT; if (StaticPrefs::media_wmf_use_sync_texture_AtStartup() ||
mDevice == DeviceManagerDx::Get()->GetCompositorDevice()) { // If our device is the compositor device, we don't need any synchronization // in practice.
allocFlags = TextureAllocationFlags::ALLOC_MANUAL_SYNCHRONIZATION;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.