Chromium Code Reviews| Index: content/browser/gpu/gpu_data_manager_impl_private.cc |
| diff --git a/content/browser/gpu/gpu_data_manager_impl_private.cc b/content/browser/gpu/gpu_data_manager_impl_private.cc |
| index bbf7231c954858ff4828b1745ea994a9b177050f..3ca5d6d34b92588c3696cc4b690a37bc994b4afb 100644 |
| --- a/content/browser/gpu/gpu_data_manager_impl_private.cc |
| +++ b/content/browser/gpu/gpu_data_manager_impl_private.cc |
| @@ -271,7 +271,7 @@ bool GpuDataManagerImplPrivate::IsFeatureBlacklisted(int feature) const { |
| return true; |
| } |
| #endif // OS_CHROMEOS |
| - if (use_swiftshader_) { |
| + if (use_swiftshader_ || gpu_info_.use_warp) { |
| // Skia's software rendering is probably more efficient than going through |
| // software emulation of the GPU, so use that. |
| if (feature == gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS) |
| @@ -287,7 +287,7 @@ bool GpuDataManagerImplPrivate::IsDriverBugWorkaroundActive(int feature) const { |
| } |
| size_t GpuDataManagerImplPrivate::GetBlacklistedFeatureCount() const { |
| - if (use_swiftshader_) |
| + if (use_swiftshader_ || gpu_info_.use_warp) |
| return 1; |
| return blacklisted_features_.size(); |
| } |
| @@ -311,7 +311,7 @@ void GpuDataManagerImplPrivate::GetGpuProcessHandles( |
| bool GpuDataManagerImplPrivate::GpuAccessAllowed( |
| std::string* reason) const { |
| - if (use_swiftshader_) |
| + if (use_swiftshader_ || gpu_info_.use_warp) |
| return true; |
| if (!gpu_process_accessible_) { |
| @@ -471,6 +471,18 @@ void GpuDataManagerImplPrivate::GetGLStrings(std::string* gl_vendor, |
| *gl_version = gpu_info_.gl_version; |
| } |
| +void GpuDataManagerImplPrivate::SetShouldUseWarp(bool use_warp) { |
| + gpu_info_.use_warp = use_warp; |
|
Zhenyao Mo
2014/08/20 21:02:09
This is incorrect. gpu_info_ could be updated mul
luken
2014/08/27 20:43:46
Deprecated code.
|
| + // Let the observers know, particularly the GpuPrefManager, so it can update |
| + // its persistent state about using warp or not. |
| + NotifyGpuInfoUpdate(); |
| +} |
| + |
| +bool GpuDataManagerImplPrivate::ShouldUseWarp() const { |
| + return gpu_info_.use_warp || |
| + base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseWarp); |
| +} |
| + |
| void GpuDataManagerImplPrivate::Initialize() { |
| TRACE_EVENT0("startup", "GpuDataManagerImpl::Initialize"); |
| if (finalized_) { |
| @@ -545,7 +557,7 @@ void GpuDataManagerImplPrivate::UpdateGpuInfoHelper() { |
| void GpuDataManagerImplPrivate::UpdateGpuInfo(const gpu::GPUInfo& gpu_info) { |
| // No further update of gpu_info if falling back to SwiftShader. |
| - if (use_swiftshader_) |
| + if (use_swiftshader_ || gpu_info_.use_warp) |
| return; |
| gpu::MergeGPUInfo(&gpu_info_, gpu_info); |
| @@ -645,6 +657,9 @@ void GpuDataManagerImplPrivate::AppendGpuCommandLine( |
| gpu_info_.driver_vendor); |
| command_line->AppendSwitchASCII(switches::kGpuDriverVersion, |
| gpu_info_.driver_version); |
| + |
| + if (ShouldUseWarp()) |
| + command_line->AppendSwitch(switches::kUseWarp); |
| } |
| void GpuDataManagerImplPrivate::AppendPluginCommandLine( |
| @@ -819,6 +834,8 @@ bool GpuDataManagerImplPrivate::UpdateActiveGpu( |
| } |
| bool GpuDataManagerImplPrivate::CanUseGpuBrowserCompositor() const { |
| + if (gpu_info_.use_warp) |
|
Zhenyao Mo
2014/08/20 21:02:09
You should use ShouldUseWarp() here to be consiste
luken
2014/08/27 20:43:46
Done.
|
| + return true; |
| if (ShouldUseSwiftShader()) |
| return false; |
| if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING)) |