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