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 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 command_line->HasSwitch(switches::kGpuTestingDeviceId)) { | 537 command_line->HasSwitch(switches::kGpuTestingDeviceId)) { |
538 base::HexStringToUInt( | 538 base::HexStringToUInt( |
539 command_line->GetSwitchValueASCII(switches::kGpuTestingVendorId), | 539 command_line->GetSwitchValueASCII(switches::kGpuTestingVendorId), |
540 &gpu_info.gpu.vendor_id); | 540 &gpu_info.gpu.vendor_id); |
541 base::HexStringToUInt( | 541 base::HexStringToUInt( |
542 command_line->GetSwitchValueASCII(switches::kGpuTestingDeviceId), | 542 command_line->GetSwitchValueASCII(switches::kGpuTestingDeviceId), |
543 &gpu_info.gpu.device_id); | 543 &gpu_info.gpu.device_id); |
544 gpu_info.gpu.active = true; | 544 gpu_info.gpu.active = true; |
545 gpu_info.secondary_gpus.clear(); | 545 gpu_info.secondary_gpus.clear(); |
546 } | 546 } |
| 547 |
| 548 gpu::ParseSecondaryGpuDevicesFromCommandLine(*command_line, true, |
| 549 &gpu_info); |
547 } | 550 } |
548 #if defined(ARCH_CPU_X86_FAMILY) | 551 #if defined(ARCH_CPU_X86_FAMILY) |
549 if (!gpu_info.gpu.vendor_id || !gpu_info.gpu.device_id) { | 552 if (!gpu_info.gpu.vendor_id || !gpu_info.gpu.device_id) { |
550 gpu_info.context_info_state = gpu::kCollectInfoNonFatalFailure; | 553 gpu_info.context_info_state = gpu::kCollectInfoNonFatalFailure; |
551 #if defined(OS_WIN) | 554 #if defined(OS_WIN) |
552 gpu_info.dx_diagnostics_info_state = gpu::kCollectInfoNonFatalFailure; | 555 gpu_info.dx_diagnostics_info_state = gpu::kCollectInfoNonFatalFailure; |
553 #endif // OS_WIN | 556 #endif // OS_WIN |
554 } | 557 } |
555 #endif // ARCH_CPU_X86_FAMILY | 558 #endif // ARCH_CPU_X86_FAMILY |
556 | 559 |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 // device_id, driver_vendor, driver_version for deciding whether we need to | 738 // device_id, driver_vendor, driver_version for deciding whether we need to |
736 // collect full info (on Linux) and for crash reporting purpose. | 739 // collect full info (on Linux) and for crash reporting purpose. |
737 command_line->AppendSwitchASCII(switches::kGpuVendorID, | 740 command_line->AppendSwitchASCII(switches::kGpuVendorID, |
738 base::StringPrintf("0x%04x", gpu_info_.gpu.vendor_id)); | 741 base::StringPrintf("0x%04x", gpu_info_.gpu.vendor_id)); |
739 command_line->AppendSwitchASCII(switches::kGpuDeviceID, | 742 command_line->AppendSwitchASCII(switches::kGpuDeviceID, |
740 base::StringPrintf("0x%04x", gpu_info_.gpu.device_id)); | 743 base::StringPrintf("0x%04x", gpu_info_.gpu.device_id)); |
741 command_line->AppendSwitchASCII(switches::kGpuDriverVendor, | 744 command_line->AppendSwitchASCII(switches::kGpuDriverVendor, |
742 gpu_info_.driver_vendor); | 745 gpu_info_.driver_vendor); |
743 command_line->AppendSwitchASCII(switches::kGpuDriverVersion, | 746 command_line->AppendSwitchASCII(switches::kGpuDriverVersion, |
744 gpu_info_.driver_version); | 747 gpu_info_.driver_version); |
| 748 |
| 749 std::string vendor_ids_str; |
| 750 std::string device_ids_str; |
| 751 for (const auto& device : gpu_info_.secondary_gpus) { |
| 752 if (!vendor_ids_str.empty()) |
| 753 vendor_ids_str += ";"; |
| 754 if (!device_ids_str.empty()) |
| 755 device_ids_str += ";"; |
| 756 vendor_ids_str += base::StringPrintf("0x%04x", device.vendor_id); |
| 757 device_ids_str += base::StringPrintf("0x%04x", device.device_id); |
| 758 } |
| 759 |
| 760 if (!vendor_ids_str.empty() && !device_ids_str.empty()) { |
| 761 command_line->AppendSwitchASCII(switches::kGpuSecondaryVendorIDs, |
| 762 vendor_ids_str); |
| 763 command_line->AppendSwitchASCII(switches::kGpuSecondaryDeviceIDs, |
| 764 device_ids_str); |
| 765 } |
745 } | 766 } |
746 | 767 |
747 void GpuDataManagerImplPrivate::UpdateRendererWebPrefs( | 768 void GpuDataManagerImplPrivate::UpdateRendererWebPrefs( |
748 WebPreferences* prefs) const { | 769 WebPreferences* prefs) const { |
749 DCHECK(prefs); | 770 DCHECK(prefs); |
750 | 771 |
751 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_WEBGL)) { | 772 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_WEBGL)) { |
752 prefs->experimental_webgl_enabled = false; | 773 prefs->experimental_webgl_enabled = false; |
753 prefs->pepper_3d_enabled = false; | 774 prefs->pepper_3d_enabled = false; |
754 } | 775 } |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1219 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; | 1240 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; |
1220 #if defined(OS_WIN) | 1241 #if defined(OS_WIN) |
1221 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; | 1242 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; |
1222 #endif | 1243 #endif |
1223 complete_gpu_info_already_requested_ = true; | 1244 complete_gpu_info_already_requested_ = true; |
1224 // Some observers might be waiting. | 1245 // Some observers might be waiting. |
1225 NotifyGpuInfoUpdate(); | 1246 NotifyGpuInfoUpdate(); |
1226 } | 1247 } |
1227 | 1248 |
1228 } // namespace content | 1249 } // namespace content |
OLD | NEW |