Bug 1338011 - Adds an intermediate fallback when the GPU process crashes - r=gerald

MozReview-Commit-ID: 9x1ckaWagcE

--HG--
extra : rebase_source : 2962f8572dd36b2dfecb7bb30ba515fc7c6323c9
This commit is contained in:
Jay Harris 2017-04-15 09:34:01 +12:00
Родитель ac45515c22
Коммит 6ce213e795
5 изменённых файлов: 27 добавлений и 5 удалений

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

@ -28,6 +28,7 @@
#include "nsServiceManagerUtils.h"
#include "nsWindowsHelpers.h"
#include "prsystem.h"
#include "nsIXULRuntime.h"
namespace mozilla {
@ -45,7 +46,20 @@ WMFDecoderModule::~WMFDecoderModule()
void
WMFDecoderModule::Init()
{
sDXVAEnabled = gfx::gfxVars::CanUseHardwareVideoDecoding();
if (XRE_IsContentProcess()) {
// If we're in the content process and the UseGPUDecoder pref is set, it
// means that we've given up on the GPU process (it's been crashing) so we
// should disable DXVA
sDXVAEnabled = !MediaPrefs::PDMUseGPUDecoder();
} else if (XRE_IsGPUProcess()) {
// Always allow DXVA in the GPU process.
sDXVAEnabled = true;
} else {
// Only allow DXVA in the UI process if we aren't in e10s Firefox
sDXVAEnabled = !mozilla::BrowserTabsRemoteAutostart();
}
sDXVAEnabled = sDXVAEnabled && gfx::gfxVars::CanUseHardwareVideoDecoding();
}
/* static */

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

@ -379,6 +379,8 @@ GPUProcessManager::OnProcessUnexpectedShutdown(GPUProcessHost* aHost)
SprintfLiteral(disableMessage, "GPU process disabled after %d attempts",
mNumProcessAttempts);
DisableGPUProcess(disableMessage);
} else if (mNumProcessAttempts > uint32_t(gfxPrefs::GPUProcessMaxRestartsWithDecoder())) {
mDecodeVideoOnGpuProcess = false;
}
HandleProcessLost();
@ -797,7 +799,9 @@ void
GPUProcessManager::CreateContentVideoDecoderManager(base::ProcessId aOtherProcess,
ipc::Endpoint<dom::PVideoDecoderManagerChild>* aOutEndpoint)
{
if (!EnsureGPUReady() || !MediaPrefs::PDMUseGPUDecoder()) {
if (!EnsureGPUReady() ||
!MediaPrefs::PDMUseGPUDecoder() ||
!mDecodeVideoOnGpuProcess) {
return;
}

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

@ -235,6 +235,8 @@ private:
friend class Observer;
private:
bool mDecodeVideoOnGpuProcess = true;
RefPtr<Observer> mObserver;
ipc::TaskFactory<GPUProcessManager> mTaskFactory;
RefPtr<VsyncIOThreadHolder> mVsyncIOThread;

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

@ -2242,8 +2242,8 @@ gfxPlatform::InitAcceleration()
NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_HARDWARE_VIDEO_DECODING,
discardFailureId, &status))) {
if (status == nsIGfxInfo::FEATURE_STATUS_OK || gfxPrefs::HardwareVideoDecodingForceEnabled()) {
sLayersSupportsHardwareVideoDecoding = true;
}
sLayersSupportsHardwareVideoDecoding = true;
}
}
sLayersAccelerationPrefsInitialized = true;

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

@ -544,8 +544,10 @@ private:
DECL_GFX_PREF(Once, "layers.gpu-process.enabled", GPUProcessEnabled, bool, false);
DECL_GFX_PREF(Once, "layers.gpu-process.force-enabled", GPUProcessForceEnabled, bool, false);
DECL_GFX_PREF(Once, "layers.gpu-process.timeout_ms", GPUProcessTimeoutMs, int32_t, 5000);
DECL_GFX_PREF(Live, "layers.gpu-process.max_restarts", GPUProcessMaxRestarts, int32_t, 0);
DECL_GFX_PREF(Live, "layers.gpu-process.max_restarts", GPUProcessMaxRestarts, int32_t, 1);
DECL_GFX_PREF(Once, "layers.gpu-process.allow-software", GPUProcessAllowSoftware, bool, false);
// Note: This pref will only be used if it is less than layers.gpu-process.max_restarts.
DECL_GFX_PREF(Live, "layers.gpu-process.max_restarts_with_decoder", GPUProcessMaxRestartsWithDecoder, int32_t, 0);
DECL_GFX_PREF(Live, "layers.low-precision-buffer", UseLowPrecisionBuffer, bool, false);
DECL_GFX_PREF(Live, "layers.low-precision-opacity", LowPrecisionOpacity, float, 1.0f);
DECL_GFX_PREF(Live, "layers.low-precision-resolution", LowPrecisionResolution, float, 0.25f);