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/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 void GpuDataManagerImplPrivate::GetGLStrings(std::string* gl_vendor, | 482 void GpuDataManagerImplPrivate::GetGLStrings(std::string* gl_vendor, |
483 std::string* gl_renderer, | 483 std::string* gl_renderer, |
484 std::string* gl_version) { | 484 std::string* gl_version) { |
485 DCHECK(gl_vendor && gl_renderer && gl_version); | 485 DCHECK(gl_vendor && gl_renderer && gl_version); |
486 | 486 |
487 *gl_vendor = gpu_info_.gl_vendor; | 487 *gl_vendor = gpu_info_.gl_vendor; |
488 *gl_renderer = gpu_info_.gl_renderer; | 488 *gl_renderer = gpu_info_.gl_renderer; |
489 *gl_version = gpu_info_.gl_version; | 489 *gl_version = gpu_info_.gl_version; |
490 } | 490 } |
491 | 491 |
| 492 void GpuDataManagerImplPrivate::SetGpuDeviceName(const std::string& vendor, |
| 493 const std::string& device) { |
| 494 if (!gpu_info_.gpu.vendor_string.empty() || |
| 495 !gpu_info_.gpu.device_string.empty()) |
| 496 return; |
| 497 |
| 498 gpu_info_.gpu.vendor_string = vendor; |
| 499 gpu_info_.gpu.device_string = device; |
| 500 } |
| 501 |
492 void GpuDataManagerImplPrivate::Initialize() { | 502 void GpuDataManagerImplPrivate::Initialize() { |
493 TRACE_EVENT0("startup", "GpuDataManagerImpl::Initialize"); | 503 TRACE_EVENT0("startup", "GpuDataManagerImpl::Initialize"); |
494 if (finalized_) { | 504 if (finalized_) { |
495 DVLOG(0) << "GpuDataManagerImpl marked as finalized; skipping Initialize"; | 505 DVLOG(0) << "GpuDataManagerImpl marked as finalized; skipping Initialize"; |
496 return; | 506 return; |
497 } | 507 } |
498 | 508 |
499 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 509 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
500 if (command_line->HasSwitch(switches::kSkipGpuDataLoading)) | 510 if (command_line->HasSwitch(switches::kSkipGpuDataLoading)) |
501 return; | 511 return; |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 // device_id, driver_vendor, driver_version for deciding whether we need to | 681 // device_id, driver_vendor, driver_version for deciding whether we need to |
672 // collect full info (on Linux) and for crash reporting purpose. | 682 // collect full info (on Linux) and for crash reporting purpose. |
673 command_line->AppendSwitchASCII(switches::kGpuVendorID, | 683 command_line->AppendSwitchASCII(switches::kGpuVendorID, |
674 base::StringPrintf("0x%04x", gpu_info_.gpu.vendor_id)); | 684 base::StringPrintf("0x%04x", gpu_info_.gpu.vendor_id)); |
675 command_line->AppendSwitchASCII(switches::kGpuDeviceID, | 685 command_line->AppendSwitchASCII(switches::kGpuDeviceID, |
676 base::StringPrintf("0x%04x", gpu_info_.gpu.device_id)); | 686 base::StringPrintf("0x%04x", gpu_info_.gpu.device_id)); |
677 command_line->AppendSwitchASCII(switches::kGpuDriverVendor, | 687 command_line->AppendSwitchASCII(switches::kGpuDriverVendor, |
678 gpu_info_.driver_vendor); | 688 gpu_info_.driver_vendor); |
679 command_line->AppendSwitchASCII(switches::kGpuDriverVersion, | 689 command_line->AppendSwitchASCII(switches::kGpuDriverVersion, |
680 gpu_info_.driver_version); | 690 gpu_info_.driver_version); |
| 691 if (!gpu_info_.gpu.vendor_string.empty()) |
| 692 command_line->AppendSwitchASCII(switches::kGpuVendorString, |
| 693 gpu_info_.gpu.vendor_string); |
| 694 if (!gpu_info_.gpu.device_string.empty()) |
| 695 command_line->AppendSwitchASCII(switches::kGpuDeviceString, |
| 696 gpu_info_.gpu.device_string); |
681 | 697 |
682 if (ShouldUseWarp()) | 698 if (ShouldUseWarp()) |
683 command_line->AppendSwitch(switches::kUseWarp); | 699 command_line->AppendSwitch(switches::kUseWarp); |
684 } | 700 } |
685 | 701 |
686 void GpuDataManagerImplPrivate::AppendPluginCommandLine( | 702 void GpuDataManagerImplPrivate::AppendPluginCommandLine( |
687 base::CommandLine* command_line) const { | 703 base::CommandLine* command_line) const { |
688 DCHECK(command_line); | 704 DCHECK(command_line); |
689 | 705 |
690 #if defined(OS_MACOSX) | 706 #if defined(OS_MACOSX) |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
965 } | 981 } |
966 if (!gpu_driver_bug_list_json.empty()) { | 982 if (!gpu_driver_bug_list_json.empty()) { |
967 gpu_driver_bug_list_.reset(gpu::GpuDriverBugList::Create()); | 983 gpu_driver_bug_list_.reset(gpu::GpuDriverBugList::Create()); |
968 if (log_gpu_control_list_decisions) | 984 if (log_gpu_control_list_decisions) |
969 gpu_driver_bug_list_->enable_control_list_logging("gpu_driver_bug_list"); | 985 gpu_driver_bug_list_->enable_control_list_logging("gpu_driver_bug_list"); |
970 bool success = gpu_driver_bug_list_->LoadList( | 986 bool success = gpu_driver_bug_list_->LoadList( |
971 gpu_driver_bug_list_json, gpu::GpuControlList::kCurrentOsOnly); | 987 gpu_driver_bug_list_json, gpu::GpuControlList::kCurrentOsOnly); |
972 DCHECK(success); | 988 DCHECK(success); |
973 } | 989 } |
974 | 990 |
| 991 // Don't lose gpu vendor, device if set externally |
| 992 std::string gpu_vendor_string = gpu_info_.gpu.vendor_string; |
| 993 std::string gpu_device_string = gpu_info_.gpu.device_string; |
| 994 |
975 gpu_info_ = gpu_info; | 995 gpu_info_ = gpu_info; |
| 996 |
| 997 if (!gpu_vendor_string.empty()) |
| 998 gpu_info_.gpu.vendor_string = gpu_vendor_string; |
| 999 if (!gpu_device_string.empty()) |
| 1000 gpu_info_.gpu.device_string = gpu_device_string; |
| 1001 |
976 UpdateGpuInfo(gpu_info); | 1002 UpdateGpuInfo(gpu_info); |
977 UpdateGpuSwitchingManager(gpu_info); | 1003 UpdateGpuSwitchingManager(gpu_info); |
978 UpdatePreliminaryBlacklistedFeatures(); | 1004 UpdatePreliminaryBlacklistedFeatures(); |
979 } | 1005 } |
980 | 1006 |
981 void GpuDataManagerImplPrivate::UpdateBlacklistedFeatures( | 1007 void GpuDataManagerImplPrivate::UpdateBlacklistedFeatures( |
982 const std::set<int>& features) { | 1008 const std::set<int>& features) { |
983 blacklisted_features_ = features; | 1009 blacklisted_features_ = features; |
984 | 1010 |
985 // Force disable using the GPU for these features, even if they would | 1011 // Force disable using the GPU for these features, even if they would |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1153 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; | 1179 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; |
1154 #if defined(OS_WIN) | 1180 #if defined(OS_WIN) |
1155 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; | 1181 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; |
1156 #endif | 1182 #endif |
1157 complete_gpu_info_already_requested_ = true; | 1183 complete_gpu_info_already_requested_ = true; |
1158 // Some observers might be waiting. | 1184 // Some observers might be waiting. |
1159 NotifyGpuInfoUpdate(); | 1185 NotifyGpuInfoUpdate(); |
1160 } | 1186 } |
1161 | 1187 |
1162 } // namespace content | 1188 } // namespace content |
OLD | NEW |