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

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

Issue 23703017: Enable GPU control lists in tests on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more back to prior code on Mac Created 7 years, 2 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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_private.h" 5 #include "content/browser/gpu/gpu_data_manager_impl_private.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/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 }; 313 };
314 314
315 } // namespace anonymous 315 } // namespace anonymous
316 316
317 void GpuDataManagerImplPrivate::InitializeForTesting( 317 void GpuDataManagerImplPrivate::InitializeForTesting(
318 const std::string& gpu_blacklist_json, 318 const std::string& gpu_blacklist_json,
319 const gpu::GPUInfo& gpu_info) { 319 const gpu::GPUInfo& gpu_info) {
320 // This function is for testing only, so disable histograms. 320 // This function is for testing only, so disable histograms.
321 update_histograms_ = false; 321 update_histograms_ = false;
322 322
323 // Prevent all further initialization.
324 finalized_ = true;
325
323 InitializeImpl(gpu_blacklist_json, std::string(), std::string(), gpu_info); 326 InitializeImpl(gpu_blacklist_json, std::string(), std::string(), gpu_info);
324 } 327 }
325 328
326 bool GpuDataManagerImplPrivate::IsFeatureBlacklisted(int feature) const { 329 bool GpuDataManagerImplPrivate::IsFeatureBlacklisted(int feature) const {
327 #if defined(OS_CHROMEOS) 330 #if defined(OS_CHROMEOS)
328 if (feature == gpu::GPU_FEATURE_TYPE_PANEL_FITTING && 331 if (feature == gpu::GPU_FEATURE_TYPE_PANEL_FITTING &&
329 CommandLine::ForCurrentProcess()->HasSwitch( 332 CommandLine::ForCurrentProcess()->HasSwitch(
330 switches::kDisablePanelFitting)) { 333 switches::kDisablePanelFitting)) {
331 return true; 334 return true;
332 } 335 }
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 std::string* gl_version) { 529 std::string* gl_version) {
527 DCHECK(gl_vendor && gl_renderer && gl_version); 530 DCHECK(gl_vendor && gl_renderer && gl_version);
528 531
529 *gl_vendor = gpu_info_.gl_vendor; 532 *gl_vendor = gpu_info_.gl_vendor;
530 *gl_renderer = gpu_info_.gl_renderer; 533 *gl_renderer = gpu_info_.gl_renderer;
531 *gl_version = gpu_info_.gl_version_string; 534 *gl_version = gpu_info_.gl_version_string;
532 } 535 }
533 536
534 void GpuDataManagerImplPrivate::Initialize() { 537 void GpuDataManagerImplPrivate::Initialize() {
535 TRACE_EVENT0("startup", "GpuDataManagerImpl::Initialize"); 538 TRACE_EVENT0("startup", "GpuDataManagerImpl::Initialize");
536 CommandLine* command_line = CommandLine::ForCurrentProcess(); 539 if (finalized_) {
537 if (command_line->HasSwitch(switches::kSkipGpuDataLoading) && 540 DLOG(INFO) << "GpuDataManagerImpl marked as finalized; skipping Initialize";
538 !command_line->HasSwitch(switches::kUseGpuInTests)) 541 return;
542 }
543
544 const CommandLine* command_line = CommandLine::ForCurrentProcess();
545 if (command_line->HasSwitch(switches::kSkipGpuDataLoading))
539 return; 546 return;
540 547
541 gpu::GPUInfo gpu_info; 548 gpu::GPUInfo gpu_info;
542 { 549 if (command_line->GetSwitchValueASCII(
550 switches::kUseGL) == gfx::kGLImplementationOSMesaName) {
551 // If using the OSMesa GL implementation, use fake vendor and device ids to
552 // make sure it never gets blacklisted. This is better than simply
553 // cancelling GPUInfo gathering as it allows us to proceed with loading the
554 // blacklist below which may have non-device specific entries we want to
555 // apply anyways (e.g., OS version blacklisting).
556 gpu_info.gpu.vendor_id = 0xffff;
557 gpu_info.gpu.device_id = 0xffff;
558
559 // Hardcode some values otherwise some blacklisting rules in
560 // kSoftwareRenderingListJson result in a positive match as GpuControlList
561 // assumes a match (by design) when a property is required for the
562 // verification yet not present in the GpuInfo.
563 gpu_info.driver_vendor =
564 gfx::kGLImplementationOSMesaName; // Bypass rule #74.
Vangelis Kokkevis 2013/10/08 23:09:48 I think that it would be better to modify the blac
gab 2013/10/09 18:13:02 The problem is that if we leave gpu_info empty, th
565 gpu_info.driver_date = "2013.8"; // Bypass rules #12 and #55.
566 gpu_info.driver_version = "9.0.3"; // Bypass rule #23.
567 } else {
543 TRACE_EVENT0("startup", 568 TRACE_EVENT0("startup",
544 "GpuDataManagerImpl::Initialize:CollectBasicGraphicsInfo"); 569 "GpuDataManagerImpl::Initialize:CollectBasicGraphicsInfo");
545 gpu::CollectBasicGraphicsInfo(&gpu_info); 570 gpu::CollectBasicGraphicsInfo(&gpu_info);
546 } 571 }
547 #if defined(ARCH_CPU_X86_FAMILY) 572 #if defined(ARCH_CPU_X86_FAMILY)
548 if (!gpu_info.gpu.vendor_id || !gpu_info.gpu.device_id) 573 if (!gpu_info.gpu.vendor_id || !gpu_info.gpu.device_id)
549 gpu_info.finalized = true; 574 gpu_info.finalized = true;
550 #endif 575 #endif
551 576
552 std::string gpu_blacklist_string; 577 std::string gpu_blacklist_string;
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
966 gpu_switching_(gpu::GPU_SWITCHING_OPTION_AUTOMATIC), 991 gpu_switching_(gpu::GPU_SWITCHING_OPTION_AUTOMATIC),
967 observer_list_(new GpuDataManagerObserverList), 992 observer_list_(new GpuDataManagerObserverList),
968 use_swiftshader_(false), 993 use_swiftshader_(false),
969 card_blacklisted_(false), 994 card_blacklisted_(false),
970 update_histograms_(true), 995 update_histograms_(true),
971 window_count_(0), 996 window_count_(0),
972 domain_blocking_enabled_(true), 997 domain_blocking_enabled_(true),
973 owner_(owner), 998 owner_(owner),
974 display_count_(0), 999 display_count_(0),
975 gpu_process_accessible_(true), 1000 gpu_process_accessible_(true),
976 use_software_compositor_(false) { 1001 use_software_compositor_(false),
1002 finalized_(false) {
977 DCHECK(owner_); 1003 DCHECK(owner_);
978 CommandLine* command_line = CommandLine::ForCurrentProcess(); 1004 CommandLine* command_line = CommandLine::ForCurrentProcess();
979 if (command_line->HasSwitch(switches::kDisableAcceleratedCompositing)) { 1005 if (command_line->HasSwitch(switches::kDisableAcceleratedCompositing)) {
980 command_line->AppendSwitch(switches::kDisableAccelerated2dCanvas); 1006 command_line->AppendSwitch(switches::kDisableAccelerated2dCanvas);
981 command_line->AppendSwitch(switches::kDisableAcceleratedLayers); 1007 command_line->AppendSwitch(switches::kDisableAcceleratedLayers);
982 } 1008 }
983 if (command_line->HasSwitch(switches::kDisableGpu)) 1009 if (command_line->HasSwitch(switches::kDisableGpu))
984 DisableHardwareAcceleration(); 1010 DisableHardwareAcceleration();
985 if (command_line->HasSwitch(switches::kEnableSoftwareCompositing)) 1011 if (command_line->HasSwitch(switches::kEnableSoftwareCompositing))
986 use_software_compositor_ = true; 1012 use_software_compositor_ = true;
(...skipping 24 matching lines...) Expand all
1011 1037
1012 void GpuDataManagerImplPrivate::InitializeImpl( 1038 void GpuDataManagerImplPrivate::InitializeImpl(
1013 const std::string& gpu_blacklist_json, 1039 const std::string& gpu_blacklist_json,
1014 const std::string& gpu_switching_list_json, 1040 const std::string& gpu_switching_list_json,
1015 const std::string& gpu_driver_bug_list_json, 1041 const std::string& gpu_driver_bug_list_json,
1016 const gpu::GPUInfo& gpu_info) { 1042 const gpu::GPUInfo& gpu_info) {
1017 std::string browser_version_string = ProcessVersionString( 1043 std::string browser_version_string = ProcessVersionString(
1018 GetContentClient()->GetProduct()); 1044 GetContentClient()->GetProduct());
1019 CHECK(!browser_version_string.empty()); 1045 CHECK(!browser_version_string.empty());
1020 1046
1047 const bool log_gpu_control_list_decisions =
1048 CommandLine::ForCurrentProcess()->HasSwitch(
1049 switches::kLogGpuControlListDecisions);
1050
1021 if (!gpu_blacklist_json.empty()) { 1051 if (!gpu_blacklist_json.empty()) {
1022 gpu_blacklist_.reset(gpu::GpuBlacklist::Create()); 1052 gpu_blacklist_.reset(gpu::GpuBlacklist::Create());
1053 if (log_gpu_control_list_decisions)
1054 gpu_blacklist_->enable_control_list_logging("gpu_blacklist");
1023 bool success = gpu_blacklist_->LoadList( 1055 bool success = gpu_blacklist_->LoadList(
1024 browser_version_string, gpu_blacklist_json, 1056 browser_version_string, gpu_blacklist_json,
1025 gpu::GpuControlList::kCurrentOsOnly); 1057 gpu::GpuControlList::kCurrentOsOnly);
1026 DCHECK(success); 1058 DCHECK(success);
1027 } 1059 }
1028 if (!gpu_switching_list_json.empty()) { 1060 if (!gpu_switching_list_json.empty()) {
1029 gpu_switching_list_.reset(gpu::GpuSwitchingList::Create()); 1061 gpu_switching_list_.reset(gpu::GpuSwitchingList::Create());
1062 if (log_gpu_control_list_decisions)
1063 gpu_switching_list_->enable_control_list_logging("gpu_switching_list");
1030 bool success = gpu_switching_list_->LoadList( 1064 bool success = gpu_switching_list_->LoadList(
1031 browser_version_string, gpu_switching_list_json, 1065 browser_version_string, gpu_switching_list_json,
1032 gpu::GpuControlList::kCurrentOsOnly); 1066 gpu::GpuControlList::kCurrentOsOnly);
1033 DCHECK(success); 1067 DCHECK(success);
1034 } 1068 }
1035 if (!gpu_driver_bug_list_json.empty()) { 1069 if (!gpu_driver_bug_list_json.empty()) {
1036 gpu_driver_bug_list_.reset(gpu::GpuDriverBugList::Create()); 1070 gpu_driver_bug_list_.reset(gpu::GpuDriverBugList::Create());
1071 if (log_gpu_control_list_decisions)
1072 gpu_driver_bug_list_->enable_control_list_logging("gpu_driver_bug_list");
1037 bool success = gpu_driver_bug_list_->LoadList( 1073 bool success = gpu_driver_bug_list_->LoadList(
1038 browser_version_string, gpu_driver_bug_list_json, 1074 browser_version_string, gpu_driver_bug_list_json,
1039 gpu::GpuControlList::kCurrentOsOnly); 1075 gpu::GpuControlList::kCurrentOsOnly);
1040 DCHECK(success); 1076 DCHECK(success);
1041 } 1077 }
1042 1078
1043 gpu_info_ = gpu_info; 1079 gpu_info_ = gpu_info;
1044 UpdateGpuInfo(gpu_info); 1080 UpdateGpuInfo(gpu_info);
1045 UpdateGpuSwitchingManager(gpu_info); 1081 UpdateGpuSwitchingManager(gpu_info);
1046 UpdatePreliminaryBlacklistedFeatures(); 1082 UpdatePreliminaryBlacklistedFeatures();
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
1226 1262
1227 void GpuDataManagerImplPrivate::OnGpuProcessInitFailure() { 1263 void GpuDataManagerImplPrivate::OnGpuProcessInitFailure() {
1228 gpu_process_accessible_ = false; 1264 gpu_process_accessible_ = false;
1229 gpu_info_.finalized = true; 1265 gpu_info_.finalized = true;
1230 complete_gpu_info_already_requested_ = true; 1266 complete_gpu_info_already_requested_ = true;
1231 // Some observers might be waiting. 1267 // Some observers might be waiting.
1232 NotifyGpuInfoUpdate(); 1268 NotifyGpuInfoUpdate();
1233 } 1269 }
1234 1270
1235 } // namespace content 1271 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_data_manager_impl_private.h ('k') | content/public/common/content_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698