Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(537)

Side by Side Diff: content/browser/gpu/gpu_data_manager_impl.cc

Issue 14146011: Renamed 'software_rendering' to 'swiftshader' to differentiate from (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #if defined(OS_MACOSX) 7 #if defined(OS_MACOSX)
8 #include <ApplicationServices/ApplicationServices.h> 8 #include <ApplicationServices/ApplicationServices.h>
9 #endif // OS_MACOSX 9 #endif // OS_MACOSX
10 10
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 void GpuDataManagerImpl::InitializeForTesting( 114 void GpuDataManagerImpl::InitializeForTesting(
115 const std::string& gpu_blacklist_json, 115 const std::string& gpu_blacklist_json,
116 const GPUInfo& gpu_info) { 116 const GPUInfo& gpu_info) {
117 // This function is for testing only, so disable histograms. 117 // This function is for testing only, so disable histograms.
118 update_histograms_ = false; 118 update_histograms_ = false;
119 119
120 InitializeImpl(gpu_blacklist_json, std::string(), std::string(), gpu_info); 120 InitializeImpl(gpu_blacklist_json, std::string(), std::string(), gpu_info);
121 } 121 }
122 122
123 bool GpuDataManagerImpl::IsFeatureBlacklisted(int feature) const { 123 bool GpuDataManagerImpl::IsFeatureBlacklisted(int feature) const {
124 if (software_rendering_) { 124 if (use_swiftshader_) {
125 // Skia's software rendering is probably more efficient than going through 125 // Skia's software rendering is probably more efficient than going through
126 // software emulation of the GPU, so use that. 126 // software emulation of the GPU, so use that.
127 if (feature == GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS) 127 if (feature == GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS)
128 return true; 128 return true;
129 return false; 129 return false;
130 } 130 }
131 131
132 return (blacklisted_features_.count(feature) == 1); 132 return (blacklisted_features_.count(feature) == 1);
133 } 133 }
134 134
135 size_t GpuDataManagerImpl::GetBlacklistedFeatureCount() const { 135 size_t GpuDataManagerImpl::GetBlacklistedFeatureCount() const {
136 if (software_rendering_) 136 if (use_swiftshader_)
137 return 1; 137 return 1;
138 return blacklisted_features_.size(); 138 return blacklisted_features_.size();
139 } 139 }
140 140
141 void GpuDataManagerImpl::AddGpuSwitchCallback( 141 void GpuDataManagerImpl::AddGpuSwitchCallback(
142 const GpuSwitchCallback& callback) { 142 const GpuSwitchCallback& callback) {
143 gpu_switch_callbacks_.push_back(callback); 143 gpu_switch_callbacks_.push_back(callback);
144 } 144 }
145 145
146 void GpuDataManagerImpl::RemoveGpuSwitchCallback( 146 void GpuDataManagerImpl::RemoveGpuSwitchCallback(
(...skipping 14 matching lines...) Expand all
161 } 161 }
162 return gpu_info; 162 return gpu_info;
163 } 163 }
164 164
165 void GpuDataManagerImpl::GetGpuProcessHandles( 165 void GpuDataManagerImpl::GetGpuProcessHandles(
166 const GetGpuProcessHandlesCallback& callback) const { 166 const GetGpuProcessHandlesCallback& callback) const {
167 GpuProcessHost::GetProcessHandles(callback); 167 GpuProcessHost::GetProcessHandles(callback);
168 } 168 }
169 169
170 bool GpuDataManagerImpl::GpuAccessAllowed() const { 170 bool GpuDataManagerImpl::GpuAccessAllowed() const {
171 if (software_rendering_) 171 if (use_swiftshader_)
172 return true; 172 return true;
173 173
174 if (!gpu_info_.gpu_accessible) 174 if (!gpu_info_.gpu_accessible)
175 return false; 175 return false;
176 176
177 if (card_blacklisted_) 177 if (card_blacklisted_)
178 return false; 178 return false;
179 179
180 // We only need to block GPU process if more features are disallowed other 180 // We only need to block GPU process if more features are disallowed other
181 // than those in the preliminary gpu feature flags because the latter work 181 // than those in the preliminary gpu feature flags because the latter work
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 return gpu_info_.finalized; 218 return gpu_info_.finalized;
219 } 219 }
220 220
221 void GpuDataManagerImpl::RequestVideoMemoryUsageStatsUpdate() const { 221 void GpuDataManagerImpl::RequestVideoMemoryUsageStatsUpdate() const {
222 GpuProcessHost::SendOnIO( 222 GpuProcessHost::SendOnIO(
223 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, 223 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED,
224 CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH, 224 CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH,
225 new GpuMsg_GetVideoMemoryUsageStats()); 225 new GpuMsg_GetVideoMemoryUsageStats());
226 } 226 }
227 227
228 bool GpuDataManagerImpl::ShouldUseSoftwareRendering() const { 228 bool GpuDataManagerImpl::ShouldUseSwiftShader() const {
229 return software_rendering_; 229 return use_swiftshader_;
230 } 230 }
231 231
232 void GpuDataManagerImpl::RegisterSwiftShaderPath(const base::FilePath& path) { 232 void GpuDataManagerImpl::RegisterSwiftShaderPath(const base::FilePath& path) {
233 swiftshader_path_ = path; 233 swiftshader_path_ = path;
234 EnableSoftwareRenderingIfNecessary(); 234 EnableSwiftShaderIfNecessary();
235 } 235 }
236 236
237 void GpuDataManagerImpl::AddObserver(GpuDataManagerObserver* observer) { 237 void GpuDataManagerImpl::AddObserver(GpuDataManagerObserver* observer) {
238 observer_list_->AddObserver(observer); 238 observer_list_->AddObserver(observer);
239 } 239 }
240 240
241 void GpuDataManagerImpl::RemoveObserver(GpuDataManagerObserver* observer) { 241 void GpuDataManagerImpl::RemoveObserver(GpuDataManagerObserver* observer) {
242 observer_list_->RemoveObserver(observer); 242 observer_list_->RemoveObserver(observer);
243 } 243 }
244 244
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 IDR_GPU_DRIVER_BUG_LIST, ui::SCALE_FACTOR_NONE); 341 IDR_GPU_DRIVER_BUG_LIST, ui::SCALE_FACTOR_NONE);
342 gpu_driver_bug_list_string = gpu_driver_bug_list_json.as_string(); 342 gpu_driver_bug_list_string = gpu_driver_bug_list_json.as_string();
343 } 343 }
344 InitializeImpl(gpu_blacklist_string, 344 InitializeImpl(gpu_blacklist_string,
345 gpu_switching_list_string, 345 gpu_switching_list_string,
346 gpu_driver_bug_list_string, 346 gpu_driver_bug_list_string,
347 gpu_info); 347 gpu_info);
348 } 348 }
349 349
350 void GpuDataManagerImpl::UpdateGpuInfo(const GPUInfo& gpu_info) { 350 void GpuDataManagerImpl::UpdateGpuInfo(const GPUInfo& gpu_info) {
351 // No further update of gpu_info if falling back to software renderer. 351 // No further update of gpu_info if falling back to SwiftShader.
352 if (software_rendering_) 352 if (use_swiftshader_)
353 return; 353 return;
354 354
355 GPUInfo my_gpu_info; 355 GPUInfo my_gpu_info;
356 { 356 {
357 base::AutoLock auto_lock(gpu_info_lock_); 357 base::AutoLock auto_lock(gpu_info_lock_);
358 gpu_info_collector::MergeGPUInfo(&gpu_info_, gpu_info); 358 gpu_info_collector::MergeGPUInfo(&gpu_info_, gpu_info);
359 complete_gpu_info_already_requested_ = 359 complete_gpu_info_already_requested_ =
360 complete_gpu_info_already_requested_ || gpu_info_.finalized; 360 complete_gpu_info_already_requested_ || gpu_info_.finalized;
361 my_gpu_info = gpu_info_; 361 my_gpu_info = gpu_info_;
362 } 362 }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 command_line->AppendSwitch(switches::kDisableGLMultisampling); 412 command_line->AppendSwitch(switches::kDisableGLMultisampling);
413 if (IsFeatureBlacklisted(GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING) && 413 if (IsFeatureBlacklisted(GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING) &&
414 !command_line->HasSwitch(switches::kDisableAcceleratedCompositing)) 414 !command_line->HasSwitch(switches::kDisableAcceleratedCompositing))
415 command_line->AppendSwitch(switches::kDisableAcceleratedCompositing); 415 command_line->AppendSwitch(switches::kDisableAcceleratedCompositing);
416 if (IsFeatureBlacklisted(GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS) && 416 if (IsFeatureBlacklisted(GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS) &&
417 !command_line->HasSwitch(switches::kDisableAccelerated2dCanvas)) 417 !command_line->HasSwitch(switches::kDisableAccelerated2dCanvas))
418 command_line->AppendSwitch(switches::kDisableAccelerated2dCanvas); 418 command_line->AppendSwitch(switches::kDisableAccelerated2dCanvas);
419 if (IsFeatureBlacklisted(GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE) && 419 if (IsFeatureBlacklisted(GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE) &&
420 !command_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) 420 !command_line->HasSwitch(switches::kDisableAcceleratedVideoDecode))
421 command_line->AppendSwitch(switches::kDisableAcceleratedVideoDecode); 421 command_line->AppendSwitch(switches::kDisableAcceleratedVideoDecode);
422 if (ShouldUseSoftwareRendering()) 422 if (ShouldUseSwiftShader())
423 command_line->AppendSwitch(switches::kDisableFlashFullscreen3d); 423 command_line->AppendSwitch(switches::kDisableFlashFullscreen3d);
424 } 424 }
425 425
426 void GpuDataManagerImpl::AppendGpuCommandLine( 426 void GpuDataManagerImpl::AppendGpuCommandLine(
427 CommandLine* command_line) const { 427 CommandLine* command_line) const {
428 DCHECK(command_line); 428 DCHECK(command_line);
429 429
430 std::string use_gl = 430 std::string use_gl =
431 CommandLine::ForCurrentProcess()->GetSwitchValueASCII(switches::kUseGL); 431 CommandLine::ForCurrentProcess()->GetSwitchValueASCII(switches::kUseGL);
432 base::FilePath swiftshader_path = 432 base::FilePath swiftshader_path =
433 CommandLine::ForCurrentProcess()->GetSwitchValuePath( 433 CommandLine::ForCurrentProcess()->GetSwitchValuePath(
434 switches::kSwiftShaderPath); 434 switches::kSwiftShaderPath);
435 if (IsFeatureBlacklisted(GPU_FEATURE_TYPE_MULTISAMPLING) && 435 if (IsFeatureBlacklisted(GPU_FEATURE_TYPE_MULTISAMPLING) &&
436 !command_line->HasSwitch(switches::kDisableGLMultisampling)) 436 !command_line->HasSwitch(switches::kDisableGLMultisampling))
437 command_line->AppendSwitch(switches::kDisableGLMultisampling); 437 command_line->AppendSwitch(switches::kDisableGLMultisampling);
438 if (IsFeatureBlacklisted(GPU_FEATURE_TYPE_TEXTURE_SHARING)) 438 if (IsFeatureBlacklisted(GPU_FEATURE_TYPE_TEXTURE_SHARING))
439 command_line->AppendSwitch(switches::kDisableImageTransportSurface); 439 command_line->AppendSwitch(switches::kDisableImageTransportSurface);
440 440
441 if (software_rendering_) { 441 if (use_swiftshader_) {
442 command_line->AppendSwitchASCII(switches::kUseGL, "swiftshader"); 442 command_line->AppendSwitchASCII(switches::kUseGL, "swiftshader");
443 if (swiftshader_path.empty()) 443 if (swiftshader_path.empty())
444 swiftshader_path = swiftshader_path_; 444 swiftshader_path = swiftshader_path_;
445 } else if ((IsFeatureBlacklisted(GPU_FEATURE_TYPE_WEBGL) || 445 } else if ((IsFeatureBlacklisted(GPU_FEATURE_TYPE_WEBGL) ||
446 IsFeatureBlacklisted(GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING) || 446 IsFeatureBlacklisted(GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING) ||
447 IsFeatureBlacklisted(GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS)) && 447 IsFeatureBlacklisted(GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS)) &&
448 (use_gl == "any")) { 448 (use_gl == "any")) {
449 command_line->AppendSwitchASCII( 449 command_line->AppendSwitchASCII(
450 switches::kUseGL, gfx::kGLImplementationOSMesaName); 450 switches::kUseGL, gfx::kGLImplementationOSMesaName);
451 } else if (!use_gl.empty()) { 451 } else if (!use_gl.empty()) {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 switches::kDisableCoreAnimationPlugins)) 531 switches::kDisableCoreAnimationPlugins))
532 command_line->AppendSwitch( 532 command_line->AppendSwitch(
533 switches::kDisableCoreAnimationPlugins); 533 switches::kDisableCoreAnimationPlugins);
534 } 534 }
535 #endif 535 #endif
536 } 536 }
537 537
538 void GpuDataManagerImpl::UpdateRendererWebPrefs( 538 void GpuDataManagerImpl::UpdateRendererWebPrefs(
539 webkit_glue::WebPreferences* prefs) const { 539 webkit_glue::WebPreferences* prefs) const {
540 DCHECK(prefs); 540 DCHECK(prefs);
541
541 if (IsFeatureBlacklisted(GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING)) 542 if (IsFeatureBlacklisted(GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING))
542 prefs->accelerated_compositing_enabled = false; 543 prefs->accelerated_compositing_enabled = false;
543 if (IsFeatureBlacklisted(GPU_FEATURE_TYPE_WEBGL)) 544 if (IsFeatureBlacklisted(GPU_FEATURE_TYPE_WEBGL))
544 prefs->experimental_webgl_enabled = false; 545 prefs->experimental_webgl_enabled = false;
545 if (IsFeatureBlacklisted(GPU_FEATURE_TYPE_FLASH3D)) 546 if (IsFeatureBlacklisted(GPU_FEATURE_TYPE_FLASH3D))
546 prefs->flash_3d_enabled = false; 547 prefs->flash_3d_enabled = false;
547 if (IsFeatureBlacklisted(GPU_FEATURE_TYPE_FLASH_STAGE3D)) { 548 if (IsFeatureBlacklisted(GPU_FEATURE_TYPE_FLASH_STAGE3D)) {
548 prefs->flash_stage3d_enabled = false; 549 prefs->flash_stage3d_enabled = false;
549 prefs->flash_stage3d_baseline_enabled = false; 550 prefs->flash_stage3d_baseline_enabled = false;
550 } 551 }
551 if (IsFeatureBlacklisted(GPU_FEATURE_TYPE_FLASH_STAGE3D_BASELINE)) 552 if (IsFeatureBlacklisted(GPU_FEATURE_TYPE_FLASH_STAGE3D_BASELINE))
552 prefs->flash_stage3d_baseline_enabled = false; 553 prefs->flash_stage3d_baseline_enabled = false;
553 if (IsFeatureBlacklisted(GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS)) 554 if (IsFeatureBlacklisted(GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS))
554 prefs->accelerated_2d_canvas_enabled = false; 555 prefs->accelerated_2d_canvas_enabled = false;
555 if (IsFeatureBlacklisted(GPU_FEATURE_TYPE_MULTISAMPLING)) 556 if (IsFeatureBlacklisted(GPU_FEATURE_TYPE_MULTISAMPLING))
556 prefs->gl_multisampling_enabled = false; 557 prefs->gl_multisampling_enabled = false;
557 if (IsFeatureBlacklisted(GPU_FEATURE_TYPE_3D_CSS)) { 558 if (IsFeatureBlacklisted(GPU_FEATURE_TYPE_3D_CSS)) {
558 prefs->accelerated_compositing_for_3d_transforms_enabled = false; 559 prefs->accelerated_compositing_for_3d_transforms_enabled = false;
559 prefs->accelerated_compositing_for_animation_enabled = false; 560 prefs->accelerated_compositing_for_animation_enabled = false;
560 } 561 }
561 if (IsFeatureBlacklisted(GPU_FEATURE_TYPE_ACCELERATED_VIDEO)) 562 if (IsFeatureBlacklisted(GPU_FEATURE_TYPE_ACCELERATED_VIDEO))
562 prefs->accelerated_compositing_for_video_enabled = false; 563 prefs->accelerated_compositing_for_video_enabled = false;
563 564
564 // Accelerated video and animation are slower than regular when using a 565 // Accelerated video and animation are slower than regular when using
565 // software 3d rasterizer. 3D CSS may also be too slow to be worthwhile. 566 // SwiftShader. 3D CSS may also be too slow to be worthwhile.
566 if (ShouldUseSoftwareRendering()) { 567 if (ShouldUseSwiftShader()) {
567 prefs->accelerated_compositing_for_video_enabled = false; 568 prefs->accelerated_compositing_for_video_enabled = false;
568 prefs->accelerated_compositing_for_animation_enabled = false; 569 prefs->accelerated_compositing_for_animation_enabled = false;
569 prefs->accelerated_compositing_for_3d_transforms_enabled = false; 570 prefs->accelerated_compositing_for_3d_transforms_enabled = false;
570 prefs->accelerated_compositing_for_plugins_enabled = false; 571 prefs->accelerated_compositing_for_plugins_enabled = false;
571 } 572 }
572 } 573 }
573 574
574 GpuSwitchingOption GpuDataManagerImpl::GetGpuSwitchingOption() const { 575 GpuSwitchingOption GpuDataManagerImpl::GetGpuSwitchingOption() const {
575 if (!ui::GpuSwitchingManager::GetInstance()->SupportsDualGpus()) 576 if (!ui::GpuSwitchingManager::GetInstance()->SupportsDualGpus())
576 return GPU_SWITCHING_OPTION_UNKNOWN; 577 return GPU_SWITCHING_OPTION_UNKNOWN;
577 return gpu_switching_; 578 return gpu_switching_;
578 } 579 }
579 580
580 void GpuDataManagerImpl::DisableHardwareAcceleration() { 581 void GpuDataManagerImpl::DisableHardwareAcceleration() {
581 card_blacklisted_ = true; 582 card_blacklisted_ = true;
582 583
583 for (int i = 0; i < NUMBER_OF_GPU_FEATURE_TYPES; ++i) 584 for (int i = 0; i < NUMBER_OF_GPU_FEATURE_TYPES; ++i)
584 blacklisted_features_.insert(i); 585 blacklisted_features_.insert(i);
585 586
586 EnableSoftwareRenderingIfNecessary(); 587 EnableSwiftShaderIfNecessary();
587 NotifyGpuInfoUpdate(); 588 NotifyGpuInfoUpdate();
588 } 589 }
589 590
590 std::string GpuDataManagerImpl::GetBlacklistVersion() const { 591 std::string GpuDataManagerImpl::GetBlacklistVersion() const {
591 if (gpu_blacklist_) 592 if (gpu_blacklist_)
592 return gpu_blacklist_->version(); 593 return gpu_blacklist_->version();
593 return "0"; 594 return "0";
594 } 595 }
595 596
596 base::ListValue* GpuDataManagerImpl::GetBlacklistReasons() const { 597 base::ListValue* GpuDataManagerImpl::GetBlacklistReasons() const {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 gpu_switch_callbacks_[i].Run(); 640 gpu_switch_callbacks_[i].Run();
640 } 641 }
641 642
642 #if defined(OS_WIN) 643 #if defined(OS_WIN)
643 bool GpuDataManagerImpl::IsUsingAcceleratedSurface() const { 644 bool GpuDataManagerImpl::IsUsingAcceleratedSurface() const {
644 if (base::win::GetVersion() < base::win::VERSION_VISTA) 645 if (base::win::GetVersion() < base::win::VERSION_VISTA)
645 return false; 646 return false;
646 647
647 if (gpu_info_.amd_switchable) 648 if (gpu_info_.amd_switchable)
648 return false; 649 return false;
649 if (software_rendering_) 650 if (use_swiftshader_)
650 return false; 651 return false;
651 CommandLine* command_line = CommandLine::ForCurrentProcess(); 652 CommandLine* command_line = CommandLine::ForCurrentProcess();
652 if (command_line->HasSwitch(switches::kDisableImageTransportSurface)) 653 if (command_line->HasSwitch(switches::kDisableImageTransportSurface))
653 return false; 654 return false;
654 return !IsFeatureBlacklisted(GPU_FEATURE_TYPE_TEXTURE_SHARING); 655 return !IsFeatureBlacklisted(GPU_FEATURE_TYPE_TEXTURE_SHARING);
655 } 656 }
656 #endif 657 #endif
657 658
658 void GpuDataManagerImpl::BlockDomainFrom3DAPIs( 659 void GpuDataManagerImpl::BlockDomainFrom3DAPIs(
659 const GURL& url, DomainGuilt guilt) { 660 const GURL& url, DomainGuilt guilt) {
(...skipping 18 matching lines...) Expand all
678 } 679 }
679 680
680 void GpuDataManagerImpl::DisableDomainBlockingFor3DAPIsForTesting() { 681 void GpuDataManagerImpl::DisableDomainBlockingFor3DAPIsForTesting() {
681 domain_blocking_enabled_ = false; 682 domain_blocking_enabled_ = false;
682 } 683 }
683 684
684 GpuDataManagerImpl::GpuDataManagerImpl() 685 GpuDataManagerImpl::GpuDataManagerImpl()
685 : complete_gpu_info_already_requested_(false), 686 : complete_gpu_info_already_requested_(false),
686 gpu_switching_(GPU_SWITCHING_OPTION_AUTOMATIC), 687 gpu_switching_(GPU_SWITCHING_OPTION_AUTOMATIC),
687 observer_list_(new GpuDataManagerObserverList), 688 observer_list_(new GpuDataManagerObserverList),
688 software_rendering_(false), 689 use_swiftshader_(false),
689 card_blacklisted_(false), 690 card_blacklisted_(false),
690 update_histograms_(true), 691 update_histograms_(true),
691 window_count_(0), 692 window_count_(0),
692 domain_blocking_enabled_(true) { 693 domain_blocking_enabled_(true) {
693 CommandLine* command_line = CommandLine::ForCurrentProcess(); 694 CommandLine* command_line = CommandLine::ForCurrentProcess();
694 if (command_line->HasSwitch(switches::kDisableAcceleratedCompositing)) { 695 if (command_line->HasSwitch(switches::kDisableAcceleratedCompositing)) {
695 command_line->AppendSwitch(switches::kDisableAccelerated2dCanvas); 696 command_line->AppendSwitch(switches::kDisableAccelerated2dCanvas);
696 command_line->AppendSwitch(switches::kDisableAcceleratedLayers); 697 command_line->AppendSwitch(switches::kDisableAcceleratedLayers);
697 } 698 }
698 if (command_line->HasSwitch(switches::kDisableGpu)) 699 if (command_line->HasSwitch(switches::kDisableGpu))
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 // otherwise be allowed. 763 // otherwise be allowed.
763 if (card_blacklisted_ || 764 if (card_blacklisted_ ||
764 command_line->HasSwitch(switches::kBlacklistAcceleratedCompositing)) { 765 command_line->HasSwitch(switches::kBlacklistAcceleratedCompositing)) {
765 blacklisted_features_.insert(GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING); 766 blacklisted_features_.insert(GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING);
766 } 767 }
767 if (card_blacklisted_ || 768 if (card_blacklisted_ ||
768 command_line->HasSwitch(switches::kBlacklistWebGL)) { 769 command_line->HasSwitch(switches::kBlacklistWebGL)) {
769 blacklisted_features_.insert(GPU_FEATURE_TYPE_WEBGL); 770 blacklisted_features_.insert(GPU_FEATURE_TYPE_WEBGL);
770 } 771 }
771 772
772 EnableSoftwareRenderingIfNecessary(); 773 EnableSwiftShaderIfNecessary();
773 } 774 }
774 775
775 void GpuDataManagerImpl::UpdatePreliminaryBlacklistedFeatures() { 776 void GpuDataManagerImpl::UpdatePreliminaryBlacklistedFeatures() {
776 preliminary_blacklisted_features_ = blacklisted_features_; 777 preliminary_blacklisted_features_ = blacklisted_features_;
777 } 778 }
778 779
779 void GpuDataManagerImpl::UpdateGpuSwitchingManager(const GPUInfo& gpu_info) { 780 void GpuDataManagerImpl::UpdateGpuSwitchingManager(const GPUInfo& gpu_info) {
780 ui::GpuSwitchingManager::GetInstance()->SetGpuCount( 781 ui::GpuSwitchingManager::GetInstance()->SetGpuCount(
781 gpu_info.secondary_gpus.size() + 1); 782 gpu_info.secondary_gpus.size() + 1);
782 783
783 if (ui::GpuSwitchingManager::GetInstance()->SupportsDualGpus()) { 784 if (ui::GpuSwitchingManager::GetInstance()->SupportsDualGpus()) {
784 switch (gpu_switching_) { 785 switch (gpu_switching_) {
785 case GPU_SWITCHING_OPTION_FORCE_DISCRETE: 786 case GPU_SWITCHING_OPTION_FORCE_DISCRETE:
786 ui::GpuSwitchingManager::GetInstance()->ForceUseOfDiscreteGpu(); 787 ui::GpuSwitchingManager::GetInstance()->ForceUseOfDiscreteGpu();
787 break; 788 break;
788 case GPU_SWITCHING_OPTION_FORCE_INTEGRATED: 789 case GPU_SWITCHING_OPTION_FORCE_INTEGRATED:
789 ui::GpuSwitchingManager::GetInstance()->ForceUseOfIntegratedGpu(); 790 ui::GpuSwitchingManager::GetInstance()->ForceUseOfIntegratedGpu();
790 break; 791 break;
791 case GPU_SWITCHING_OPTION_AUTOMATIC: 792 case GPU_SWITCHING_OPTION_AUTOMATIC:
792 case GPU_SWITCHING_OPTION_UNKNOWN: 793 case GPU_SWITCHING_OPTION_UNKNOWN:
793 break; 794 break;
794 } 795 }
795 } 796 }
796 } 797 }
797 798
798 void GpuDataManagerImpl::NotifyGpuInfoUpdate() { 799 void GpuDataManagerImpl::NotifyGpuInfoUpdate() {
799 observer_list_->Notify(&GpuDataManagerObserver::OnGpuInfoUpdate); 800 observer_list_->Notify(&GpuDataManagerObserver::OnGpuInfoUpdate);
800 } 801 }
801 802
802 void GpuDataManagerImpl::EnableSoftwareRenderingIfNecessary() { 803 void GpuDataManagerImpl::EnableSwiftShaderIfNecessary() {
803 if (!GpuAccessAllowed() || 804 if (!GpuAccessAllowed() ||
804 blacklisted_features_.count(GPU_FEATURE_TYPE_WEBGL)) { 805 blacklisted_features_.count(GPU_FEATURE_TYPE_WEBGL)) {
805 if (!swiftshader_path_.empty() && 806 if (!swiftshader_path_.empty() &&
806 !CommandLine::ForCurrentProcess()->HasSwitch( 807 !CommandLine::ForCurrentProcess()->HasSwitch(
807 switches::kDisableSoftwareRasterizer)) 808 switches::kDisableSoftwareRasterizer))
808 software_rendering_ = true; 809 use_swiftshader_ = true;
809 } 810 }
810 } 811 }
811 812
812 std::string GpuDataManagerImpl::GetDomainFromURL(const GURL& url) const { 813 std::string GpuDataManagerImpl::GetDomainFromURL(const GURL& url) const {
813 // For the moment, we just use the host, or its IP address, as the 814 // For the moment, we just use the host, or its IP address, as the
814 // entry in the set, rather than trying to figure out the top-level 815 // entry in the set, rather than trying to figure out the top-level
815 // domain. This does mean that a.foo.com and b.foo.com will be 816 // domain. This does mean that a.foo.com and b.foo.com will be
816 // treated independently in the blocking of a given domain, but it 817 // treated independently in the blocking of a given domain, but it
817 // would require a third-party library to reliably figure out the 818 // would require a third-party library to reliably figure out the
818 // top-level domain from a URL. 819 // top-level domain from a URL.
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
906 907
907 void GpuDataManagerImpl::Notify3DAPIBlocked(const GURL& url, 908 void GpuDataManagerImpl::Notify3DAPIBlocked(const GURL& url,
908 int render_process_id, 909 int render_process_id,
909 int render_view_id, 910 int render_view_id,
910 ThreeDAPIType requester) { 911 ThreeDAPIType requester) {
911 observer_list_->Notify(&GpuDataManagerObserver::DidBlock3DAPIs, 912 observer_list_->Notify(&GpuDataManagerObserver::DidBlock3DAPIs,
912 url, render_process_id, render_view_id, requester); 913 url, render_process_id, render_view_id, requester);
913 } 914 }
914 915
915 } // namespace content 916 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_data_manager_impl.h ('k') | content/browser/gpu/gpu_data_manager_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698