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

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: merge up to r228383 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))
gab 2013/10/16 15:12:09 Otherwise I just realized that this lost the previ
Zhenyao Mo 2013/10/16 19:35:23 I don't think perf bots run with kUseGpuInTests sw
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 // Also declare the driver_vendor to be osmesa to be able to specify
560 // exceptions based on driver_vendor==osmesa for some blacklist rules.
561 gpu_info.driver_vendor = gfx::kGLImplementationOSMesaName;
562 } else {
543 TRACE_EVENT0("startup", 563 TRACE_EVENT0("startup",
544 "GpuDataManagerImpl::Initialize:CollectBasicGraphicsInfo"); 564 "GpuDataManagerImpl::Initialize:CollectBasicGraphicsInfo");
545 gpu::CollectBasicGraphicsInfo(&gpu_info); 565 gpu::CollectBasicGraphicsInfo(&gpu_info);
546 } 566 }
547 #if defined(ARCH_CPU_X86_FAMILY) 567 #if defined(ARCH_CPU_X86_FAMILY)
548 if (!gpu_info.gpu.vendor_id || !gpu_info.gpu.device_id) 568 if (!gpu_info.gpu.vendor_id || !gpu_info.gpu.device_id)
549 gpu_info.finalized = true; 569 gpu_info.finalized = true;
550 #endif 570 #endif
551 571
552 std::string gpu_blacklist_string; 572 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), 986 gpu_switching_(gpu::GPU_SWITCHING_OPTION_AUTOMATIC),
967 observer_list_(new GpuDataManagerObserverList), 987 observer_list_(new GpuDataManagerObserverList),
968 use_swiftshader_(false), 988 use_swiftshader_(false),
969 card_blacklisted_(false), 989 card_blacklisted_(false),
970 update_histograms_(true), 990 update_histograms_(true),
971 window_count_(0), 991 window_count_(0),
972 domain_blocking_enabled_(true), 992 domain_blocking_enabled_(true),
973 owner_(owner), 993 owner_(owner),
974 display_count_(0), 994 display_count_(0),
975 gpu_process_accessible_(true), 995 gpu_process_accessible_(true),
976 use_software_compositor_(false) { 996 use_software_compositor_(false),
997 finalized_(false) {
977 DCHECK(owner_); 998 DCHECK(owner_);
978 CommandLine* command_line = CommandLine::ForCurrentProcess(); 999 CommandLine* command_line = CommandLine::ForCurrentProcess();
979 if (command_line->HasSwitch(switches::kDisableAcceleratedCompositing)) { 1000 if (command_line->HasSwitch(switches::kDisableAcceleratedCompositing)) {
980 command_line->AppendSwitch(switches::kDisableAccelerated2dCanvas); 1001 command_line->AppendSwitch(switches::kDisableAccelerated2dCanvas);
981 command_line->AppendSwitch(switches::kDisableAcceleratedLayers); 1002 command_line->AppendSwitch(switches::kDisableAcceleratedLayers);
982 } 1003 }
983 if (command_line->HasSwitch(switches::kDisableGpu)) 1004 if (command_line->HasSwitch(switches::kDisableGpu))
984 DisableHardwareAcceleration(); 1005 DisableHardwareAcceleration();
985 if (command_line->HasSwitch(switches::kEnableSoftwareCompositing)) 1006 if (command_line->HasSwitch(switches::kEnableSoftwareCompositing))
986 use_software_compositor_ = true; 1007 use_software_compositor_ = true;
(...skipping 24 matching lines...) Expand all
1011 1032
1012 void GpuDataManagerImplPrivate::InitializeImpl( 1033 void GpuDataManagerImplPrivate::InitializeImpl(
1013 const std::string& gpu_blacklist_json, 1034 const std::string& gpu_blacklist_json,
1014 const std::string& gpu_switching_list_json, 1035 const std::string& gpu_switching_list_json,
1015 const std::string& gpu_driver_bug_list_json, 1036 const std::string& gpu_driver_bug_list_json,
1016 const gpu::GPUInfo& gpu_info) { 1037 const gpu::GPUInfo& gpu_info) {
1017 std::string browser_version_string = ProcessVersionString( 1038 std::string browser_version_string = ProcessVersionString(
1018 GetContentClient()->GetProduct()); 1039 GetContentClient()->GetProduct());
1019 CHECK(!browser_version_string.empty()); 1040 CHECK(!browser_version_string.empty());
1020 1041
1042 const bool log_gpu_control_list_decisions =
1043 CommandLine::ForCurrentProcess()->HasSwitch(
1044 switches::kLogGpuControlListDecisions);
1045
1021 if (!gpu_blacklist_json.empty()) { 1046 if (!gpu_blacklist_json.empty()) {
1022 gpu_blacklist_.reset(gpu::GpuBlacklist::Create()); 1047 gpu_blacklist_.reset(gpu::GpuBlacklist::Create());
1048 if (log_gpu_control_list_decisions)
1049 gpu_blacklist_->enable_control_list_logging("gpu_blacklist");
1023 bool success = gpu_blacklist_->LoadList( 1050 bool success = gpu_blacklist_->LoadList(
1024 browser_version_string, gpu_blacklist_json, 1051 browser_version_string, gpu_blacklist_json,
1025 gpu::GpuControlList::kCurrentOsOnly); 1052 gpu::GpuControlList::kCurrentOsOnly);
1026 DCHECK(success); 1053 DCHECK(success);
1027 } 1054 }
1028 if (!gpu_switching_list_json.empty()) { 1055 if (!gpu_switching_list_json.empty()) {
1029 gpu_switching_list_.reset(gpu::GpuSwitchingList::Create()); 1056 gpu_switching_list_.reset(gpu::GpuSwitchingList::Create());
1057 if (log_gpu_control_list_decisions)
1058 gpu_switching_list_->enable_control_list_logging("gpu_switching_list");
1030 bool success = gpu_switching_list_->LoadList( 1059 bool success = gpu_switching_list_->LoadList(
1031 browser_version_string, gpu_switching_list_json, 1060 browser_version_string, gpu_switching_list_json,
1032 gpu::GpuControlList::kCurrentOsOnly); 1061 gpu::GpuControlList::kCurrentOsOnly);
1033 DCHECK(success); 1062 DCHECK(success);
1034 } 1063 }
1035 if (!gpu_driver_bug_list_json.empty()) { 1064 if (!gpu_driver_bug_list_json.empty()) {
1036 gpu_driver_bug_list_.reset(gpu::GpuDriverBugList::Create()); 1065 gpu_driver_bug_list_.reset(gpu::GpuDriverBugList::Create());
1066 if (log_gpu_control_list_decisions)
1067 gpu_driver_bug_list_->enable_control_list_logging("gpu_driver_bug_list");
1037 bool success = gpu_driver_bug_list_->LoadList( 1068 bool success = gpu_driver_bug_list_->LoadList(
1038 browser_version_string, gpu_driver_bug_list_json, 1069 browser_version_string, gpu_driver_bug_list_json,
1039 gpu::GpuControlList::kCurrentOsOnly); 1070 gpu::GpuControlList::kCurrentOsOnly);
1040 DCHECK(success); 1071 DCHECK(success);
1041 } 1072 }
1042 1073
1043 gpu_info_ = gpu_info; 1074 gpu_info_ = gpu_info;
1044 UpdateGpuInfo(gpu_info); 1075 UpdateGpuInfo(gpu_info);
1045 UpdateGpuSwitchingManager(gpu_info); 1076 UpdateGpuSwitchingManager(gpu_info);
1046 UpdatePreliminaryBlacklistedFeatures(); 1077 UpdatePreliminaryBlacklistedFeatures();
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
1226 1257
1227 void GpuDataManagerImplPrivate::OnGpuProcessInitFailure() { 1258 void GpuDataManagerImplPrivate::OnGpuProcessInitFailure() {
1228 gpu_process_accessible_ = false; 1259 gpu_process_accessible_ = false;
1229 gpu_info_.finalized = true; 1260 gpu_info_.finalized = true;
1230 complete_gpu_info_already_requested_ = true; 1261 complete_gpu_info_already_requested_ = true;
1231 // Some observers might be waiting. 1262 // Some observers might be waiting.
1232 NotifyGpuInfoUpdate(); 1263 NotifyGpuInfoUpdate();
1233 } 1264 }
1234 1265
1235 } // namespace content 1266 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698