зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1288618 - Part 3: Avoid accessing MediaPrefs from the GPU process within WMF code. r=cpearce
--HG-- extra : rebase_source : 8c8d88ed1b858d59555e2c698f7faf653c8a75e6
This commit is contained in:
Родитель
30d2768a45
Коммит
56fc7b3464
|
@ -494,7 +494,12 @@ DXVA2Manager::CreateD3D9DXVA(nsACString& aFailureReason)
|
|||
|
||||
// DXVA processing takes up a lot of GPU resources, so limit the number of
|
||||
// videos we use DXVA with at any one time.
|
||||
const uint32_t dxvaLimit = MediaPrefs::PDMWMFMaxDXVAVideos();
|
||||
uint32_t dxvaLimit = 4;
|
||||
// TODO: Sync this value across to the GPU process.
|
||||
if (XRE_GetProcessType() != GeckoProcessType_GPU) {
|
||||
dxvaLimit = MediaPrefs::PDMWMFMaxDXVAVideos();
|
||||
}
|
||||
|
||||
if (sDXVAVideosCount == dxvaLimit) {
|
||||
aFailureReason.AssignLiteral("Too many DXVA videos playing");
|
||||
return nullptr;
|
||||
|
@ -902,7 +907,12 @@ DXVA2Manager::CreateD3D11DXVA(nsACString& aFailureReason)
|
|||
{
|
||||
// DXVA processing takes up a lot of GPU resources, so limit the number of
|
||||
// videos we use DXVA with at any one time.
|
||||
const uint32_t dxvaLimit = MediaPrefs::PDMWMFMaxDXVAVideos();
|
||||
uint32_t dxvaLimit = 4;
|
||||
// TODO: Sync this value across to the GPU process.
|
||||
if (XRE_GetProcessType() != GeckoProcessType_GPU) {
|
||||
dxvaLimit = MediaPrefs::PDMWMFMaxDXVAVideos();
|
||||
}
|
||||
|
||||
if (sDXVAVideosCount == dxvaLimit) {
|
||||
aFailureReason.AssignLiteral("Too many DXVA videos playing");
|
||||
return nullptr;
|
||||
|
|
|
@ -61,7 +61,10 @@ WMFDecoderModule::GetNumDecoderThreads()
|
|||
// If we have more than 4 cores, let the decoder decide how many threads.
|
||||
// On an 8 core machine, WMF chooses 4 decoder threads
|
||||
const int WMF_DECODER_DEFAULT = -1;
|
||||
int32_t prefThreadCount = MediaPrefs::PDMWMFThreadCount();
|
||||
int32_t prefThreadCount = WMF_DECODER_DEFAULT;
|
||||
if (XRE_GetProcessType() != GeckoProcessType_GPU) {
|
||||
prefThreadCount = MediaPrefs::PDMWMFThreadCount();
|
||||
}
|
||||
if (prefThreadCount != WMF_DECODER_DEFAULT) {
|
||||
return std::max(prefThreadCount, 1);
|
||||
} else if (numCores > 4) {
|
||||
|
|
|
@ -180,6 +180,14 @@ 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()) {
|
||||
// Empty blacklist -> No blacklisting.
|
||||
|
@ -304,8 +312,10 @@ public:
|
|||
NS_ASSERTION(NS_IsMainThread(), "Must be on main thread.");
|
||||
nsACString* failureReason = &mFailureReason;
|
||||
nsCString secondFailureReason;
|
||||
bool allowD3D11 = (XRE_GetProcessType() == GeckoProcessType_GPU) ||
|
||||
MediaPrefs::PDMWMFAllowD3D11();
|
||||
if (mBackend == LayersBackend::LAYERS_D3D11 &&
|
||||
MediaPrefs::PDMWMFAllowD3D11() && IsWin8OrLater()) {
|
||||
allowD3D11 && IsWin8OrLater()) {
|
||||
const nsCString& blacklistedDLL = FindD3D11BlacklistedDLL();
|
||||
if (!blacklistedDLL.IsEmpty()) {
|
||||
failureReason->AppendPrintf("D3D11 blacklisted with DLL %s",
|
||||
|
@ -431,7 +441,8 @@ WMFVideoMFTManager::InitInternal(bool aForceD3D9)
|
|||
attr->GetUINT32(MF_SA_D3D_AWARE, &aware);
|
||||
attr->SetUINT32(CODECAPI_AVDecNumWorkerThreads,
|
||||
WMFDecoderModule::GetNumDecoderThreads());
|
||||
if (MediaPrefs::PDMWMFLowLatencyEnabled()) {
|
||||
if ((XRE_GetProcessType() != GeckoProcessType_GPU) &&
|
||||
MediaPrefs::PDMWMFLowLatencyEnabled()) {
|
||||
hr = attr->SetUINT32(CODECAPI_AVLowLatencyMode, TRUE);
|
||||
if (SUCCEEDED(hr)) {
|
||||
LOG("Enabling Low Latency Mode");
|
||||
|
|
Загрузка…
Ссылка в новой задаче