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

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 detailed logging Created 7 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) 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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 }; 325 };
326 326
327 } // namespace anonymous 327 } // namespace anonymous
328 328
329 void GpuDataManagerImplPrivate::InitializeForTesting( 329 void GpuDataManagerImplPrivate::InitializeForTesting(
330 const std::string& gpu_blacklist_json, 330 const std::string& gpu_blacklist_json,
331 const gpu::GPUInfo& gpu_info) { 331 const gpu::GPUInfo& gpu_info) {
332 // This function is for testing only, so disable histograms. 332 // This function is for testing only, so disable histograms.
333 update_histograms_ = false; 333 update_histograms_ = false;
334 334
335 // Prevent all further initialization.
336 finalized_ = true;
337
335 InitializeImpl(gpu_blacklist_json, std::string(), std::string(), gpu_info); 338 InitializeImpl(gpu_blacklist_json, std::string(), std::string(), gpu_info);
336 } 339 }
337 340
338 bool GpuDataManagerImplPrivate::IsFeatureBlacklisted(int feature) const { 341 bool GpuDataManagerImplPrivate::IsFeatureBlacklisted(int feature) const {
339 #if defined(OS_CHROMEOS) 342 #if defined(OS_CHROMEOS)
340 if (feature == gpu::GPU_FEATURE_TYPE_PANEL_FITTING && 343 if (feature == gpu::GPU_FEATURE_TYPE_PANEL_FITTING &&
341 CommandLine::ForCurrentProcess()->HasSwitch( 344 CommandLine::ForCurrentProcess()->HasSwitch(
342 switches::kDisablePanelFitting)) { 345 switches::kDisablePanelFitting)) {
343 return true; 346 return true;
344 } 347 }
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 std::string* gl_version) { 541 std::string* gl_version) {
539 DCHECK(gl_vendor && gl_renderer && gl_version); 542 DCHECK(gl_vendor && gl_renderer && gl_version);
540 543
541 *gl_vendor = gpu_info_.gl_vendor; 544 *gl_vendor = gpu_info_.gl_vendor;
542 *gl_renderer = gpu_info_.gl_renderer; 545 *gl_renderer = gpu_info_.gl_renderer;
543 *gl_version = gpu_info_.gl_version_string; 546 *gl_version = gpu_info_.gl_version_string;
544 } 547 }
545 548
546 void GpuDataManagerImplPrivate::Initialize() { 549 void GpuDataManagerImplPrivate::Initialize() {
547 TRACE_EVENT0("startup", "GpuDataManagerImpl::Initialize"); 550 TRACE_EVENT0("startup", "GpuDataManagerImpl::Initialize");
548 CommandLine* command_line = CommandLine::ForCurrentProcess(); 551 if (finalized_) {
549 if (command_line->HasSwitch(switches::kSkipGpuDataLoading) && 552 DLOG(INFO) << "GpuDataManagerImpl marked as finalized; skipping Initialize";
550 !command_line->HasSwitch(switches::kUseGpuInTests)) 553 return;
554 }
555
556 const CommandLine* command_line = CommandLine::ForCurrentProcess();
557 if (command_line->HasSwitch(switches::kSkipGpuDataLoading))
551 return; 558 return;
552 559
553 gpu::GPUInfo gpu_info; 560 gpu::GPUInfo gpu_info;
554 { 561 if (command_line->GetSwitchValueASCII(
562 switches::kUseGL) == gfx::kGLImplementationOSMesaName) {
563 // If using the OSMesa GL implementation, use fake vendor and device ids to
564 // make sure it never gets blacklisted. This is better than simply
565 // cancelling GPUInfo gathering as it allows us to proceed with loading the
566 // blacklist below which may have non-device specific entries we want to
567 // apply anyways (e.g., OS version blacklisting).
568 gpu_info.gpu.vendor_id = 0xffff;
569 gpu_info.gpu.device_id = 0xffff;
570
571 // Hardcode some values otherwise some blacklisting rules in
572 // kSoftwareRenderingListJson result in a positive match as GpuControlList
573 // assumes a match (by design) when a property is required for the
574 // verification yet not present in the GpuInfo.
575 gpu_info.driver_vendor =
576 gfx::kGLImplementationOSMesaName; // Bypass rule #74.
577 gpu_info.driver_date = "2013.8"; // Bypass rules #12 and #55.
578 gpu_info.driver_version = "9.0.3"; // Bypass rule #23.
579 } else {
555 TRACE_EVENT0("startup", 580 TRACE_EVENT0("startup",
556 "GpuDataManagerImpl::Initialize:CollectBasicGraphicsInfo"); 581 "GpuDataManagerImpl::Initialize:CollectBasicGraphicsInfo");
557 gpu::CollectBasicGraphicsInfo(&gpu_info); 582 gpu::CollectBasicGraphicsInfo(&gpu_info);
558 } 583 }
559 #if defined(ARCH_CPU_X86_FAMILY) 584 #if defined(ARCH_CPU_X86_FAMILY)
560 if (!gpu_info.gpu.vendor_id || !gpu_info.gpu.device_id) 585 if (!gpu_info.gpu.vendor_id || !gpu_info.gpu.device_id)
561 gpu_info.finalized = true; 586 gpu_info.finalized = true;
562 #endif 587 #endif
563 588
564 std::string gpu_blacklist_string; 589 std::string gpu_blacklist_string;
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
978 gpu_switching_(gpu::GPU_SWITCHING_OPTION_AUTOMATIC), 1003 gpu_switching_(gpu::GPU_SWITCHING_OPTION_AUTOMATIC),
979 observer_list_(new GpuDataManagerObserverList), 1004 observer_list_(new GpuDataManagerObserverList),
980 use_swiftshader_(false), 1005 use_swiftshader_(false),
981 card_blacklisted_(false), 1006 card_blacklisted_(false),
982 update_histograms_(true), 1007 update_histograms_(true),
983 window_count_(0), 1008 window_count_(0),
984 domain_blocking_enabled_(true), 1009 domain_blocking_enabled_(true),
985 owner_(owner), 1010 owner_(owner),
986 display_count_(0), 1011 display_count_(0),
987 gpu_process_accessible_(true), 1012 gpu_process_accessible_(true),
988 use_software_compositor_(false) { 1013 use_software_compositor_(false),
1014 finalized_(false) {
989 DCHECK(owner_); 1015 DCHECK(owner_);
990 CommandLine* command_line = CommandLine::ForCurrentProcess(); 1016 CommandLine* command_line = CommandLine::ForCurrentProcess();
991 if (command_line->HasSwitch(switches::kDisableAcceleratedCompositing)) { 1017 if (command_line->HasSwitch(switches::kDisableAcceleratedCompositing)) {
992 command_line->AppendSwitch(switches::kDisableAccelerated2dCanvas); 1018 command_line->AppendSwitch(switches::kDisableAccelerated2dCanvas);
993 command_line->AppendSwitch(switches::kDisableAcceleratedLayers); 1019 command_line->AppendSwitch(switches::kDisableAcceleratedLayers);
994 } 1020 }
995 if (command_line->HasSwitch(switches::kDisableGpu)) 1021 if (command_line->HasSwitch(switches::kDisableGpu))
996 DisableHardwareAcceleration(); 1022 DisableHardwareAcceleration();
997 if (command_line->HasSwitch(switches::kEnableSoftwareCompositing)) 1023 if (command_line->HasSwitch(switches::kEnableSoftwareCompositing))
998 use_software_compositor_ = true; 1024 use_software_compositor_ = true;
(...skipping 24 matching lines...) Expand all
1023 1049
1024 void GpuDataManagerImplPrivate::InitializeImpl( 1050 void GpuDataManagerImplPrivate::InitializeImpl(
1025 const std::string& gpu_blacklist_json, 1051 const std::string& gpu_blacklist_json,
1026 const std::string& gpu_switching_list_json, 1052 const std::string& gpu_switching_list_json,
1027 const std::string& gpu_driver_bug_list_json, 1053 const std::string& gpu_driver_bug_list_json,
1028 const gpu::GPUInfo& gpu_info) { 1054 const gpu::GPUInfo& gpu_info) {
1029 std::string browser_version_string = ProcessVersionString( 1055 std::string browser_version_string = ProcessVersionString(
1030 GetContentClient()->GetProduct()); 1056 GetContentClient()->GetProduct());
1031 CHECK(!browser_version_string.empty()); 1057 CHECK(!browser_version_string.empty());
1032 1058
1059 const bool log_gpu_control_list_decisions =
1060 CommandLine::ForCurrentProcess()->HasSwitch(
1061 switches::kLogGpuControlListDecisions);
1062
1033 if (!gpu_blacklist_json.empty()) { 1063 if (!gpu_blacklist_json.empty()) {
1034 gpu_blacklist_.reset(gpu::GpuBlacklist::Create()); 1064 gpu_blacklist_.reset(gpu::GpuBlacklist::Create());
1065 if (log_gpu_control_list_decisions)
1066 gpu_blacklist_->enable_control_list_logging("gpu_blacklist");
1035 gpu_blacklist_->LoadList( 1067 gpu_blacklist_->LoadList(
1036 browser_version_string, gpu_blacklist_json, 1068 browser_version_string, gpu_blacklist_json,
1037 gpu::GpuControlList::kCurrentOsOnly); 1069 gpu::GpuControlList::kCurrentOsOnly);
1038 } 1070 }
1039 if (!gpu_switching_list_json.empty()) { 1071 if (!gpu_switching_list_json.empty()) {
1040 gpu_switching_list_.reset(gpu::GpuSwitchingList::Create()); 1072 gpu_switching_list_.reset(gpu::GpuSwitchingList::Create());
1073 if (log_gpu_control_list_decisions)
1074 gpu_switching_list_->enable_control_list_logging("gpu_switching_list");
1041 gpu_switching_list_->LoadList( 1075 gpu_switching_list_->LoadList(
1042 browser_version_string, gpu_switching_list_json, 1076 browser_version_string, gpu_switching_list_json,
1043 gpu::GpuControlList::kCurrentOsOnly); 1077 gpu::GpuControlList::kCurrentOsOnly);
1044 } 1078 }
1045 if (!gpu_driver_bug_list_json.empty()) { 1079 if (!gpu_driver_bug_list_json.empty()) {
1046 gpu_driver_bug_list_.reset(gpu::GpuDriverBugList::Create()); 1080 gpu_driver_bug_list_.reset(gpu::GpuDriverBugList::Create());
1081 if (log_gpu_control_list_decisions)
1082 gpu_driver_bug_list_->enable_control_list_logging("gpu_driver_bug_list");
1047 gpu_driver_bug_list_->LoadList( 1083 gpu_driver_bug_list_->LoadList(
1048 browser_version_string, gpu_driver_bug_list_json, 1084 browser_version_string, gpu_driver_bug_list_json,
1049 gpu::GpuControlList::kCurrentOsOnly); 1085 gpu::GpuControlList::kCurrentOsOnly);
1050 } 1086 }
1051 1087
1052 gpu_info_ = gpu_info; 1088 gpu_info_ = gpu_info;
1053 UpdateGpuInfo(gpu_info); 1089 UpdateGpuInfo(gpu_info);
1054 UpdateGpuSwitchingManager(gpu_info); 1090 UpdateGpuSwitchingManager(gpu_info);
1055 UpdatePreliminaryBlacklistedFeatures(); 1091 UpdatePreliminaryBlacklistedFeatures();
1056 1092
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
1235 1271
1236 void GpuDataManagerImplPrivate::OnGpuProcessInitFailure() { 1272 void GpuDataManagerImplPrivate::OnGpuProcessInitFailure() {
1237 gpu_process_accessible_ = false; 1273 gpu_process_accessible_ = false;
1238 gpu_info_.finalized = true; 1274 gpu_info_.finalized = true;
1239 complete_gpu_info_already_requested_ = true; 1275 complete_gpu_info_already_requested_ = true;
1240 // Some observers might be waiting. 1276 // Some observers might be waiting.
1241 NotifyGpuInfoUpdate(); 1277 NotifyGpuInfoUpdate();
1242 } 1278 }
1243 1279
1244 } // namespace content 1280 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698