Bug 1300681 - Use gfxVars for DXVA blacklist prefs so that they work in the GPU process. r=dvander,gerald

This commit is contained in:
Matt Woodrow 2016-11-03 09:57:18 +13:00
Родитель 552d016944
Коммит 5375ddbb83
4 изменённых файлов: 13 добавлений и 14 удалений

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

@ -19,7 +19,6 @@
#include "mozilla/layers/LayersTypes.h"
#include "MediaInfo.h"
#include "mozilla/Logging.h"
#include "mozilla/Preferences.h"
#include "nsWindowsHelpers.h"
#include "gfx2DGlue.h"
#include "gfxWindowsPlatform.h"
@ -169,6 +168,7 @@ StaticAutoPtr<D3DDLLBlacklistingCache> sD3D9BlacklistingCache;
// If a blacklisted DLL is found, return its information, otherwise "".
static const nsCString&
FindDXVABlacklistedDLL(StaticAutoPtr<D3DDLLBlacklistingCache>& aDLLBlacklistingCache,
const nsCString& aBlacklist,
const char* aDLLBlacklistPrefName)
{
NS_ASSERTION(NS_IsMainThread(), "Must be on main thread.");
@ -180,16 +180,7 @@ FindDXVABlacklistedDLL(StaticAutoPtr<D3DDLLBlacklistingCache>& aDLLBlacklistingC
ClearOnShutdown(&aDLLBlacklistingCache);
}
if (XRE_GetProcessType() == GeckoProcessType_GPU) {
// The blacklist code doesn't support running in
// the GPU process yet.
aDLLBlacklistingCache->mBlacklistPref.SetLength(0);
aDLLBlacklistingCache->mBlacklistedDLL.SetLength(0);
return aDLLBlacklistingCache->mBlacklistedDLL;
}
nsAdoptingCString blacklist = Preferences::GetCString(aDLLBlacklistPrefName);
if (blacklist.IsEmpty()) {
if (aBlacklist.IsEmpty()) {
// Empty blacklist -> No blacklisting.
aDLLBlacklistingCache->mBlacklistPref.SetLength(0);
aDLLBlacklistingCache->mBlacklistedDLL.SetLength(0);
@ -197,17 +188,17 @@ FindDXVABlacklistedDLL(StaticAutoPtr<D3DDLLBlacklistingCache>& aDLLBlacklistingC
}
// Detect changes in pref.
if (aDLLBlacklistingCache->mBlacklistPref.Equals(blacklist)) {
if (aDLLBlacklistingCache->mBlacklistPref.Equals(aBlacklist)) {
// Same blacklist -> Return same result (i.e., don't check DLLs again).
return aDLLBlacklistingCache->mBlacklistedDLL;
}
// Adopt new pref now, so we don't work on it again.
aDLLBlacklistingCache->mBlacklistPref = blacklist;
aDLLBlacklistingCache->mBlacklistPref = aBlacklist;
// media.wmf.disable-d3d*-for-dlls format: (whitespace is trimmed)
// "dll1.dll: 1.2.3.4[, more versions...][; more dlls...]"
nsTArray<nsCString> dlls;
SplitAt(";", blacklist, dlls);
SplitAt(";", aBlacklist, dlls);
for (const auto& dll : dlls) {
nsTArray<nsCString> nameAndVersions;
SplitAt(":", dll, nameAndVersions);
@ -292,12 +283,14 @@ FindDXVABlacklistedDLL(StaticAutoPtr<D3DDLLBlacklistingCache>& aDLLBlacklistingC
static const nsCString&
FindD3D11BlacklistedDLL() {
return FindDXVABlacklistedDLL(sD3D11BlacklistingCache,
gfx::gfxVars::PDMWMFDisableD3D11Dlls(),
"media.wmf.disable-d3d11-for-dlls");
}
static const nsCString&
FindD3D9BlacklistedDLL() {
return FindDXVABlacklistedDLL(sD3D9BlacklistingCache,
gfx::gfxVars::PDMWMFDisableD3D9Dlls(),
"media.wmf.disable-d3d9-for-dlls");
}

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

@ -30,6 +30,8 @@ class gfxVarReceiver;
_(OffscreenFormat, gfxImageFormat, mozilla::gfx::SurfaceFormat::X8R8G8B8_UINT32) \
_(RequiresAcceleratedGLContextForCompositorOGL, bool, false) \
_(CanUseHardwareVideoDecoding, bool, false) \
_(PDMWMFDisableD3D11Dlls, nsCString, nsCString()) \
_(PDMWMFDisableD3D9Dlls, nsCString, nsCString()) \
/* Add new entries above this line. */

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

@ -74,6 +74,7 @@ union GfxVarValue
bool;
gfxImageFormat;
IntSize;
nsCString;
};
struct GfxVarUpdate

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

@ -616,6 +616,9 @@ gfxPlatform::Init()
if (XRE_IsParentProcess()) {
GPUProcessManager::Initialize();
gfxVars::SetPDMWMFDisableD3D11Dlls(Preferences::GetCString("media.wmf.disable-d3d11-for-dlls"));
gfxVars::SetPDMWMFDisableD3D9Dlls(Preferences::GetCString("media.wmf.disable-d3d9-for-dlls"));
}
// Drop a note in the crash report if we end up forcing an option that could