| 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 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 command_line->HasSwitch(switches::kGpuTestingDeviceId)) { | 523 command_line->HasSwitch(switches::kGpuTestingDeviceId)) { |
| 524 base::HexStringToUInt( | 524 base::HexStringToUInt( |
| 525 command_line->GetSwitchValueASCII(switches::kGpuTestingVendorId), | 525 command_line->GetSwitchValueASCII(switches::kGpuTestingVendorId), |
| 526 &gpu_info.gpu.vendor_id); | 526 &gpu_info.gpu.vendor_id); |
| 527 base::HexStringToUInt( | 527 base::HexStringToUInt( |
| 528 command_line->GetSwitchValueASCII(switches::kGpuTestingDeviceId), | 528 command_line->GetSwitchValueASCII(switches::kGpuTestingDeviceId), |
| 529 &gpu_info.gpu.device_id); | 529 &gpu_info.gpu.device_id); |
| 530 gpu_info.gpu.active = true; | 530 gpu_info.gpu.active = true; |
| 531 gpu_info.secondary_gpus.clear(); | 531 gpu_info.secondary_gpus.clear(); |
| 532 } | 532 } |
| 533 |
| 534 if (command_line->HasSwitch(switches::kGpuTestingSecondaryVendorId) && |
| 535 command_line->HasSwitch(switches::kGpuTestingSecondaryDeviceId)) { |
| 536 gpu_info.gpu.active = false; |
| 537 |
| 538 gpu::GPUInfo::GPUDevice secondary_device; |
| 539 secondary_device.active = false; |
| 540 base::HexStringToUInt(command_line->GetSwitchValueASCII( |
| 541 switches::kGpuTestingSecondaryVendorId), |
| 542 &secondary_device.vendor_id); |
| 543 base::HexStringToUInt(command_line->GetSwitchValueASCII( |
| 544 switches::kGpuTestingSecondaryDeviceId), |
| 545 &secondary_device.device_id); |
| 546 gpu_info.secondary_gpus.push_back(secondary_device); |
| 547 } |
| 533 } | 548 } |
| 534 #if defined(ARCH_CPU_X86_FAMILY) | 549 #if defined(ARCH_CPU_X86_FAMILY) |
| 535 if (!gpu_info.gpu.vendor_id || !gpu_info.gpu.device_id) { | 550 if (!gpu_info.gpu.vendor_id || !gpu_info.gpu.device_id) { |
| 536 gpu_info.context_info_state = gpu::kCollectInfoNonFatalFailure; | 551 gpu_info.context_info_state = gpu::kCollectInfoNonFatalFailure; |
| 537 #if defined(OS_WIN) | 552 #if defined(OS_WIN) |
| 538 gpu_info.dx_diagnostics_info_state = gpu::kCollectInfoNonFatalFailure; | 553 gpu_info.dx_diagnostics_info_state = gpu::kCollectInfoNonFatalFailure; |
| 539 #endif // OS_WIN | 554 #endif // OS_WIN |
| 540 } | 555 } |
| 541 #endif // ARCH_CPU_X86_FAMILY | 556 #endif // ARCH_CPU_X86_FAMILY |
| 542 | 557 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 | 627 |
| 613 void GpuDataManagerImplPrivate::UpdateGpuInfo(const gpu::GPUInfo& gpu_info) { | 628 void GpuDataManagerImplPrivate::UpdateGpuInfo(const gpu::GPUInfo& gpu_info) { |
| 614 // No further update of gpu_info if falling back to SwiftShader. | 629 // No further update of gpu_info if falling back to SwiftShader. |
| 615 if (use_swiftshader_) | 630 if (use_swiftshader_) |
| 616 return; | 631 return; |
| 617 | 632 |
| 618 bool was_info_available = IsCompleteGpuInfoAvailable(); | 633 bool was_info_available = IsCompleteGpuInfoAvailable(); |
| 619 gpu::MergeGPUInfo(&gpu_info_, gpu_info); | 634 gpu::MergeGPUInfo(&gpu_info_, gpu_info); |
| 620 if (IsCompleteGpuInfoAvailable()) { | 635 if (IsCompleteGpuInfoAvailable()) { |
| 621 complete_gpu_info_already_requested_ = true; | 636 complete_gpu_info_already_requested_ = true; |
| 637 #if !defined(OS_MACOSX) |
| 638 // Skip osx because gpu identification is done with DisplayReconfigCallback. |
| 639 gpu::IdentifyActiveGPU(&gpu_info_); |
| 640 #endif |
| 622 } else if (was_info_available) { | 641 } else if (was_info_available) { |
| 623 // Allow future requests to go through properly. | 642 // Allow future requests to go through properly. |
| 624 complete_gpu_info_already_requested_ = false; | 643 complete_gpu_info_already_requested_ = false; |
| 625 } | 644 } |
| 626 | 645 |
| 627 UpdateGpuInfoHelper(); | 646 UpdateGpuInfoHelper(); |
| 628 } | 647 } |
| 629 | 648 |
| 630 void GpuDataManagerImplPrivate::UpdateVideoMemoryUsageStats( | 649 void GpuDataManagerImplPrivate::UpdateVideoMemoryUsageStats( |
| 631 const gpu::VideoMemoryUsageStats& video_memory_usage_stats) { | 650 const gpu::VideoMemoryUsageStats& video_memory_usage_stats) { |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_ENCODE) && | 723 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_ENCODE) && |
| 705 !command_line->HasSwitch(switches::kDisableWebRtcHWEncoding)) { | 724 !command_line->HasSwitch(switches::kDisableWebRtcHWEncoding)) { |
| 706 command_line->AppendSwitch(switches::kDisableWebRtcHWEncoding); | 725 command_line->AppendSwitch(switches::kDisableWebRtcHWEncoding); |
| 707 } | 726 } |
| 708 #endif | 727 #endif |
| 709 | 728 |
| 710 // Pass GPU and driver information to GPU process. We try to avoid full GPU | 729 // Pass GPU and driver information to GPU process. We try to avoid full GPU |
| 711 // info collection at GPU process startup, but we need gpu vendor_id, | 730 // info collection at GPU process startup, but we need gpu vendor_id, |
| 712 // device_id, driver_vendor, driver_version for deciding whether we need to | 731 // device_id, driver_vendor, driver_version for deciding whether we need to |
| 713 // collect full info (on Linux) and for crash reporting purpose. | 732 // collect full info (on Linux) and for crash reporting purpose. |
| 733 // TODO(j.isorce): http://crbug.com/547025 Passes secondary_gpus as well |
| 734 // otherwise the GPU process might enable gpu driver bug workarounds for |
| 735 // inactive gpus on multiple gpu configuration. |
| 714 command_line->AppendSwitchASCII(switches::kGpuVendorID, | 736 command_line->AppendSwitchASCII(switches::kGpuVendorID, |
| 715 base::StringPrintf("0x%04x", gpu_info_.gpu.vendor_id)); | 737 base::StringPrintf("0x%04x", gpu_info_.gpu.vendor_id)); |
| 716 command_line->AppendSwitchASCII(switches::kGpuDeviceID, | 738 command_line->AppendSwitchASCII(switches::kGpuDeviceID, |
| 717 base::StringPrintf("0x%04x", gpu_info_.gpu.device_id)); | 739 base::StringPrintf("0x%04x", gpu_info_.gpu.device_id)); |
| 718 command_line->AppendSwitchASCII(switches::kGpuDriverVendor, | 740 command_line->AppendSwitchASCII(switches::kGpuDriverVendor, |
| 719 gpu_info_.driver_vendor); | 741 gpu_info_.driver_vendor); |
| 720 command_line->AppendSwitchASCII(switches::kGpuDriverVersion, | 742 command_line->AppendSwitchASCII(switches::kGpuDriverVersion, |
| 721 gpu_info_.driver_version); | 743 gpu_info_.driver_version); |
| 722 } | 744 } |
| 723 | 745 |
| (...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1197 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; | 1219 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; |
| 1198 #if defined(OS_WIN) | 1220 #if defined(OS_WIN) |
| 1199 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; | 1221 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; |
| 1200 #endif | 1222 #endif |
| 1201 complete_gpu_info_already_requested_ = true; | 1223 complete_gpu_info_already_requested_ = true; |
| 1202 // Some observers might be waiting. | 1224 // Some observers might be waiting. |
| 1203 NotifyGpuInfoUpdate(); | 1225 NotifyGpuInfoUpdate(); |
| 1204 } | 1226 } |
| 1205 | 1227 |
| 1206 } // namespace content | 1228 } // namespace content |
| OLD | NEW |