Commit fd03adc3 authored by Jonathan Backer's avatar Jonathan Backer Committed by Commit Bot

exit_on_context_lost when using Vulkan

Ideally we would tear down and recreate a new VkDevice on
VK_ERROR_DEVICE_LOST. Until we can do that, we should restart the GPU
process to do that for us.

Bug: 1095744, 1095057
Change-Id: Ib89411e4715b797d8df53572ece4431467d65837
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2249721
Commit-Queue: Jonathan Backer <backer@chromium.org>
Reviewed-by: default avatarPeng Huang <penghuang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#779642}
parent bd8ece60
......@@ -119,6 +119,21 @@ class GpuWatchdogInit {
GpuWatchdogThread* watchdog_ptr_ = nullptr;
};
// TODO(https://crbug.com/1095744): We currently do not handle
// VK_ERROR_DEVICE_LOST in in-process-gpu.
void DisableInProcessGpuVulkan(GpuFeatureInfo* gpu_feature_info,
GpuPreferences* gpu_preferences) {
if (gpu_feature_info->status_values[GPU_FEATURE_TYPE_VULKAN] ==
kGpuFeatureStatusEnabled) {
LOG(ERROR) << "Vulkan not supported with in process gpu";
gpu_preferences->use_vulkan = VulkanImplementationName::kNone;
gpu_feature_info->status_values[GPU_FEATURE_TYPE_VULKAN] =
kGpuFeatureStatusDisabled;
if (gpu_preferences->gr_context_type == GrContextType::kVulkan)
gpu_preferences->gr_context_type = GrContextType::kGL;
}
}
} // namespace
GpuInit::GpuInit() = default;
......@@ -432,6 +447,12 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandLine* command_line,
#endif
gpu_preferences_.gr_context_type = GrContextType::kGL;
}
} else {
// TODO(https://crbug.com/1095744): It would be better to cleanly tear
// down and recreate the VkDevice on VK_ERROR_DEVICE_LOST. Until that
// happens, we will exit_on_context_lost to ensure there are no leaks.
gpu_feature_info_.enabled_gpu_driver_bug_workarounds.push_back(
EXIT_ON_CONTEXT_LOST);
}
// Collect GPU process info
......@@ -561,16 +582,7 @@ void GpuInit::InitializeInProcess(base::CommandLine* command_line,
InitializeGLThreadSafe(command_line, gpu_preferences_, &gpu_info_,
&gpu_feature_info_);
if (gpu_feature_info_.status_values[GPU_FEATURE_TYPE_VULKAN] !=
kGpuFeatureStatusEnabled ||
!InitializeVulkan()) {
gpu_preferences_.use_vulkan = VulkanImplementationName::kNone;
gpu_feature_info_.status_values[GPU_FEATURE_TYPE_VULKAN] =
kGpuFeatureStatusDisabled;
if (gpu_preferences_.gr_context_type == GrContextType::kVulkan)
gpu_preferences_.gr_context_type = GrContextType::kGL;
}
DisableInProcessGpuVulkan(&gpu_feature_info_, &gpu_preferences_);
default_offscreen_surface_ = gl::init::CreateOffscreenGLSurface(gfx::Size());
UMA_HISTOGRAM_ENUMERATION("GPU.GLImplementation", gl::GetGLImplementation());
......@@ -684,6 +696,8 @@ void GpuInit::InitializeInProcess(base::CommandLine* command_line,
std::move(supported_buffer_formats_for_texturing);
#endif
DisableInProcessGpuVulkan(&gpu_feature_info_, &gpu_preferences_);
UMA_HISTOGRAM_ENUMERATION("GPU.GLImplementation", gl::GetGLImplementation());
}
#endif // OS_ANDROID
......
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