OLD | NEW |
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 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 std::string* gl_version) { | 564 std::string* gl_version) { |
565 DCHECK(gl_vendor && gl_renderer && gl_version); | 565 DCHECK(gl_vendor && gl_renderer && gl_version); |
566 | 566 |
567 *gl_vendor = gpu_info_.gl_vendor; | 567 *gl_vendor = gpu_info_.gl_vendor; |
568 *gl_renderer = gpu_info_.gl_renderer; | 568 *gl_renderer = gpu_info_.gl_renderer; |
569 *gl_version = gpu_info_.gl_version_string; | 569 *gl_version = gpu_info_.gl_version_string; |
570 } | 570 } |
571 | 571 |
572 void GpuDataManagerImplPrivate::Initialize() { | 572 void GpuDataManagerImplPrivate::Initialize() { |
573 TRACE_EVENT0("startup", "GpuDataManagerImpl::Initialize"); | 573 TRACE_EVENT0("startup", "GpuDataManagerImpl::Initialize"); |
574 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 574 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
575 if (command_line->HasSwitch(switches::kSkipGpuDataLoading)) | 575 if (command_line->HasSwitch(switches::kSkipGpuDataLoading) && |
| 576 !command_line->HasSwitch(switches::kUseGpuInTests)) |
576 return; | 577 return; |
577 | 578 |
578 gpu::GPUInfo gpu_info; | 579 gpu::GPUInfo gpu_info; |
579 if (command_line->GetSwitchValueASCII( | 580 { |
580 switches::kUseGL) == gfx::kGLImplementationOSMesaName) { | |
581 // If using the OSMesa GL implementation, use fake vendor and device ids to | |
582 // make sure it never gets blacklisted. This is better than simply | |
583 // cancelling GPUInfo gathering as it allows us to proceed with loading the | |
584 // blacklist below which may have non-device specific entries we want to | |
585 // apply anyways (e.g., OS version blacklisting). | |
586 gpu_info.gpu.vendor_id = 0xffff; | |
587 gpu_info.gpu.device_id = 0xffff; | |
588 | |
589 // Hardcode some values otherwise some blacklisting rules in | |
590 // kSoftwareRenderingListJson result in a positive match as GpuControlList | |
591 // assumes a match (by design) when a property is required for the | |
592 // verification yet not present in the GpuInfo. | |
593 gpu_info.driver_vendor = | |
594 gfx::kGLImplementationOSMesaName; // Bypass rule #74. | |
595 gpu_info.driver_date = "2013.8"; // Bypass rules #12 and #55. | |
596 gpu_info.driver_version = "9.0.3"; // Bypass rule #23. | |
597 } else { | |
598 TRACE_EVENT0("startup", | 581 TRACE_EVENT0("startup", |
599 "GpuDataManagerImpl::Initialize:CollectBasicGraphicsInfo"); | 582 "GpuDataManagerImpl::Initialize:CollectBasicGraphicsInfo"); |
600 gpu::CollectBasicGraphicsInfo(&gpu_info); | 583 gpu::CollectBasicGraphicsInfo(&gpu_info); |
601 } | 584 } |
602 #if defined(ARCH_CPU_X86_FAMILY) | 585 #if defined(ARCH_CPU_X86_FAMILY) |
603 if (!gpu_info.gpu.vendor_id || !gpu_info.gpu.device_id) | 586 if (!gpu_info.gpu.vendor_id || !gpu_info.gpu.device_id) |
604 gpu_info.finalized = true; | 587 gpu_info.finalized = true; |
605 #endif | 588 #endif |
606 | 589 |
607 std::string gpu_blacklist_string; | 590 std::string gpu_blacklist_string; |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1068 const std::string& gpu_blacklist_json, | 1051 const std::string& gpu_blacklist_json, |
1069 const std::string& gpu_switching_list_json, | 1052 const std::string& gpu_switching_list_json, |
1070 const std::string& gpu_driver_bug_list_json, | 1053 const std::string& gpu_driver_bug_list_json, |
1071 const gpu::GPUInfo& gpu_info) { | 1054 const gpu::GPUInfo& gpu_info) { |
1072 std::string browser_version_string = ProcessVersionString( | 1055 std::string browser_version_string = ProcessVersionString( |
1073 GetContentClient()->GetProduct()); | 1056 GetContentClient()->GetProduct()); |
1074 CHECK(!browser_version_string.empty()); | 1057 CHECK(!browser_version_string.empty()); |
1075 | 1058 |
1076 if (!gpu_blacklist_json.empty()) { | 1059 if (!gpu_blacklist_json.empty()) { |
1077 gpu_blacklist_.reset(gpu::GpuBlacklist::Create()); | 1060 gpu_blacklist_.reset(gpu::GpuBlacklist::Create()); |
1078 if (CommandLine::ForCurrentProcess()->HasSwitch( | |
1079 switches::kLogGpuControlListDecisions)) { | |
1080 gpu_blacklist_->enable_control_list_logging(); | |
1081 } | |
1082 gpu_blacklist_->LoadList( | 1061 gpu_blacklist_->LoadList( |
1083 browser_version_string, gpu_blacklist_json, | 1062 browser_version_string, gpu_blacklist_json, |
1084 gpu::GpuControlList::kCurrentOsOnly); | 1063 gpu::GpuControlList::kCurrentOsOnly); |
1085 } | 1064 } |
1086 if (!gpu_switching_list_json.empty()) { | 1065 if (!gpu_switching_list_json.empty()) { |
1087 gpu_switching_list_.reset(gpu::GpuSwitchingList::Create()); | 1066 gpu_switching_list_.reset(gpu::GpuSwitchingList::Create()); |
1088 gpu_switching_list_->LoadList( | 1067 gpu_switching_list_->LoadList( |
1089 browser_version_string, gpu_switching_list_json, | 1068 browser_version_string, gpu_switching_list_json, |
1090 gpu::GpuControlList::kCurrentOsOnly); | 1069 gpu::GpuControlList::kCurrentOsOnly); |
1091 } | 1070 } |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1282 | 1261 |
1283 void GpuDataManagerImplPrivate::OnGpuProcessInitFailure() { | 1262 void GpuDataManagerImplPrivate::OnGpuProcessInitFailure() { |
1284 gpu_process_accessible_ = false; | 1263 gpu_process_accessible_ = false; |
1285 gpu_info_.finalized = true; | 1264 gpu_info_.finalized = true; |
1286 complete_gpu_info_already_requested_ = true; | 1265 complete_gpu_info_already_requested_ = true; |
1287 // Some observers might be waiting. | 1266 // Some observers might be waiting. |
1288 NotifyGpuInfoUpdate(); | 1267 NotifyGpuInfoUpdate(); |
1289 } | 1268 } |
1290 | 1269 |
1291 } // namespace content | 1270 } // namespace content |
OLD | NEW |