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

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

Issue 23534006: Enable GPU blacklist in tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add early SetUp to AcceleratedCompositingBlocked and finalized_ state after GpuDataManagerImplPriva… 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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 }; 351 };
352 352
353 } // namespace anonymous 353 } // namespace anonymous
354 354
355 void GpuDataManagerImplPrivate::InitializeForTesting( 355 void GpuDataManagerImplPrivate::InitializeForTesting(
356 const std::string& gpu_blacklist_json, 356 const std::string& gpu_blacklist_json,
357 const gpu::GPUInfo& gpu_info) { 357 const gpu::GPUInfo& gpu_info) {
358 // This function is for testing only, so disable histograms. 358 // This function is for testing only, so disable histograms.
359 update_histograms_ = false; 359 update_histograms_ = false;
360 360
361 // Prevent all further initialization.
362 finalized_ = true;
363
361 InitializeImpl(gpu_blacklist_json, std::string(), std::string(), gpu_info); 364 InitializeImpl(gpu_blacklist_json, std::string(), std::string(), gpu_info);
362 } 365 }
363 366
364 bool GpuDataManagerImplPrivate::IsFeatureBlacklisted(int feature) const { 367 bool GpuDataManagerImplPrivate::IsFeatureBlacklisted(int feature) const {
365 #if defined(OS_CHROMEOS) 368 #if defined(OS_CHROMEOS)
366 if (feature == gpu::GPU_FEATURE_TYPE_PANEL_FITTING && 369 if (feature == gpu::GPU_FEATURE_TYPE_PANEL_FITTING &&
367 CommandLine::ForCurrentProcess()->HasSwitch( 370 CommandLine::ForCurrentProcess()->HasSwitch(
368 switches::kDisablePanelFitting)) { 371 switches::kDisablePanelFitting)) {
369 return true; 372 return true;
370 } 373 }
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 std::string* gl_version) { 563 std::string* gl_version) {
561 DCHECK(gl_vendor && gl_renderer && gl_version); 564 DCHECK(gl_vendor && gl_renderer && gl_version);
562 565
563 *gl_vendor = gpu_info_.gl_vendor; 566 *gl_vendor = gpu_info_.gl_vendor;
564 *gl_renderer = gpu_info_.gl_renderer; 567 *gl_renderer = gpu_info_.gl_renderer;
565 *gl_version = gpu_info_.gl_version_string; 568 *gl_version = gpu_info_.gl_version_string;
566 } 569 }
567 570
568 void GpuDataManagerImplPrivate::Initialize() { 571 void GpuDataManagerImplPrivate::Initialize() {
569 TRACE_EVENT0("startup", "GpuDataManagerImpl::Initialize"); 572 TRACE_EVENT0("startup", "GpuDataManagerImpl::Initialize");
570 CommandLine* command_line = CommandLine::ForCurrentProcess(); 573 if (finalized_) {
571 if (command_line->HasSwitch(switches::kSkipGpuDataLoading) && 574 DLOG(INFO) << "GpuDataManagerImpl marked as finalized; skipping Initialize";
572 !command_line->HasSwitch(switches::kUseGpuInTests)) 575 return;
576 }
577
578 const CommandLine* command_line = CommandLine::ForCurrentProcess();
579 if (command_line->HasSwitch(switches::kSkipGpuDataLoading))
573 return; 580 return;
574 581
575 gpu::GPUInfo gpu_info; 582 gpu::GPUInfo gpu_info;
576 { 583 if (command_line->GetSwitchValueASCII(
584 switches::kUseGL) == gfx::kGLImplementationOSMesaName) {
585 // If using the OSMesa GL implementation, use fake vendor and device ids to
586 // make sure it never gets blacklisted. This is better than simply
587 // cancelling GPUInfo gathering as it allows us to proceed with loading the
588 // blacklist below which may have non-device specific entries we want to
589 // apply anyways (e.g., OS version blacklisting).
590 gpu_info.gpu.vendor_id = 0xffff;
591 gpu_info.gpu.device_id = 0xffff;
592
593 // Hardcode some values otherwise some blacklisting rules in
594 // kSoftwareRenderingListJson result in a positive match as GpuControlList
595 // assumes a match (by design) when a property is required for the
596 // verification yet not present in the GpuInfo.
597 gpu_info.driver_vendor =
598 gfx::kGLImplementationOSMesaName; // Bypass rule #74.
599 gpu_info.driver_date = "2013.8"; // Bypass rules #12 and #55.
600 gpu_info.driver_version = "9.0.3"; // Bypass rule #23.
601 } else {
577 TRACE_EVENT0("startup", 602 TRACE_EVENT0("startup",
578 "GpuDataManagerImpl::Initialize:CollectBasicGraphicsInfo"); 603 "GpuDataManagerImpl::Initialize:CollectBasicGraphicsInfo");
579 gpu::CollectBasicGraphicsInfo(&gpu_info); 604 gpu::CollectBasicGraphicsInfo(&gpu_info);
580 } 605 }
581 #if defined(ARCH_CPU_X86_FAMILY) 606 #if defined(ARCH_CPU_X86_FAMILY)
582 if (!gpu_info.gpu.vendor_id || !gpu_info.gpu.device_id) 607 if (!gpu_info.gpu.vendor_id || !gpu_info.gpu.device_id)
583 gpu_info.finalized = true; 608 gpu_info.finalized = true;
584 #endif 609 #endif
585 610
586 std::string gpu_blacklist_string; 611 std::string gpu_blacklist_string;
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
999 gpu_switching_(gpu::GPU_SWITCHING_OPTION_AUTOMATIC), 1024 gpu_switching_(gpu::GPU_SWITCHING_OPTION_AUTOMATIC),
1000 observer_list_(new GpuDataManagerObserverList), 1025 observer_list_(new GpuDataManagerObserverList),
1001 use_swiftshader_(false), 1026 use_swiftshader_(false),
1002 card_blacklisted_(false), 1027 card_blacklisted_(false),
1003 update_histograms_(true), 1028 update_histograms_(true),
1004 window_count_(0), 1029 window_count_(0),
1005 domain_blocking_enabled_(true), 1030 domain_blocking_enabled_(true),
1006 owner_(owner), 1031 owner_(owner),
1007 display_count_(0), 1032 display_count_(0),
1008 gpu_process_accessible_(true), 1033 gpu_process_accessible_(true),
1009 use_software_compositor_(false) { 1034 use_software_compositor_(false),
1035 finalized_(false) {
1010 DCHECK(owner_); 1036 DCHECK(owner_);
1011 CommandLine* command_line = CommandLine::ForCurrentProcess(); 1037 CommandLine* command_line = CommandLine::ForCurrentProcess();
1012 if (command_line->HasSwitch(switches::kDisableAcceleratedCompositing)) { 1038 if (command_line->HasSwitch(switches::kDisableAcceleratedCompositing)) {
1013 command_line->AppendSwitch(switches::kDisableAccelerated2dCanvas); 1039 command_line->AppendSwitch(switches::kDisableAccelerated2dCanvas);
1014 command_line->AppendSwitch(switches::kDisableAcceleratedLayers); 1040 command_line->AppendSwitch(switches::kDisableAcceleratedLayers);
1015 } 1041 }
1016 if (command_line->HasSwitch(switches::kDisableGpu)) 1042 if (command_line->HasSwitch(switches::kDisableGpu))
1017 DisableHardwareAcceleration(); 1043 DisableHardwareAcceleration();
1018 if (command_line->HasSwitch(switches::kEnableSoftwareCompositing)) 1044 if (command_line->HasSwitch(switches::kEnableSoftwareCompositing))
1019 use_software_compositor_ = true; 1045 use_software_compositor_ = true;
(...skipping 26 matching lines...) Expand all
1046 const std::string& gpu_blacklist_json, 1072 const std::string& gpu_blacklist_json,
1047 const std::string& gpu_switching_list_json, 1073 const std::string& gpu_switching_list_json,
1048 const std::string& gpu_driver_bug_list_json, 1074 const std::string& gpu_driver_bug_list_json,
1049 const gpu::GPUInfo& gpu_info) { 1075 const gpu::GPUInfo& gpu_info) {
1050 std::string browser_version_string = ProcessVersionString( 1076 std::string browser_version_string = ProcessVersionString(
1051 GetContentClient()->GetProduct()); 1077 GetContentClient()->GetProduct());
1052 CHECK(!browser_version_string.empty()); 1078 CHECK(!browser_version_string.empty());
1053 1079
1054 if (!gpu_blacklist_json.empty()) { 1080 if (!gpu_blacklist_json.empty()) {
1055 gpu_blacklist_.reset(gpu::GpuBlacklist::Create()); 1081 gpu_blacklist_.reset(gpu::GpuBlacklist::Create());
1082 if (CommandLine::ForCurrentProcess()->HasSwitch(
1083 switches::kLogGpuControlListDecisions)) {
1084 gpu_blacklist_->enable_control_list_logging();
1085 }
1056 gpu_blacklist_->LoadList( 1086 gpu_blacklist_->LoadList(
1057 browser_version_string, gpu_blacklist_json, 1087 browser_version_string, gpu_blacklist_json,
1058 gpu::GpuControlList::kCurrentOsOnly); 1088 gpu::GpuControlList::kCurrentOsOnly);
1059 } 1089 }
1060 if (!gpu_switching_list_json.empty()) { 1090 if (!gpu_switching_list_json.empty()) {
1061 gpu_switching_list_.reset(gpu::GpuSwitchingList::Create()); 1091 gpu_switching_list_.reset(gpu::GpuSwitchingList::Create());
1062 gpu_switching_list_->LoadList( 1092 gpu_switching_list_->LoadList(
1063 browser_version_string, gpu_switching_list_json, 1093 browser_version_string, gpu_switching_list_json,
1064 gpu::GpuControlList::kCurrentOsOnly); 1094 gpu::GpuControlList::kCurrentOsOnly);
1065 } 1095 }
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
1256 1286
1257 void GpuDataManagerImplPrivate::OnGpuProcessInitFailure() { 1287 void GpuDataManagerImplPrivate::OnGpuProcessInitFailure() {
1258 gpu_process_accessible_ = false; 1288 gpu_process_accessible_ = false;
1259 gpu_info_.finalized = true; 1289 gpu_info_.finalized = true;
1260 complete_gpu_info_already_requested_ = true; 1290 complete_gpu_info_already_requested_ = true;
1261 // Some observers might be waiting. 1291 // Some observers might be waiting.
1262 NotifyGpuInfoUpdate(); 1292 NotifyGpuInfoUpdate();
1263 } 1293 }
1264 1294
1265 } // namespace content 1295 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698