Backed out changeset 7ba7ce64acae (bug 1689203) for causing failure on GfxConfigManager. CLOSED TREE

This commit is contained in:
Butkovits Atila 2021-02-02 01:33:00 +02:00
Родитель 013e325e7d
Коммит 6a81495553
7 изменённых файлов: 65 добавлений и 157 удалений

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

@ -121,6 +121,10 @@ void gfxConfigManager::ConfigureWebRenderSoftware() {
// (hardware). See bug 1656811.
if (mWrSoftwareForceEnabled) {
mFeatureWrSoftware->UserForceEnable("Force enabled by pref");
} else if (mWrForceEnabled || mWrEnvForceEnabled) {
mFeatureWrSoftware->UserDisable(
"User force-enabled full WR",
"FEATURE_FAILURE_USER_FORCE_ENABLED_FULL_WR"_ns);
} else if (mWrForceDisabled || mWrEnvForceDisabled) {
// If the user set the pref to force-disable, let's do that. This
// will override all the other enabling prefs

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

@ -192,27 +192,14 @@ bool GPUProcessManager::IsGPUProcessLaunching() {
}
void GPUProcessManager::DisableGPUProcess(const char* aMessage) {
MaybeDisableGPUProcess(aMessage, /* aAllowRestart */ false);
}
bool GPUProcessManager::MaybeDisableGPUProcess(const char* aMessage,
bool aAllowRestart) {
if (!gfxConfig::IsEnabled(Feature::GPU_PROCESS)) {
return true;
}
bool wantRestart = gfxPlatform::FallbackFromAcceleration(
FeatureStatus::Unavailable, "GPU Process is disabled",
"FEATURE_FAILURE_GPU_PROCESS_DISABLED"_ns);
if (aAllowRestart && wantRestart) {
// The fallback method can make use of the GPU process.
return false;
return;
}
gfxConfig::SetFailed(Feature::GPU_PROCESS, FeatureStatus::Failed, aMessage);
gfxCriticalNote << aMessage;
gfxPlatform::DisableGPUProcess();
gfxPlatform::NotifyGPUProcessDisabled();
Telemetry::Accumulate(Telemetry::GPU_PROCESS_CRASH_FALLBACKS,
uint32_t(FallbackType::DISABLED));
@ -231,7 +218,12 @@ bool GPUProcessManager::MaybeDisableGPUProcess(const char* aMessage,
// crash, then we need to tell the content processes again, because they
// need to rebind to the UI process.
HandleProcessLost();
return true;
// On Windows and Linux, always fallback to software.
// The assumption is that something in the graphics driver is crashing.
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
FallbackToSoftware("GPU Process is disabled, fallback to software solution.");
#endif
}
bool GPUProcessManager::EnsureGPUReady() {
@ -462,42 +454,33 @@ bool GPUProcessManager::DisableWebRenderConfig(wr::WebRenderError aError,
return false;
}
// Disable WebRender
bool wantRestart;
if (aError == wr::WebRenderError::INITIALIZE) {
wantRestart = gfxPlatform::FallbackFromAcceleration(
gfx::FeatureStatus::Unavailable, "WebRender initialization failed",
aMsg);
gfxPlatform::DisableWebRender(gfx::FeatureStatus::Unavailable,
"WebRender initialization failed", aMsg);
} else if (aError == wr::WebRenderError::MAKE_CURRENT) {
wantRestart = gfxPlatform::FallbackFromAcceleration(
gfx::FeatureStatus::Unavailable,
"Failed to make render context current",
"FEATURE_FAILURE_WEBRENDER_MAKE_CURRENT"_ns);
gfxPlatform::DisableWebRender(gfx::FeatureStatus::Unavailable,
"Failed to make render context current",
"FEATURE_FAILURE_WEBRENDER_MAKE_CURRENT"_ns);
} else if (aError == wr::WebRenderError::RENDER) {
wantRestart = gfxPlatform::FallbackFromAcceleration(
gfx::FeatureStatus::Unavailable, "Failed to render WebRender",
"FEATURE_FAILURE_WEBRENDER_RENDER"_ns);
gfxPlatform::DisableWebRender(gfx::FeatureStatus::Unavailable,
"Failed to render WebRender",
"FEATURE_FAILURE_WEBRENDER_RENDER"_ns);
} else if (aError == wr::WebRenderError::NEW_SURFACE) {
wantRestart = gfxPlatform::FallbackFromAcceleration(
gfx::FeatureStatus::Unavailable, "Failed to create new surface",
"FEATURE_FAILURE_WEBRENDER_NEW_SURFACE"_ns);
gfxPlatform::DisableWebRender(gfx::FeatureStatus::Unavailable,
"Failed to create new surface",
"FEATURE_FAILURE_WEBRENDER_NEW_SURFACE"_ns);
} else if (aError == wr::WebRenderError::EXCESSIVE_RESETS) {
wantRestart = gfxPlatform::FallbackFromAcceleration(
gfxPlatform::DisableWebRender(
gfx::FeatureStatus::Unavailable, "Device resets exceeded threshold",
"FEATURE_FAILURE_WEBRENDER_EXCESSIVE_RESETS"_ns);
} else {
MOZ_ASSERT_UNREACHABLE("Invalid value");
wantRestart = gfxPlatform::FallbackFromAcceleration(
gfx::FeatureStatus::Unavailable, "Unhandled failure reason",
"FEATURE_FAILURE_WEBRENDER_UNHANDLED"_ns);
gfxPlatform::DisableWebRender(gfx::FeatureStatus::Unavailable,
"Unhandled failure reason",
"FEATURE_FAILURE_WEBRENDER_UNHANDLED"_ns);
}
gfx::gfxVars::SetUseWebRenderDCompVideoOverlayWin(false);
// If we still have the GPU process, and we fallback to a new configuration
// that prefers to have the GPU process, reset the counter.
if (wantRestart && mProcess) {
mNumProcessAttempts = 1;
}
#if defined(MOZ_WIDGET_ANDROID)
// If aError is not wr::WebRenderError::INITIALIZE, nsWindow does not
// re-create LayerManager. Needs to trigger re-creating LayerManager on
@ -505,6 +488,14 @@ bool GPUProcessManager::DisableWebRenderConfig(wr::WebRenderError aError,
if (aError != wr::WebRenderError::INITIALIZE) {
NotifyDisablingWebRender();
}
#elif defined(MOZ_WIDGET_GTK)
// Hardware compositing should be disabled by default if we aren't using
// WebRender. We had to check if it is enabled at all, because it may
// already have been forced disabled (e.g. safe mode, headless). It may
// still be forced on by the user, and if so, this should have no effect.
gfxConfig::SetFailed(Feature::HW_COMPOSITING, FeatureStatus::Blocked,
"Acceleration blocked by platform",
"FEATURE_FAILURE_LOST_WEBRENDER"_ns);
#endif
return true;
@ -514,11 +505,10 @@ void GPUProcessManager::DisableWebRender(wr::WebRenderError aError,
const nsCString& aMsg) {
if (DisableWebRenderConfig(aError, aMsg)) {
if (mProcess) {
RebuildRemoteSessions();
OnRemoteProcessDeviceReset(mProcess);
} else {
RebuildInProcessSessions();
OnInProcessDeviceReset(/* aTrackThreshold */ false);
}
NotifyListenersOnCompositeDeviceReset();
}
}
@ -594,6 +584,17 @@ void GPUProcessManager::OnRemoteProcessDeviceReset(GPUProcessHost* aHost) {
NotifyListenersOnCompositeDeviceReset();
}
void GPUProcessManager::FallbackToSoftware(const char* aMessage) {
gfxConfig::SetFailed(Feature::HW_COMPOSITING, FeatureStatus::Blocked,
aMessage, "GPU_PROCESS_FALLBACK_TO_SOFTWARE"_ns);
#ifdef XP_WIN
gfxConfig::SetFailed(Feature::D3D11_COMPOSITING, FeatureStatus::Blocked,
aMessage, "GPU_PROCESS_FALLBACK_TO_SOFTWARE"_ns);
gfxConfig::SetFailed(Feature::DIRECT2D, FeatureStatus::Blocked, aMessage,
"GPU_PROCESS_FALLBACK_TO_SOFTWARE"_ns);
#endif
}
void GPUProcessManager::NotifyListenersOnCompositeDeviceReset() {
for (const auto& listener : mListeners) {
listener->OnCompositorDeviceReset();
@ -615,11 +616,7 @@ void GPUProcessManager::OnProcessUnexpectedShutdown(GPUProcessHost* aHost) {
char disableMessage[64];
SprintfLiteral(disableMessage, "GPU process disabled after %d attempts",
mNumProcessAttempts);
if (!MaybeDisableGPUProcess(disableMessage, /* aAllowRestart */ true)) {
// Fallback wants the GPU process. Reset our counter.
mNumProcessAttempts = 0;
HandleProcessLost();
}
DisableGPUProcess(disableMessage);
} else if (mNumProcessAttempts >
uint32_t(StaticPrefs::
layers_gpu_process_max_restarts_with_decoder()) &&

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

@ -239,11 +239,6 @@ class GPUProcessManager final : public GPUProcessHost::Listener {
// Permanently disable the GPU process and record a message why.
void DisableGPUProcess(const char* aMessage);
// May permanently disable the GPU process and record a message why. May
// return false if the fallback process decided we should retry the GPU
// process, but only if aAllowRestart is also true.
bool MaybeDisableGPUProcess(const char* aMessage, bool aAllowRestart);
// Shutdown the GPU process.
void CleanShutdown();
void DestroyProcess();

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

@ -3367,93 +3367,27 @@ void gfxPlatform::NotifyCompositorCreated(LayersBackend aBackend) {
}
/* static */
bool gfxPlatform::FallbackFromAcceleration(FeatureStatus aStatus,
const char* aMessage,
const nsACString& aFailureId) {
// We always want to ensure (Hardware) WebRender is disabled.
void gfxPlatform::DisableWebRender(FeatureStatus aStatus, const char* aMessage,
const nsACString& aFailureId) {
if (gfxConfig::IsEnabled(Feature::WEBRENDER)) {
gfxConfig::GetFeature(Feature::WEBRENDER)
.ForceDisable(aStatus, aMessage, aFailureId);
}
#ifdef XP_WIN
// Before we disable D3D11 and HW_COMPOSITING, we should check if we can
// fallback from WebRender to Software WebRender + D3D11 compositing.
if (StaticPrefs::gfx_webrender_fallback_software_d3d11_AtStartup() &&
gfxConfig::IsEnabled(Feature::WEBRENDER_SOFTWARE) &&
gfxConfig::IsEnabled(Feature::D3D11_COMPOSITING) &&
gfxVars::UseWebRender() && !gfxVars::UseSoftwareWebRender()) {
// Fallback to Software WebRender + D3D11 compositing.
gfxCriticalNote << "Fallback WR to SW-WR + D3D11";
gfxVars::SetUseSoftwareWebRender(true);
return true;
}
// We aren't using Software WebRender + D3D11 compositing, so turn off the
// D3D11 and D2D.
if (gfxConfig::IsEnabled(Feature::D3D11_COMPOSITING)) {
gfxConfig::GetFeature(Feature::D3D11_COMPOSITING)
// TODO(aosmond): When WebRender Software replaces Basic, we must not disable
// it because of GPU process crashes, etc.
if (gfxConfig::IsEnabled(Feature::WEBRENDER_SOFTWARE)) {
gfxConfig::GetFeature(Feature::WEBRENDER_SOFTWARE)
.ForceDisable(aStatus, aMessage, aFailureId);
}
if (gfxConfig::IsEnabled(Feature::DIRECT2D)) {
gfxConfig::GetFeature(Feature::DIRECT2D)
.ForceDisable(aStatus, aMessage, aFailureId);
}
#endif
#ifndef MOZ_WIDGET_ANDROID
// Non-Android wants to fallback to Software WebRender or Basic. Android wants
// to fallback to OpenGL.
if (gfxConfig::IsEnabled(Feature::HW_COMPOSITING)) {
gfxConfig::GetFeature(Feature::HW_COMPOSITING)
.ForceDisable(aStatus, aMessage, aFailureId);
}
#endif
if (!gfxVars::UseWebRender()) {
// We were not using WebRender in the first place, and we have disabled
// all forms of accelerated compositing.
return false;
}
if (StaticPrefs::gfx_webrender_fallback_software_AtStartup() &&
gfxConfig::IsEnabled(Feature::WEBRENDER_SOFTWARE) &&
!gfxVars::UseSoftwareWebRender()) {
// Fallback from WebRender to Software WebRender.
gfxCriticalNote << "Fallback WR to SW-WR";
gfxVars::SetUseSoftwareWebRender(true);
return true;
}
if (StaticPrefs::gfx_webrender_fallback_basic_AtStartup()) {
// Fallback from WebRender or Software WebRender to Basic.
gfxCriticalNote << "Fallback (SW-)WR to Basic";
if (gfxConfig::IsEnabled(Feature::WEBRENDER_SOFTWARE)) {
gfxConfig::GetFeature(Feature::WEBRENDER_SOFTWARE)
.ForceDisable(aStatus, aMessage, aFailureId);
}
gfxVars::SetUseWebRender(false);
gfxVars::SetUseSoftwareWebRender(false);
return false;
}
// Continue using Software WebRender.
gfxCriticalNoteOnce << "Fallback remains SW-WR";
MOZ_ASSERT(gfxVars::UseWebRender());
MOZ_ASSERT(gfxVars::UseSoftwareWebRender());
return false;
gfxVars::SetUseWebRender(false);
gfxVars::SetUseSoftwareWebRender(false);
}
/* static */
void gfxPlatform::DisableGPUProcess() {
void gfxPlatform::NotifyGPUProcessDisabled() {
DisableWebRender(FeatureStatus::Unavailable, "GPU Process is disabled",
"FEATURE_FAILURE_GPU_PROCESS_DISABLED"_ns);
gfxVars::SetRemoteCanvasEnabled(false);
if (gfxVars::UseWebRender()) {
// We need to initialize the parent process to prepare for WebRender if we
// did not end up disabling it, despite losing the GPU process.
wr::RenderThread::Start();
image::ImageMemoryReporter::InitForWebRender();
}
}
void gfxPlatform::FetchAndImportContentDeviceData() {

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

@ -733,7 +733,7 @@ class gfxPlatform : public mozilla::layers::MemoryPressureListener {
*/
static bool PerfWarnings();
static void DisableGPUProcess();
static void NotifyGPUProcessDisabled();
void NotifyCompositorCreated(mozilla::layers::LayersBackend aBackend);
mozilla::layers::LayersBackend GetCompositorBackend() const {
@ -791,10 +791,9 @@ class gfxPlatform : public mozilla::layers::MemoryPressureListener {
static const char* WebRenderResourcePathOverride();
// Returns true if we would like to keep the GPU process if possible.
static bool FallbackFromAcceleration(mozilla::gfx::FeatureStatus aStatus,
const char* aMessage,
const nsACString& aFailureId);
static void DisableWebRender(mozilla::gfx::FeatureStatus aStatus,
const char* aMessage,
const nsACString& aFailureId);
void NotifyFrameStats(nsTArray<mozilla::layers::FrameStats>&& aFrameStats);

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

@ -234,9 +234,8 @@ void RenderThread::RemoveRenderer(wr::WindowId aWindowId) {
mRenderers.erase(aWindowId);
if (mRenderers.empty()) {
if (mRenderers.size() == 0 && mHandlingDeviceReset) {
mHandlingDeviceReset = false;
mHandlingWebRenderError = false;
}
auto windows = mWindowInfos.Lock();

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

@ -4684,26 +4684,6 @@
value: true
mirror: once
# Whether or not to fallback from WebRender/WebRender Software to Basic.
- name: gfx.webrender.fallback.basic
type: bool
value: true
mirror: once
# Whether or not to fallback from WebRender to Software WebRender.
- name: gfx.webrender.fallback.software
type: bool
value: @IS_NIGHTLY_BUILD@
mirror: once
#ifdef XP_WIN
# Whether or not to fallback from WebRender to Software WebRender + D3D11.
- name: gfx.webrender.fallback.software-d3d11
type: bool
value: @IS_NIGHTLY_BUILD@
mirror: once
#endif
- name: gfx.webrender.use-optimized-shaders
type: bool
value: true