Add a testing pref to let the GPU process restart multiple times. (bug 1305941, r=mattwoodrow)

This commit is contained in:
David Anderson 2016-09-30 01:21:21 -07:00
Родитель 4b96f5df9e
Коммит 9a371ddb86
4 изменённых файлов: 19 добавлений и 3 удалений

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

@ -59,6 +59,7 @@ GPUProcessManager::Shutdown()
GPUProcessManager::GPUProcessManager()
: mTaskFactory(this),
mNextLayerTreeId(0),
mNumProcessAttempts(0),
mProcess(nullptr),
mGPUChild(nullptr)
{
@ -107,7 +108,7 @@ GPUProcessManager::OnXPCOMShutdown()
}
void
GPUProcessManager::EnableGPUProcess()
GPUProcessManager::LaunchGPUProcess()
{
if (mProcess) {
return;
@ -116,6 +117,8 @@ GPUProcessManager::EnableGPUProcess()
// Start the Vsync I/O thread so can use it as soon as the process launches.
EnsureVsyncIOThread();
mNumProcessAttempts++;
// The subprocess is launched asynchronously, so we wait for a callback to
// acquire the IPDL actor.
mProcess = new GPUProcessHost(this);
@ -127,6 +130,10 @@ GPUProcessManager::EnableGPUProcess()
void
GPUProcessManager::DisableGPUProcess(const char* aMessage)
{
if (!gfxConfig::IsEnabled(Feature::GPU_PROCESS)) {
return;
}
gfxConfig::SetFailed(Feature::GPU_PROCESS, FeatureStatus::Failed, aMessage);
gfxCriticalNote << aMessage;
@ -247,6 +254,13 @@ GPUProcessManager::OnProcessUnexpectedShutdown(GPUProcessHost* aHost)
DestroyProcess();
if (mNumProcessAttempts > uint32_t(gfxPrefs::GPUProcessDevMaxRestarts())) {
DisableGPUProcess("GPU processed crashed too many times");
}
if (gfxConfig::IsEnabled(Feature::GPU_PROCESS)) {
LaunchGPUProcess();
}
// The shutdown and restart sequence for the GPU process is as follows:
//
// (1) The GPU process dies. IPDL will enqueue an ActorDestroy message on

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

@ -73,7 +73,7 @@ public:
~GPUProcessManager();
// If not using a GPU process, launch a new GPU process asynchronously.
void EnableGPUProcess();
void LaunchGPUProcess();
// Ensure that GPU-bound methods can be used. If no GPU process is being
// used, or one is launched and ready, this function returns immediately.
@ -194,6 +194,7 @@ private:
ipc::TaskFactory<GPUProcessManager> mTaskFactory;
RefPtr<VsyncIOThreadHolder> mVsyncIOThread;
uint64_t mNextLayerTreeId;
uint32_t mNumProcessAttempts;
nsTArray<RefPtr<RemoteCompositorSession>> mRemoteSessions;
nsTArray<GPUProcessListener*> mListeners;

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

@ -2178,7 +2178,7 @@ gfxPlatform::InitAcceleration()
if (gpuProc.IsEnabled()) {
GPUProcessManager* gpu = GPUProcessManager::Get();
gpu->EnableGPUProcess();
gpu->LaunchGPUProcess();
}
}
}

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

@ -479,6 +479,7 @@ private:
DECL_GFX_PREF(Live, "layers.frame-counter", DrawFrameCounter, bool, false);
DECL_GFX_PREF(Once, "layers.gpu-process.dev.enabled", GPUProcessDevEnabled, bool, false);
DECL_GFX_PREF(Once, "layers.gpu-process.dev.timeout_ms", GPUProcessDevTimeoutMs, int32_t, 5000);
DECL_GFX_PREF(Live, "layers.gpu-process.dev.max_restarts", GPUProcessDevMaxRestarts, int32_t, 0);
DECL_GFX_PREF(Once, "layers.gralloc.disable", DisableGralloc, bool, false);
DECL_GFX_PREF(Live, "layers.low-precision-buffer", UseLowPrecisionBuffer, bool, false);
DECL_GFX_PREF(Live, "layers.low-precision-opacity", LowPrecisionOpacity, float, 1.0f);