OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/gpu/gpu_data_manager_impl.h" | 5 #include "content/browser/gpu/gpu_data_manager_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| 11 #include "base/metrics/field_trial.h" |
11 #include "base/stringprintf.h" | 12 #include "base/stringprintf.h" |
12 #include "base/sys_info.h" | 13 #include "base/sys_info.h" |
13 #include "base/values.h" | 14 #include "base/values.h" |
14 #include "base/version.h" | 15 #include "base/version.h" |
15 #include "content/browser/gpu/gpu_process_host.h" | 16 #include "content/browser/gpu/gpu_process_host.h" |
16 #include "content/browser/gpu/gpu_util.h" | 17 #include "content/browser/gpu/gpu_util.h" |
17 #include "content/common/gpu/gpu_messages.h" | 18 #include "content/common/gpu/gpu_messages.h" |
18 #include "content/gpu/gpu_info_collector.h" | 19 #include "content/gpu/gpu_info_collector.h" |
19 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
20 #include "content/public/browser/gpu_data_manager_observer.h" | 21 #include "content/public/browser/gpu_data_manager_observer.h" |
21 #include "content/public/common/content_client.h" | 22 #include "content/public/common/content_client.h" |
| 23 #include "content/public/common/content_constants.h" |
22 #include "content/public/common/content_switches.h" | 24 #include "content/public/common/content_switches.h" |
23 #include "ui/base/ui_base_switches.h" | 25 #include "ui/base/ui_base_switches.h" |
24 #include "ui/gl/gl_implementation.h" | 26 #include "ui/gl/gl_implementation.h" |
25 #include "ui/gl/gl_switches.h" | 27 #include "ui/gl/gl_switches.h" |
26 #include "webkit/plugins/plugin_switches.h" | 28 #include "webkit/plugins/plugin_switches.h" |
27 | 29 |
28 #if defined(OS_WIN) | 30 #if defined(OS_WIN) |
29 #include "base/win/windows_version.h" | 31 #include "base/win/windows_version.h" |
30 #endif | 32 #endif |
31 | 33 |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 void GpuDataManagerImpl::NotifyGpuInfoUpdate() { | 378 void GpuDataManagerImpl::NotifyGpuInfoUpdate() { |
377 observer_list_->Notify(&GpuDataManagerObserver::OnGpuInfoUpdate); | 379 observer_list_->Notify(&GpuDataManagerObserver::OnGpuInfoUpdate); |
378 } | 380 } |
379 | 381 |
380 void GpuDataManagerImpl::UpdateVideoMemoryUsageStats( | 382 void GpuDataManagerImpl::UpdateVideoMemoryUsageStats( |
381 const content::GPUVideoMemoryUsageStats& video_memory_usage_stats) { | 383 const content::GPUVideoMemoryUsageStats& video_memory_usage_stats) { |
382 observer_list_->Notify(&GpuDataManagerObserver::OnVideoMemoryUsageStatsUpdate, | 384 observer_list_->Notify(&GpuDataManagerObserver::OnVideoMemoryUsageStatsUpdate, |
383 video_memory_usage_stats); | 385 video_memory_usage_stats); |
384 } | 386 } |
385 | 387 |
| 388 // Experiment to determine whether Stage3D should be blacklisted on XP. |
| 389 bool Stage3DBlacklisted() { |
| 390 return base::FieldTrialList::FindFullName(content::kStage3DFieldTrialName) == |
| 391 content::kStage3DFieldTrialBlacklistedName; |
| 392 } |
| 393 |
386 void GpuDataManagerImpl::UpdateBlacklistedFeatures( | 394 void GpuDataManagerImpl::UpdateBlacklistedFeatures( |
387 GpuFeatureType features) { | 395 GpuFeatureType features) { |
388 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 396 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
389 int flags = features; | 397 int flags = features; |
390 | 398 |
391 // Force disable using the GPU for these features, even if they would | 399 // Force disable using the GPU for these features, even if they would |
392 // otherwise be allowed. | 400 // otherwise be allowed. |
393 if (card_blacklisted_ || | 401 if (card_blacklisted_ || |
394 command_line->HasSwitch(switches::kBlacklistAcceleratedCompositing)) { | 402 command_line->HasSwitch(switches::kBlacklistAcceleratedCompositing)) { |
395 flags |= content::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING; | 403 flags |= content::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING; |
396 } | 404 } |
397 if (card_blacklisted_ || | 405 if (card_blacklisted_ || |
398 command_line->HasSwitch(switches::kBlacklistWebGL)) { | 406 command_line->HasSwitch(switches::kBlacklistWebGL)) { |
399 flags |= content::GPU_FEATURE_TYPE_WEBGL; | 407 flags |= content::GPU_FEATURE_TYPE_WEBGL; |
400 } | 408 } |
| 409 if (Stage3DBlacklisted()) { |
| 410 flags |= content::GPU_FEATURE_TYPE_FLASH_STAGE3D; |
| 411 } |
401 gpu_feature_type_ = static_cast<GpuFeatureType>(flags); | 412 gpu_feature_type_ = static_cast<GpuFeatureType>(flags); |
402 | 413 |
403 EnableSoftwareRenderingIfNecessary(); | 414 EnableSoftwareRenderingIfNecessary(); |
404 } | 415 } |
405 | 416 |
406 void GpuDataManagerImpl::RegisterSwiftShaderPath(const FilePath& path) { | 417 void GpuDataManagerImpl::RegisterSwiftShaderPath(const FilePath& path) { |
407 swiftshader_path_ = path; | 418 swiftshader_path_ = path; |
408 EnableSoftwareRenderingIfNecessary(); | 419 EnableSoftwareRenderingIfNecessary(); |
409 } | 420 } |
410 | 421 |
(...skipping 15 matching lines...) Expand all Loading... |
426 | 437 |
427 void GpuDataManagerImpl::BlacklistCard() { | 438 void GpuDataManagerImpl::BlacklistCard() { |
428 card_blacklisted_ = true; | 439 card_blacklisted_ = true; |
429 | 440 |
430 gpu_feature_type_ = content::GPU_FEATURE_TYPE_ALL; | 441 gpu_feature_type_ = content::GPU_FEATURE_TYPE_ALL; |
431 | 442 |
432 EnableSoftwareRenderingIfNecessary(); | 443 EnableSoftwareRenderingIfNecessary(); |
433 NotifyGpuInfoUpdate(); | 444 NotifyGpuInfoUpdate(); |
434 } | 445 } |
435 | 446 |
OLD | NEW |