Bug 1966082 - Use keyed mutex instead of ID3D11Fence in CanvasTranslator when remote canvas is enabled r=gfx-reviewers,lsalzman

Reverted as to use keyed mutex as before.

Differential Revision: https://phabricator.services.mozilla.com/D249216
This commit is contained in:
Sotaro Ikeda
2025-05-15 23:46:43 +00:00
committed by sikeda.birchill@mozilla.com
parent 06ff856805
commit 0940d4ba61
3 changed files with 13 additions and 2 deletions

View File

@@ -97,6 +97,9 @@ enum TextureAllocationFlags {
// Force allocation of remote/recorded texture, or fail if not possible.
ALLOC_FORCE_REMOTE = 1 << 9,
// Prefer to use keyed mutex than D3D11Fence on Windows
USE_D3D11_KEYED_MUTEX = 1 << 10,
};
enum class BackendSelector { Content, Canvas };

View File

@@ -557,8 +557,10 @@ D3D11TextureData* D3D11TextureData::Create(IntSize aSize, SurfaceFormat aFormat,
if (!NS_IsMainThread()) {
// On the main thread we use the syncobject to handle synchronization.
if (!(aFlags & ALLOC_MANUAL_SYNCHRONIZATION)) {
if (!(aFlags & USE_D3D11_KEYED_MUTEX)) {
auto* fencesHolderMap = CompositeProcessD3D11FencesHolderMap::Get();
useFence = fencesHolderMap && FenceD3D11::IsSupported(device);
}
if (!useFence) {
newDesc.MiscFlags = D3D11_RESOURCE_MISC_SHARED_NTHANDLE |
D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX;

View File

@@ -51,6 +51,12 @@ UniquePtr<TextureData> CanvasTranslator::CreateTextureData(
switch (mTextureType) {
#ifdef XP_WIN
case TextureType::D3D11: {
// Prefer keyed mutex than D3D11Fence if remote canvas is enabled. See Bug
// 1966082
if (gfx::gfxVars::RemoteCanvasEnabled()) {
allocFlags =
(TextureAllocationFlags)(allocFlags | USE_D3D11_KEYED_MUTEX);
}
textureData =
D3D11TextureData::Create(aSize, aFormat, allocFlags, mDevice);
break;