Commit 889e0ce7 authored by Zhenyao Mo's avatar Zhenyao Mo Committed by Commit Bot

Exit GPU process to fallback to SwiftShader cleanly on Linux

There is no clean way to shut down GLX, so it's best to fail GPU
process launch. In GpuProcessHost::DidFailInitialize(), we will
fallback to the next mode, which is SwiftShader, right away.

BUG=971169
TEST=manual
R=piman@chromium.org

Change-Id: I615c2a9a956b081f48dbbfa1d7ba4768dd363f4d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1707986
Commit-Queue: Zhenyao Mo <zmo@chromium.org>
Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
Reviewed-by: default avatarKenneth Russell <kbr@chromium.org>
Reviewed-by: default avatarSunny Sachanandani <sunnyps@chromium.org>
Cr-Commit-Position: refs/heads/master@{#678944}
parent 20dd6e85
......@@ -302,19 +302,22 @@ class GpuProcessIntegrationTest(gpu_integration_test.GpuIntegrationTest):
return
else:
pass
feature_status_for_hardware_gpu_list = self.tab.EvaluateJavaScript(
'browserBridge.gpuInfo.featureStatusForHardwareGpu.featureStatus')
for name, status in feature_status_for_hardware_gpu_list.items():
if name == 'webgl':
if status != 'unavailable_off':
self.fail('WebGL status for hardware GPU failed: %s' % status)
return
elif name == '2d_canvas':
if status != 'enabled':
self.fail('2D Canvas status for hardware GPU failed: %s' % status)
return
else:
pass
if not sys.platform.startswith('linux'):
# On Linux we relaunch GPU process to fallback to SwiftShader, therefore
# featureStatusForHardwareGpu isn't available.
feature_status_for_hardware_gpu_list = self.tab.EvaluateJavaScript(
'browserBridge.gpuInfo.featureStatusForHardwareGpu.featureStatus')
for name, status in feature_status_for_hardware_gpu_list.items():
if name == 'webgl':
if status != 'unavailable_off':
self.fail('WebGL status for hardware GPU failed: %s' % status)
return
elif name == '2d_canvas':
if status != 'enabled':
self.fail('2D Canvas status for hardware GPU failed: %s' % status)
return
else:
pass
def _GpuProcess_one_extra_workaround(self, test_path):
# Start this test by launching the browser with no command line
......
......@@ -284,8 +284,14 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandLine* command_line,
}
if (gl_initialized && use_swiftshader &&
gl::GetGLImplementation() != gl::kGLImplementationSwiftShaderGL) {
#if defined(OS_LINUX)
VLOG(1) << "Quit GPU process launch to fallback to SwiftShader cleanly "
<< "on Linux";
return false;
#else
gl::init::ShutdownGL(true);
gl_initialized = false;
#endif // OS_LINUX
}
if (!gl_initialized)
gl_initialized = gl::init::InitializeGLNoExtensionsOneOff();
......@@ -311,12 +317,18 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandLine* command_line,
command_line, gpu_feature_info_,
gpu_preferences_.disable_software_rasterizer, false);
if (use_swiftshader) {
#if defined(OS_LINUX)
VLOG(1) << "Quit GPU process launch to fallback to SwiftShader cleanly "
<< "on Linux";
return false;
#else
gl::init::ShutdownGL(true);
if (!gl::init::InitializeGLNoExtensionsOneOff()) {
VLOG(1) << "gl::init::InitializeGLNoExtensionsOneOff with SwiftShader "
<< "failed";
return false;
}
#endif // OS_LINUX
}
}
......@@ -359,12 +371,9 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandLine* command_line,
command_line, gpu_feature_info_,
gpu_preferences_.disable_software_rasterizer, false);
if (use_swiftshader) {
gl::init::ShutdownGL(true);
if (!gl::init::InitializeGLNoExtensionsOneOff()) {
VLOG(1) << "gl::init::InitializeGLNoExtensionsOneOff with SwiftShader "
<< "failed";
return false;
}
VLOG(1) << "Quit GPU process launch to fallback to SwiftShader cleanly "
<< "on Linux";
return false;
}
}
#endif // defined(OS_LINUX)
......
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