Commit 229973fe authored by Sean Gilhuly's avatar Sean Gilhuly Committed by Commit Bot

Don't reset crash count if a fallback option is available

Vulkan to GL fallback doesn't work on Android if the crashes occur after
successful initialization or context creation. These events reset the
GPU crash count to account for the GPU process being killed to free up
memory.

Instead, avoid resetting the crash count if there is at least one
fallback option available.

Bug: 1142914
Change-Id: I865bb8551a41f74e9779fe7b89c0d9f184820439
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2510375Reviewed-by: default avatarJonathan Backer <backer@chromium.org>
Commit-Queue: Sean Gilhuly <sgilhuly@chromium.org>
Cr-Commit-Position: refs/heads/master@{#825922}
parent b8b65994
......@@ -344,6 +344,11 @@ void GpuDataManagerImpl::FallBackToNextGpuMode() {
private_->FallBackToNextGpuMode();
}
bool GpuDataManagerImpl::CanFallback() const {
base::AutoLock auto_lock(lock_);
return private_->CanFallback();
}
bool GpuDataManagerImpl::IsGpuProcessUsingHardwareGpu() const {
base::AutoLock auto_lock(lock_);
return private_->IsGpuProcessUsingHardwareGpu();
......
......@@ -164,6 +164,9 @@ class CONTENT_EXPORT GpuDataManagerImpl : public GpuDataManager,
// on Android and Chrome OS.
void FallBackToNextGpuMode();
// Check if there is at least one fallback option available.
bool CanFallback() const;
// Returns false if the latest GPUInfo gl_renderer is from SwiftShader or
// Disabled (in the viz case).
bool IsGpuProcessUsingHardwareGpu() const;
......
......@@ -121,6 +121,8 @@ class CONTENT_EXPORT GpuDataManagerImplPrivate {
gpu::GpuMode GetGpuMode() const;
void FallBackToNextGpuMode();
bool CanFallback() const { return !fallback_modes_.empty(); }
bool IsGpuProcessUsingHardwareGpu() const;
void SetApplicationVisible(bool is_visible);
......
......@@ -1012,7 +1012,9 @@ void GpuProcessHost::DidInitialize(
#if defined(OS_ANDROID)
// Android may kill the GPU process to free memory, especially when the app
// is the background, so Android cannot have a hard limit on GPU starts.
// Reset crash count on Android when context creation succeeds.
// Reset crash count on Android when context creation succeeds, but only if no
// fallback option is available.
if (!GpuDataManagerImpl::GetInstance()->CanFallback())
recent_crash_count_ = 0;
#endif
}
......@@ -1027,7 +1029,9 @@ void GpuProcessHost::DidCreateContextSuccessfully() {
#if defined(OS_ANDROID)
// Android may kill the GPU process to free memory, especially when the app
// is the background, so Android cannot have a hard limit on GPU starts.
// Reset crash count on Android when context creation succeeds.
// Reset crash count on Android when context creation succeeds, but only if no
// fallback option is available.
if (!GpuDataManagerImpl::GetInstance()->CanFallback())
recent_crash_count_ = 0;
#endif
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment