Commit fa018c93 authored by kylechar's avatar kylechar Committed by Commit Bot

Ensure contexts are lost before exiting GPU process.

This CL switches the order notifying all contexts about context loss and
restarting the GPU process for the exit_on_context_lost GPU driver bug
workaround. This will ensure the contexts are lost before the process
exists.

Also add an early out so no new GPU channels are created while the GPU
process is exiting. There is no point in creating new GPU channels at
this point as it can only cause problems.

Bug: 1011420
Change-Id: I10294074cc9f2f087124f1cb68fedf22ed364a3e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1866408
Commit-Queue: kylechar <kylechar@chromium.org>
Reviewed-by: default avatarJonathan Backer <backer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#707390}
parent 95d3767a
......@@ -727,13 +727,22 @@ void GpuServiceImpl::EstablishGpuChannel(int32_t client_id,
bool is_gpu_host,
bool cache_shaders_on_disk,
EstablishGpuChannelCallback callback) {
if (gpu::IsReservedClientId(client_id)) {
// This returns a null handle, which is treated by the client as a failure
// case.
std::move(callback).Run(mojo::ScopedMessagePipeHandle());
return;
}
// This should always be called on the IO thread first.
if (io_runner_->BelongsToCurrentThread()) {
if (IsExiting()) {
// We are already exiting so there is no point in responding. Close the
// receiver so we can safely drop the callback.
bindings_->CloseAllBindings();
return;
}
if (gpu::IsReservedClientId(client_id)) {
// This returns a null handle, which is treated by the client as a failure
// case.
std::move(callback).Run(mojo::ScopedMessagePipeHandle());
return;
}
EstablishGpuChannelCallback wrap_callback = base::BindOnce(
[](scoped_refptr<base::SingleThreadTaskRunner> runner,
EstablishGpuChannelCallback cb,
......
......@@ -892,16 +892,16 @@ void InProcessCommandBuffer::OnParseError() {
GpuDriverBugWorkarounds workarounds(
GetGpuFeatureInfo().enabled_gpu_driver_bug_workarounds);
// Work around issues with recovery by allowing a new GPU process to
// launch.
if (workarounds.exit_on_context_lost)
gpu_channel_manager_delegate_->MaybeExitOnContextLost();
// Lose all other contexts.
if (gl::GLContext::LosesAllContextsOnContextLost() ||
(context_state_ && context_state_->use_virtualized_gl_contexts())) {
gpu_channel_manager_delegate_->LoseAllContexts();
}
// Work around issues with recovery by allowing a new GPU process to
// launch.
if (workarounds.exit_on_context_lost)
gpu_channel_manager_delegate_->MaybeExitOnContextLost();
}
}
}
......
......@@ -516,16 +516,16 @@ void GpuChannelManager::OnContextLost(bool synthetic_loss) {
if (synthetic_loss)
return;
// Work around issues with recovery by allowing a new GPU process to launch.
if (gpu_driver_bug_workarounds_.exit_on_context_lost)
delegate_->MaybeExitOnContextLost();
// Lose all other contexts.
if (gl::GLContext::LosesAllContextsOnContextLost() ||
(shared_context_state_ &&
shared_context_state_->use_virtualized_gl_contexts())) {
delegate_->LoseAllContexts();
}
// Work around issues with recovery by allowing a new GPU process to launch.
if (gpu_driver_bug_workarounds_.exit_on_context_lost)
delegate_->MaybeExitOnContextLost();
}
void GpuChannelManager::ScheduleGrContextCleanup() {
......
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