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

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

Issue 10909221: Implement blacklist's force GPU capability in dual GPU machines. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 3 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 #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"
(...skipping 30 matching lines...) Expand all
41 41
42 // static 42 // static
43 GpuDataManagerImpl* GpuDataManagerImpl::GetInstance() { 43 GpuDataManagerImpl* GpuDataManagerImpl::GetInstance() {
44 return Singleton<GpuDataManagerImpl>::get(); 44 return Singleton<GpuDataManagerImpl>::get();
45 } 45 }
46 46
47 GpuDataManagerImpl::GpuDataManagerImpl() 47 GpuDataManagerImpl::GpuDataManagerImpl()
48 : complete_gpu_info_already_requested_(false), 48 : complete_gpu_info_already_requested_(false),
49 gpu_feature_type_(content::GPU_FEATURE_TYPE_UNKNOWN), 49 gpu_feature_type_(content::GPU_FEATURE_TYPE_UNKNOWN),
50 preliminary_gpu_feature_type_(content::GPU_FEATURE_TYPE_UNKNOWN), 50 preliminary_gpu_feature_type_(content::GPU_FEATURE_TYPE_UNKNOWN),
51 gpu_switching_(content::GPU_SWITCHING_AUTOMATIC), 51 gpu_switching_(content::GPU_SWITCHING_OPTION_AUTOMATIC),
52 observer_list_(new GpuDataManagerObserverList), 52 observer_list_(new GpuDataManagerObserverList),
53 software_rendering_(false), 53 software_rendering_(false),
54 card_blacklisted_(false), 54 card_blacklisted_(false),
55 update_histograms_(true) { 55 update_histograms_(true) {
56 CommandLine* command_line = CommandLine::ForCurrentProcess(); 56 CommandLine* command_line = CommandLine::ForCurrentProcess();
57 if (command_line->HasSwitch(switches::kDisableAcceleratedCompositing)) { 57 if (command_line->HasSwitch(switches::kDisableAcceleratedCompositing)) {
58 command_line->AppendSwitch(switches::kDisableAccelerated2dCanvas); 58 command_line->AppendSwitch(switches::kDisableAccelerated2dCanvas);
59 command_line->AppendSwitch(switches::kDisableAcceleratedLayers); 59 command_line->AppendSwitch(switches::kDisableAcceleratedLayers);
60 } 60 }
61 if (command_line->HasSwitch(switches::kDisableGpu)) 61 if (command_line->HasSwitch(switches::kDisableGpu))
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 swiftshader_path = swiftshader_path_; 292 swiftshader_path = swiftshader_path_;
293 } else if ((flags & (content::GPU_FEATURE_TYPE_WEBGL | 293 } else if ((flags & (content::GPU_FEATURE_TYPE_WEBGL |
294 content::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING | 294 content::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING |
295 content::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS)) && 295 content::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS)) &&
296 (use_gl == "any")) { 296 (use_gl == "any")) {
297 command_line->AppendSwitchASCII( 297 command_line->AppendSwitchASCII(
298 switches::kUseGL, gfx::kGLImplementationOSMesaName); 298 switches::kUseGL, gfx::kGLImplementationOSMesaName);
299 } else if (!use_gl.empty()) { 299 } else if (!use_gl.empty()) {
300 command_line->AppendSwitchASCII(switches::kUseGL, use_gl); 300 command_line->AppendSwitchASCII(switches::kUseGL, use_gl);
301 } 301 }
302 switch (gpu_switching_) {
303 case content::GPU_SWITCHING_OPTION_FORCE_DISCRETE:
304 command_line->AppendSwitchASCII(switches::kGpuSwitching,
305 kGpuSwitchingOptionNameForceDiscrete);
306 break;
307 case content::GPU_SWITCHING_OPTION_FORCE_INTEGRATED:
308 command_line->AppendSwitchASCII(switches::kGpuSwitching,
309 kGpuSwitchingOptionNameForceIntegrated);
310 break;
311 default:
312 break;
313 }
302 314
303 if (!swiftshader_path.empty()) 315 if (!swiftshader_path.empty())
304 command_line->AppendSwitchPath(switches::kSwiftShaderPath, 316 command_line->AppendSwitchPath(switches::kSwiftShaderPath,
305 swiftshader_path); 317 swiftshader_path);
306 318
307 { 319 {
308 base::AutoLock auto_lock(gpu_info_lock_); 320 base::AutoLock auto_lock(gpu_info_lock_);
309 if (gpu_info_.optimus) 321 if (gpu_info_.optimus)
310 command_line->AppendSwitch(switches::kReduceGpuSandbox); 322 command_line->AppendSwitch(switches::kReduceGpuSandbox);
311 if (gpu_info_.amd_switchable) { 323 if (gpu_info_.amd_switchable) {
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 438
427 void GpuDataManagerImpl::BlacklistCard() { 439 void GpuDataManagerImpl::BlacklistCard() {
428 card_blacklisted_ = true; 440 card_blacklisted_ = true;
429 441
430 gpu_feature_type_ = content::GPU_FEATURE_TYPE_ALL; 442 gpu_feature_type_ = content::GPU_FEATURE_TYPE_ALL;
431 443
432 EnableSoftwareRenderingIfNecessary(); 444 EnableSoftwareRenderingIfNecessary();
433 NotifyGpuInfoUpdate(); 445 NotifyGpuInfoUpdate();
434 } 446 }
435 447
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698