diff --git a/gfx/gl/GLContextProviderWGL.cpp b/gfx/gl/GLContextProviderWGL.cpp index cbedaf59c092..a1373f78f4eb 100644 --- a/gfx/gl/GLContextProviderWGL.cpp +++ b/gfx/gl/GLContextProviderWGL.cpp @@ -214,12 +214,24 @@ WGLLibrary::EnsureInitialized() } } - if (HasExtension(extString, "WGL_NV_DX_interop")) { - if (GLLibraryLoader::LoadSymbols(mOGLLibrary, &dxInteropSymbols[0], lookupFunc)) { - mHasDXInterop = true; - mHasDXInterop2 = HasExtension(extString, "WGL_NV_DX_interop2"); - } else { - NS_ERROR("WGL supports NV_DX_interop without supplying its functions."); + //// + + mHasDXInterop = HasExtension(extString, "WGL_NV_DX_interop"); + mHasDXInterop2 = HasExtension(extString, "WGL_NV_DX_interop2"); + + nsCString blocklistId; + if (gfxUtils::IsFeatureBlacklisted(nullptr, nsIGfxInfo::FEATURE_DX_INTEROP2, + &blocklistId) && + !gfxPrefs::IgnoreDXInterop2Blacklist()) + { + mHasDXInterop2 = false; + } + + if (mHasDXInterop || mHasDXInterop2) { + if (!GLLibraryLoader::LoadSymbols(mOGLLibrary, &dxInteropSymbols[0], + lookupFunc)) + { + NS_ERROR("WGL supports NV_DX_interop(2) without supplying its functions."); fDXSetResourceShareHandle = nullptr; fDXOpenDevice = nullptr; fDXCloseDevice = nullptr; @@ -228,6 +240,9 @@ WGLLibrary::EnsureInitialized() fDXObjectAccess = nullptr; fDXLockObjects = nullptr; fDXUnlockObjects = nullptr; + + mHasDXInterop = false; + mHasDXInterop2 = false; } } } diff --git a/gfx/thebes/gfxPrefs.h b/gfx/thebes/gfxPrefs.h index 48d6d23ce4ea..9fc6b9e56cef 100644 --- a/gfx/thebes/gfxPrefs.h +++ b/gfx/thebes/gfxPrefs.h @@ -414,6 +414,7 @@ private: DECL_GFX_PREF(Live, "gl.multithreaded", GLMultithreaded, bool, false); #endif DECL_GFX_PREF(Live, "gl.require-hardware", RequireHardwareGL, bool, false); + DECL_GFX_PREF(Live, "ignore-dx-interop2-blacklist", IgnoreDXInterop2Blacklist, bool, false); DECL_GFX_PREF(Once, "image.cache.size", ImageCacheSize, int32_t, 5*1024*1024); DECL_GFX_PREF(Once, "image.cache.timeweight", ImageCacheTimeWeight, int32_t, 500); diff --git a/gfx/thebes/gfxUtils.cpp b/gfx/thebes/gfxUtils.cpp index 01d5cbc1e904..1894b39efc28 100644 --- a/gfx/thebes/gfxUtils.cpp +++ b/gfx/thebes/gfxUtils.cpp @@ -1428,6 +1428,25 @@ gfxUtils::ThreadSafeGetFeatureStatus(const nsCOMPtr& gfxInfo, return gfxInfo->GetFeatureStatus(feature, failureId, status); } +/* static */ bool +gfxUtils::IsFeatureBlacklisted(nsCOMPtr gfxInfo, int32_t feature, + nsACString* const out_blacklistId) +{ + if (!gfxInfo) { + gfxInfo = services::GetGfxInfo(); + } + + int32_t status; + if (!NS_SUCCEEDED(gfxUtils::ThreadSafeGetFeatureStatus(gfxInfo, feature, + *out_blacklistId, &status))) + { + out_blacklistId->AssignLiteral(""); + return true; + } + + return status != nsIGfxInfo::FEATURE_STATUS_OK; +} + /* static */ bool gfxUtils::DumpDisplayList() { return gfxPrefs::LayoutDumpDisplayList() || diff --git a/gfx/thebes/gfxUtils.h b/gfx/thebes/gfxUtils.h index 1d07728ebfc7..b9831c3545f2 100644 --- a/gfx/thebes/gfxUtils.h +++ b/gfx/thebes/gfxUtils.h @@ -268,6 +268,11 @@ public: nsACString& failureId, int32_t* status); + // Can pass `nullptr` for gfxInfo. + // If FAILED(ThreadSafeGetFeatureStatus), out_blacklistId will be empty. + static bool IsFeatureBlacklisted(nsCOMPtr gfxInfo, int32_t feature, + nsACString* const out_blacklistId); + /** * Copy to the clipboard as a PNG encoded Data URL. */ diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index cf83599e5822..8037a5c5d559 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -4400,6 +4400,7 @@ pref("gl.require-hardware", false); #ifdef XP_MACOSX pref("gl.multithreaded", true); #endif +pref("gl.ignore-dx-interop2-blacklist", false); pref("webgl.force-enabled", false); pref("webgl.disabled", false);