Commit 48672642 authored by Xinghua Cao's avatar Xinghua Cao Committed by Commit Bot

Get correct GL context info on mesa

Driver may create a compatibility profile context when
collect graphics information on Linux platform, but
command buffer service gets a core profile context
when supports GLX_ARB_create_context, so make them
identically.
Try to collect graphics information based on core profile
context after disabling platform extensions.

BUG=867675

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: Ibf0abc1942532d6518fb7c65ebb857dc4d509171
Reviewed-on: https://chromium-review.googlesource.com/c/1247531Reviewed-by: default avatarZhenyao Mo <zmo@chromium.org>
Reviewed-by: default avatarKenneth Russell <kbr@chromium.org>
Commit-Queue: Xinghua Cao <xinghua.cao@intel.com>
Cr-Commit-Position: refs/heads/master@{#602254}
parent 8b1d5281
...@@ -265,15 +265,6 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandLine* command_line, ...@@ -265,15 +265,6 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandLine* command_line,
} }
} }
} }
if (use_swiftshader) {
AdjustInfoToSwiftShader();
}
if (kGpuFeatureStatusEnabled !=
gpu_feature_info_
.status_values[GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE]) {
gpu_preferences_.disable_accelerated_video_decode = true;
}
if (!gl_disabled) { if (!gl_disabled) {
if (!gpu_feature_info_.disabled_extensions.empty()) { if (!gpu_feature_info_.disabled_extensions.empty()) {
...@@ -292,6 +283,40 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandLine* command_line, ...@@ -292,6 +283,40 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandLine* command_line,
} }
} }
#if defined(OS_LINUX)
// Driver may create a compatibility profile context when collect graphics
// information on Linux platform. Try to collect graphics information
// based on core profile context after disabling platform extensions.
if (!gl_disabled && !use_swiftshader) {
if (!CollectGraphicsInfo(&gpu_info_, gpu_preferences_))
return false;
gpu::SetKeysForCrashLogging(gpu_info_);
gpu_feature_info_ = gpu::ComputeGpuFeatureInfo(gpu_info_, gpu_preferences_,
command_line, nullptr);
use_swiftshader = EnableSwiftShaderIfNeeded(
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;
}
}
}
#endif // defined(OS_LINUX)
if (use_swiftshader) {
AdjustInfoToSwiftShader();
}
if (kGpuFeatureStatusEnabled !=
gpu_feature_info_
.status_values[GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE]) {
gpu_preferences_.disable_accelerated_video_decode = true;
}
base::TimeDelta initialize_one_off_time = base::TimeDelta initialize_one_off_time =
base::TimeTicks::Now() - before_initialize_one_off; base::TimeTicks::Now() - before_initialize_one_off;
UMA_HISTOGRAM_MEDIUM_TIMES("GPU.InitializeOneOffMediumTime", UMA_HISTOGRAM_MEDIUM_TIMES("GPU.InitializeOneOffMediumTime",
...@@ -419,9 +444,6 @@ void GpuInit::InitializeInProcess(base::CommandLine* command_line, ...@@ -419,9 +444,6 @@ void GpuInit::InitializeInProcess(base::CommandLine* command_line,
} }
} }
} }
if (use_swiftshader) {
AdjustInfoToSwiftShader();
}
if (!gl_disabled) { if (!gl_disabled) {
if (!gpu_feature_info_.disabled_extensions.empty()) { if (!gpu_feature_info_.disabled_extensions.empty()) {
...@@ -437,6 +459,32 @@ void GpuInit::InitializeInProcess(base::CommandLine* command_line, ...@@ -437,6 +459,32 @@ void GpuInit::InitializeInProcess(base::CommandLine* command_line,
VLOG(1) << "gl::init::CreateOffscreenGLSurface failed"; VLOG(1) << "gl::init::CreateOffscreenGLSurface failed";
} }
} }
#if defined(OS_LINUX)
// Driver may create a compatibility profile context when collect graphics
// information on Linux platform. Try to collect graphics information
// based on core profile context after disabling platform extensions.
if (!gl_disabled && !use_swiftshader) {
CollectContextGraphicsInfo(&gpu_info_, gpu_preferences_);
gpu_feature_info_ = ComputeGpuFeatureInfo(gpu_info_, gpu_preferences_,
command_line, nullptr);
use_swiftshader = EnableSwiftShaderIfNeeded(
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 failed "
<< "with SwiftShader";
return;
}
}
}
#endif // defined(OS_LINUX)
if (use_swiftshader) {
AdjustInfoToSwiftShader();
}
} }
#endif // OS_ANDROID #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