Commit 8f797ab2 authored by Eric Karl's avatar Eric Karl Committed by Commit Bot

Android OOP-D: Recreate Surface on Failure

This is the OOP-D counterpart to:
https://chromium-review.googlesource.com/c/chromium/src/+/1244106

A previous patch added a callback to handle context creation failures.
This patch now adds the surface error workaround, causing us to
recreate our surface on a surface error.

Bug: 787086
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: I9c283f3b4052afcfe865b4564220d779aca24b88
Reviewed-on: https://chromium-review.googlesource.com/c/1257658
Commit-Queue: Eric Karl <ericrk@chromium.org>
Reviewed-by: default avatarBo <boliu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#597285}
parent db49e76b
...@@ -1144,14 +1144,9 @@ void CompositorImpl::OnGpuChannelEstablished( ...@@ -1144,14 +1144,9 @@ void CompositorImpl::OnGpuChannelEstablished(
requires_alpha_channel_), requires_alpha_channel_),
ws::command_buffer_metrics::ContextType::BROWSER_COMPOSITOR); ws::command_buffer_metrics::ContextType::BROWSER_COMPOSITOR);
auto result = context_provider->BindToCurrentThread(); auto result = context_provider->BindToCurrentThread();
LOG_IF(FATAL, result == gpu::ContextResult::kFatalFailure)
<< "Fatal error making Gpu context";
if (result == gpu::ContextResult::kSurfaceFailure) {
SetSurface(nullptr);
client_->RecreateSurface();
}
if (result != gpu::ContextResult::kSuccess) { if (result != gpu::ContextResult::kSuccess) {
if (gpu::IsFatalOrSurfaceFailure(result))
OnFatalOrSurfaceContextCreationFailure(result);
HandlePendingLayerTreeFrameSinkRequest(); HandlePendingLayerTreeFrameSinkRequest();
return; return;
} }
...@@ -1431,8 +1426,14 @@ viz::LocalSurfaceId CompositorImpl::GenerateLocalSurfaceId() const { ...@@ -1431,8 +1426,14 @@ viz::LocalSurfaceId CompositorImpl::GenerateLocalSurfaceId() const {
void CompositorImpl::OnFatalOrSurfaceContextCreationFailure( void CompositorImpl::OnFatalOrSurfaceContextCreationFailure(
gpu::ContextResult context_result) { gpu::ContextResult context_result) {
DCHECK(gpu::IsFatalOrSurfaceFailure(context_result));
LOG_IF(FATAL, context_result == gpu::ContextResult::kFatalFailure) LOG_IF(FATAL, context_result == gpu::ContextResult::kFatalFailure)
<< "Fatal error making Gpu context"; << "Fatal error making Gpu context";
if (context_result == gpu::ContextResult::kSurfaceFailure) {
SetSurface(nullptr);
client_->RecreateSurface();
}
} }
} // namespace content } // namespace content
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