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() { ...@@ -344,6 +344,11 @@ void GpuDataManagerImpl::FallBackToNextGpuMode() {
private_->FallBackToNextGpuMode(); private_->FallBackToNextGpuMode();
} }
bool GpuDataManagerImpl::CanFallback() const {
base::AutoLock auto_lock(lock_);
return private_->CanFallback();
}
bool GpuDataManagerImpl::IsGpuProcessUsingHardwareGpu() const { bool GpuDataManagerImpl::IsGpuProcessUsingHardwareGpu() const {
base::AutoLock auto_lock(lock_); base::AutoLock auto_lock(lock_);
return private_->IsGpuProcessUsingHardwareGpu(); return private_->IsGpuProcessUsingHardwareGpu();
......
...@@ -164,6 +164,9 @@ class CONTENT_EXPORT GpuDataManagerImpl : public GpuDataManager, ...@@ -164,6 +164,9 @@ class CONTENT_EXPORT GpuDataManagerImpl : public GpuDataManager,
// on Android and Chrome OS. // on Android and Chrome OS.
void FallBackToNextGpuMode(); 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 // Returns false if the latest GPUInfo gl_renderer is from SwiftShader or
// Disabled (in the viz case). // Disabled (in the viz case).
bool IsGpuProcessUsingHardwareGpu() const; bool IsGpuProcessUsingHardwareGpu() const;
......
...@@ -121,6 +121,8 @@ class CONTENT_EXPORT GpuDataManagerImplPrivate { ...@@ -121,6 +121,8 @@ class CONTENT_EXPORT GpuDataManagerImplPrivate {
gpu::GpuMode GetGpuMode() const; gpu::GpuMode GetGpuMode() const;
void FallBackToNextGpuMode(); void FallBackToNextGpuMode();
bool CanFallback() const { return !fallback_modes_.empty(); }
bool IsGpuProcessUsingHardwareGpu() const; bool IsGpuProcessUsingHardwareGpu() const;
void SetApplicationVisible(bool is_visible); void SetApplicationVisible(bool is_visible);
......
...@@ -1012,8 +1012,10 @@ void GpuProcessHost::DidInitialize( ...@@ -1012,8 +1012,10 @@ void GpuProcessHost::DidInitialize(
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
// Android may kill the GPU process to free memory, especially when the app // 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. // 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
recent_crash_count_ = 0; // fallback option is available.
if (!GpuDataManagerImpl::GetInstance()->CanFallback())
recent_crash_count_ = 0;
#endif #endif
} }
...@@ -1027,8 +1029,10 @@ void GpuProcessHost::DidCreateContextSuccessfully() { ...@@ -1027,8 +1029,10 @@ void GpuProcessHost::DidCreateContextSuccessfully() {
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
// Android may kill the GPU process to free memory, especially when the app // 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. // 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
recent_crash_count_ = 0; // fallback option is available.
if (!GpuDataManagerImpl::GetInstance()->CanFallback())
recent_crash_count_ = 0;
#endif #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