Skip to content

Commit

Permalink
viz: Disable GPUInfo collection when GL is disabled.
Browse files Browse the repository at this point in the history
When running the GPU process for the OOP-D display compositor with GL
disabled don't collect GPUInfo. This matches the behaviour without OOP-D
where there GPU process isn't even started.

We are seeing the GPU process crashes with OOP-D before the browser gets
a GPUInfo object back and this may be the cause.

Bug: 852863
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: I2e8ff1e99742cd360017c7d675b0b954de32b2d7
Reviewed-on: https://chromium-review.googlesource.com/1112340
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Commit-Queue: kylechar <kylechar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#570017}
  • Loading branch information
kylechar authored and Commit Bot committed Jun 25, 2018
1 parent 2141bfe commit b12bef3
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 23 deletions.
6 changes: 5 additions & 1 deletion components/viz/service/main/viz_main_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,11 @@ void VizMainImpl::CreateGpuService(
mojo::ScopedSharedBufferHandle activity_flags,
gfx::FontRenderParams::SubpixelRendering subpixel_rendering) {
DCHECK(gpu_thread_task_runner_->BelongsToCurrentThread());
gpu_service_->UpdateGPUInfo();

// If GL is disabled then don't try to collect GPUInfo, we're not using GPU.
if (gl::GetGLImplementation() != gl::kGLImplementationDisabled)
gpu_service_->UpdateGPUInfo();

for (const LogMessage& log : log_messages_)
gpu_host->RecordLogMessage(log.severity, log.header, log.message);
log_messages_.clear();
Expand Down
18 changes: 14 additions & 4 deletions gpu/config/gpu_info_collector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,20 @@ namespace gpu {

bool CollectBasicGraphicsInfo(const base::CommandLine* command_line,
GPUInfo* gpu_info) {
const char* software_gl_impl_name =
std::string use_gl = command_line->GetSwitchValueASCII(switches::kUseGL);

// If GL is disabled then we don't need GPUInfo.
if (use_gl == gl::kGLImplementationDisabledName) {
gpu_info->gl_vendor = "Disabled";
gpu_info->gl_renderer = "Disabled";
gpu_info->gl_version = "Disabled";

return true;
}

base::StringPiece software_gl_impl_name =
gl::GetGLImplementationName(gl::GetSoftwareGLImplementation());
if ((command_line->GetSwitchValueASCII(switches::kUseGL) ==
software_gl_impl_name) ||
if (use_gl == software_gl_impl_name ||
command_line->HasSwitch(switches::kOverrideUseSoftwareGLForTests)) {
// If using the software GL implementation, use fake vendor and
// device ids to make sure it never gets blacklisted. It allows us
Expand All @@ -154,7 +164,7 @@ bool CollectBasicGraphicsInfo(const base::CommandLine* command_line,
// Also declare the driver_vendor to be <software GL> to be able to
// specify exceptions based on driver_vendor==<software GL> for some
// blacklist rules.
gpu_info->gpu.driver_vendor = software_gl_impl_name;
gpu_info->gpu.driver_vendor = software_gl_impl_name.as_string();

return true;
}
Expand Down
7 changes: 3 additions & 4 deletions gpu/config/gpu_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -325,16 +325,15 @@ GpuFeatureInfo ComputeGpuFeatureInfo(const GPUInfo& gpu_info,
bool* needs_more_info) {
DCHECK(!needs_more_info || !(*needs_more_info));
bool use_swift_shader = false;
bool use_swift_shader_for_webgl = false;
if (command_line->HasSwitch(switches::kUseGL)) {
std::string use_gl = command_line->GetSwitchValueASCII(switches::kUseGL);
if (use_gl == gl::kGLImplementationSwiftShaderName)
use_swift_shader = true;
else if (use_gl == gl::kGLImplementationSwiftShaderForWebGLName)
use_swift_shader_for_webgl = true;
return ComputeGpuFeatureInfoForSwiftShader();
else if (use_gl == gl::kGLImplementationDisabledName)
return ComputeGpuFeatureInfoWithNoGpu();
}
if (use_swift_shader_for_webgl)
return ComputeGpuFeatureInfoForSwiftShader();

GpuFeatureInfo gpu_feature_info;
std::set<int> blacklisted_features;
Expand Down
13 changes: 0 additions & 13 deletions gpu/ipc/service/gpu_init.cc
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,6 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandLine* command_line,
}
if (use_swiftshader) {
AdjustInfoToSwiftShader();
} else if (gl_disabled) {
AdjustInfoToNoGpu();
}

if (kGpuFeatureStatusEnabled !=
Expand Down Expand Up @@ -373,8 +371,6 @@ void GpuInit::InitializeInProcess(base::CommandLine* command_line,
}
if (use_swiftshader) {
AdjustInfoToSwiftShader();
} else if (gl_disabled) {
AdjustInfoToNoGpu();
}

if (!gl_disabled) {
Expand All @@ -396,13 +392,4 @@ void GpuInit::AdjustInfoToSwiftShader() {
CollectContextGraphicsInfo(&gpu_info_, gpu_preferences_);
}

void GpuInit::AdjustInfoToNoGpu() {
gpu_info_for_hardware_gpu_ = gpu_info_;
gpu_feature_info_for_hardware_gpu_ = gpu_feature_info_;
gpu_feature_info_ = ComputeGpuFeatureInfoWithNoGpu();
gpu_info_.gl_vendor = "Disabled";
gpu_info_.gl_renderer = "Disabled";
gpu_info_.gl_version = "Disabled";
}

} // namespace gpu
1 change: 0 additions & 1 deletion gpu/ipc/service/gpu_init.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ class GPU_IPC_SERVICE_EXPORT GpuInit {
base::Optional<GpuFeatureInfo> gpu_feature_info_for_hardware_gpu_;

void AdjustInfoToSwiftShader();
void AdjustInfoToNoGpu();

DISALLOW_COPY_AND_ASSIGN(GpuInit);
};
Expand Down

0 comments on commit b12bef3

Please sign in to comment.