diff options
-rw-r--r-- | content/browser/gpu/gpu_data_manager_impl.cc | 4 | ||||
-rw-r--r-- | content/common/gpu/gpu_messages.h | 1 | ||||
-rw-r--r-- | content/gpu/gpu_main.cc | 12 | ||||
-rw-r--r-- | content/public/common/gpu_info.cc | 1 | ||||
-rw-r--r-- | content/public/common/gpu_info.h | 3 |
5 files changed, 21 insertions, 0 deletions
diff --git a/content/browser/gpu/gpu_data_manager_impl.cc b/content/browser/gpu/gpu_data_manager_impl.cc index a230e03..695543e 100644 --- a/content/browser/gpu/gpu_data_manager_impl.cc +++ b/content/browser/gpu/gpu_data_manager_impl.cc @@ -161,6 +161,9 @@ bool GpuDataManagerImpl::GpuAccessAllowed() { if (software_rendering_) return true; + if (!gpu_info_.gpu_accessible) + return false; + // We only need to block GPU process if more features are disallowed other // than those in the preliminary gpu feature flags because the latter work // through renderer commandline switches. @@ -380,6 +383,7 @@ bool GpuDataManagerImpl::Merge(content::GPUInfo* object, } object->can_lose_context = other.can_lose_context; object->software_rendering = other.software_rendering; + object->gpu_accessible = other.gpu_accessible; #if defined(OS_WIN) if (object->dx_diagnostics.values.size() == 0 && object->dx_diagnostics.children.size() == 0) { diff --git a/content/common/gpu/gpu_messages.h b/content/common/gpu/gpu_messages.h index 09d1c74..fe05f08 100644 --- a/content/common/gpu/gpu_messages.h +++ b/content/common/gpu/gpu_messages.h @@ -117,6 +117,7 @@ IPC_STRUCT_TRAITS_BEGIN(content::GPUInfo) IPC_STRUCT_TRAITS_MEMBER(gl_renderer) IPC_STRUCT_TRAITS_MEMBER(gl_extensions) IPC_STRUCT_TRAITS_MEMBER(can_lose_context) + IPC_STRUCT_TRAITS_MEMBER(gpu_accessible) IPC_STRUCT_TRAITS_MEMBER(performance_stats) IPC_STRUCT_TRAITS_MEMBER(software_rendering) #if defined(OS_WIN) diff --git a/content/gpu/gpu_main.cc b/content/gpu/gpu_main.cc index 898c753..09fce82 100644 --- a/content/gpu/gpu_main.cc +++ b/content/gpu/gpu_main.cc @@ -81,10 +81,22 @@ int GpuMain(const content::MainFunctionParams& parameters) { LOG(INFO) << "gpu_info_collector::CollectGraphicsInfo failed"; } +#if defined(OS_LINUX) + if (gpu_info.vendor_id == 0x10de) { // NVIDIA + base::ThreadRestrictions::AssertIOAllowed(); + if (access("/dev/nvidiactl", R_OK) != 0) { + LOG(INFO) << "NVIDIA device file /dev/nvidiactl access denied"; + gpu_info.gpu_accessible = false; + dead_on_arrival = true; + } + } +#endif + // Set the GPU info even if it failed. content::GetContentClient()->SetGpuInfo(gpu_info); } else { LOG(INFO) << "gfx::GLSurface::InitializeOneOff failed"; + gpu_info.gpu_accessible = false; dead_on_arrival = true; } diff --git a/content/public/common/gpu_info.cc b/content/public/common/gpu_info.cc index d7b1e35..552db8b 100644 --- a/content/public/common/gpu_info.cc +++ b/content/public/common/gpu_info.cc @@ -12,6 +12,7 @@ GPUInfo::GPUInfo() vendor_id(0), device_id(0), can_lose_context(false), + gpu_accessible(true), software_rendering(false) { } diff --git a/content/public/common/gpu_info.h b/content/public/common/gpu_info.h index 01dfadb..085878c 100644 --- a/content/public/common/gpu_info.h +++ b/content/public/common/gpu_info.h @@ -76,6 +76,9 @@ struct CONTENT_EXPORT GPUInfo { // semantics are available. bool can_lose_context; + // Whether gpu or driver is accessible. + bool gpu_accessible; + // By default all values are 0. GpuPerformanceStats performance_stats; |