| 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 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 std::string* gl_version) { | 556 std::string* gl_version) { |
| 557 DCHECK(gl_vendor && gl_renderer && gl_version); | 557 DCHECK(gl_vendor && gl_renderer && gl_version); |
| 558 | 558 |
| 559 *gl_vendor = gpu_info_.gl_vendor; | 559 *gl_vendor = gpu_info_.gl_vendor; |
| 560 *gl_renderer = gpu_info_.gl_renderer; | 560 *gl_renderer = gpu_info_.gl_renderer; |
| 561 *gl_version = gpu_info_.gl_version_string; | 561 *gl_version = gpu_info_.gl_version_string; |
| 562 } | 562 } |
| 563 | 563 |
| 564 void GpuDataManagerImplPrivate::Initialize() { | 564 void GpuDataManagerImplPrivate::Initialize() { |
| 565 TRACE_EVENT0("startup", "GpuDataManagerImpl::Initialize"); | 565 TRACE_EVENT0("startup", "GpuDataManagerImpl::Initialize"); |
| 566 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 566 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 567 if (command_line->HasSwitch(switches::kSkipGpuDataLoading) && | |
| 568 !command_line->HasSwitch(switches::kUseGpuInTests)) | |
| 569 return; | |
| 570 | 567 |
| 571 gpu::GPUInfo gpu_info; | 568 gpu::GPUInfo gpu_info; |
| 572 { | 569 if (command_line->GetSwitchValueASCII( |
| 570 switches::kUseGL) == gfx::kGLImplementationOSMesaName) { |
| 571 // If using the OSMesa GL implementation, use fake vendor and device ids to |
| 572 // make sure it never gets blacklisted. This is better than simply |
| 573 // cancelling GPUInfo gathering as it allows us to proceed with loading the |
| 574 // blacklist below which may have non-device specific entries we want to |
| 575 // apply anyways (e.g., OS version blacklisting). |
| 576 gpu_info.gpu.vendor_id = 0xffff; |
| 577 gpu_info.gpu.device_id = 0xffff; |
| 578 |
| 579 // Hardcode some values otherwise some blacklisting rules in |
| 580 // kSoftwareRenderingListJson result in a positive match as GpuControlList |
| 581 // assumes a match (by design) when a property is required for the |
| 582 // verification yet not present in the GpuInfo. |
| 583 gpu_info.driver_vendor = |
| 584 gfx::kGLImplementationOSMesaName; // Bypass rule #74. |
| 585 gpu_info.driver_date = "2013.8"; // Bypass rules #12 and #55. |
| 586 gpu_info.driver_version = "9.0.3"; // Bypass rule #23. |
| 587 } else { |
| 573 TRACE_EVENT0("startup", | 588 TRACE_EVENT0("startup", |
| 574 "GpuDataManagerImpl::Initialize:CollectBasicGraphicsInfo"); | 589 "GpuDataManagerImpl::Initialize:CollectBasicGraphicsInfo"); |
| 575 gpu::CollectBasicGraphicsInfo(&gpu_info); | 590 gpu::CollectBasicGraphicsInfo(&gpu_info); |
| 576 } | 591 } |
| 577 #if defined(ARCH_CPU_X86_FAMILY) | 592 #if defined(ARCH_CPU_X86_FAMILY) |
| 578 if (!gpu_info.gpu.vendor_id || !gpu_info.gpu.device_id) | 593 if (!gpu_info.gpu.vendor_id || !gpu_info.gpu.device_id) |
| 579 gpu_info.finalized = true; | 594 gpu_info.finalized = true; |
| 580 #endif | 595 #endif |
| 581 | 596 |
| 582 std::string gpu_blacklist_string; | 597 std::string gpu_blacklist_string; |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1042 const std::string& gpu_blacklist_json, | 1057 const std::string& gpu_blacklist_json, |
| 1043 const std::string& gpu_switching_list_json, | 1058 const std::string& gpu_switching_list_json, |
| 1044 const std::string& gpu_driver_bug_list_json, | 1059 const std::string& gpu_driver_bug_list_json, |
| 1045 const gpu::GPUInfo& gpu_info) { | 1060 const gpu::GPUInfo& gpu_info) { |
| 1046 std::string browser_version_string = ProcessVersionString( | 1061 std::string browser_version_string = ProcessVersionString( |
| 1047 GetContentClient()->GetProduct()); | 1062 GetContentClient()->GetProduct()); |
| 1048 CHECK(!browser_version_string.empty()); | 1063 CHECK(!browser_version_string.empty()); |
| 1049 | 1064 |
| 1050 if (!gpu_blacklist_json.empty()) { | 1065 if (!gpu_blacklist_json.empty()) { |
| 1051 gpu_blacklist_.reset(gpu::GpuBlacklist::Create()); | 1066 gpu_blacklist_.reset(gpu::GpuBlacklist::Create()); |
| 1067 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 1068 switches::kLogGpuBlacklistDecisions)) { |
| 1069 gpu_blacklist_->enable_blacklist_logging(); |
| 1070 } |
| 1052 gpu_blacklist_->LoadList( | 1071 gpu_blacklist_->LoadList( |
| 1053 browser_version_string, gpu_blacklist_json, | 1072 browser_version_string, gpu_blacklist_json, |
| 1054 gpu::GpuControlList::kCurrentOsOnly); | 1073 gpu::GpuControlList::kCurrentOsOnly); |
| 1055 } | 1074 } |
| 1056 if (!gpu_switching_list_json.empty()) { | 1075 if (!gpu_switching_list_json.empty()) { |
| 1057 gpu_switching_list_.reset(gpu::GpuSwitchingList::Create()); | 1076 gpu_switching_list_.reset(gpu::GpuSwitchingList::Create()); |
| 1058 gpu_switching_list_->LoadList( | 1077 gpu_switching_list_->LoadList( |
| 1059 browser_version_string, gpu_switching_list_json, | 1078 browser_version_string, gpu_switching_list_json, |
| 1060 gpu::GpuControlList::kCurrentOsOnly); | 1079 gpu::GpuControlList::kCurrentOsOnly); |
| 1061 } | 1080 } |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1252 | 1271 |
| 1253 void GpuDataManagerImplPrivate::OnGpuProcessInitFailure() { | 1272 void GpuDataManagerImplPrivate::OnGpuProcessInitFailure() { |
| 1254 gpu_process_accessible_ = false; | 1273 gpu_process_accessible_ = false; |
| 1255 gpu_info_.finalized = true; | 1274 gpu_info_.finalized = true; |
| 1256 complete_gpu_info_already_requested_ = true; | 1275 complete_gpu_info_already_requested_ = true; |
| 1257 // Some observers might be waiting. | 1276 // Some observers might be waiting. |
| 1258 NotifyGpuInfoUpdate(); | 1277 NotifyGpuInfoUpdate(); |
| 1259 } | 1278 } |
| 1260 | 1279 |
| 1261 } // namespace content | 1280 } // namespace content |
| OLD | NEW |