| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "gpu/config/gpu_info_collector.h" | 5 #include "gpu/config/gpu_info_collector.h" |
| 6 | 6 |
| 7 // This has to be included before windows.h. | 7 // This has to be included before windows.h. |
| 8 #include "third_party/re2/re2/re2.h" | 8 #include "third_party/re2/re2/re2.h" |
| 9 | 9 |
| 10 #include <windows.h> | 10 #include <windows.h> |
| 11 #include <d3d9.h> | 11 #include <d3d9.h> |
| 12 #include <d3d11.h> | 12 #include <d3d11.h> |
| 13 #include <dxgi.h> | 13 #include <dxgi.h> |
| 14 #include <setupapi.h> | 14 #include <setupapi.h> |
| 15 | 15 |
| 16 #include "base/command_line.h" | 16 #include "base/command_line.h" |
| 17 #include "base/debug/trace_event.h" | 17 #include "base/debug/trace_event.h" |
| 18 #include "base/metrics/field_trial.h" |
| 18 #include "base/file_util.h" | 19 #include "base/file_util.h" |
| 19 #include "base/files/file_path.h" | 20 #include "base/files/file_path.h" |
| 20 #include "base/logging.h" | 21 #include "base/logging.h" |
| 21 #include "base/message_loop.h" | 22 #include "base/message_loop.h" |
| 22 #include "base/metrics/histogram.h" | 23 #include "base/metrics/histogram.h" |
| 23 #include "base/scoped_native_library.h" | 24 #include "base/scoped_native_library.h" |
| 24 #include "base/string_number_conversions.h" | 25 #include "base/string_number_conversions.h" |
| 25 #include "base/string_util.h" | 26 #include "base/string_util.h" |
| 26 #include "base/string16.h" | 27 #include "base/string16.h" |
| 27 #include "base/stringprintf.h" | 28 #include "base/stringprintf.h" |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 | 200 |
| 200 if (key.OpenKey(L"Lenovo dCute", KEY_READ | KEY_WOW64_64KEY)) | 201 if (key.OpenKey(L"Lenovo dCute", KEY_READ | KEY_WOW64_64KEY)) |
| 201 return false; | 202 return false; |
| 202 | 203 |
| 203 return true; | 204 return true; |
| 204 } | 205 } |
| 205 | 206 |
| 206 // Determines whether D3D11 won't work, either because it is not supported on | 207 // Determines whether D3D11 won't work, either because it is not supported on |
| 207 // the machine or because it is known it is likely to crash. | 208 // the machine or because it is known it is likely to crash. |
| 208 bool D3D11ShouldWork(const GPUInfo& gpu_info) { | 209 bool D3D11ShouldWork(const GPUInfo& gpu_info) { |
| 209 // Windows XP never supports D3D11. | 210 // Windows XP never supports D3D11. It seems to be less stable that D3D9 on |
| 210 if (base::win::GetVersion() <= base::win::VERSION_XP) | 211 // Vista. |
| 212 if (base::win::GetVersion() <= base::win::VERSION_VISTA) |
| 211 return false; | 213 return false; |
| 212 | 214 |
| 213 // Intel? | 215 // http://crbug.com/175525. |
| 214 if (gpu_info.gpu.vendor_id == 0x8086) { | 216 if (gpu_info.display_link_version.IsValid()) |
| 215 // 2nd Generation Core Processor Family Integrated Graphics Controller | 217 return false; |
| 216 // or Intel Ivy Bridge? | |
| 217 if (gpu_info.gpu.device_id == 0x0102 || | |
| 218 gpu_info.gpu.device_id == 0x0106 || | |
| 219 gpu_info.gpu.device_id == 0x0116 || | |
| 220 gpu_info.gpu.device_id == 0x0126 || | |
| 221 gpu_info.gpu.device_id == 0x0152 || | |
| 222 gpu_info.gpu.device_id == 0x0156 || | |
| 223 gpu_info.gpu.device_id == 0x015a || | |
| 224 gpu_info.gpu.device_id == 0x0162 || | |
| 225 gpu_info.gpu.device_id == 0x0166) { | |
| 226 // http://crbug.com/196373. | |
| 227 if (base::win::GetVersion() == base::win::VERSION_VISTA) | |
| 228 return false; | |
| 229 | |
| 230 // http://crbug.com/175525. | |
| 231 if (gpu_info.display_link_version.IsValid()) | |
| 232 return false; | |
| 233 } | |
| 234 } | |
| 235 | 218 |
| 236 return true; | 219 return true; |
| 237 } | 220 } |
| 238 | 221 |
| 239 // Collects information about the level of D3D11 support and records it in | 222 // Collects information about the level of D3D11 support and records it in |
| 240 // the UMA stats. Records no stats when D3D11 in not supported at all. | 223 // the UMA stats. Records no stats when D3D11 in not supported at all. |
| 241 void CollectD3D11SupportOnWorkerThread() { | 224 void CollectD3D11SupportOnWorkerThread() { |
| 242 TRACE_EVENT0("gpu", "CollectD3D11Support"); | 225 TRACE_EVENT0("gpu", "CollectD3D11Support"); |
| 243 | 226 |
| 244 typedef HRESULT (WINAPI *D3D11CreateDeviceFunc)( | 227 typedef HRESULT (WINAPI *D3D11CreateDeviceFunc)( |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 string16 vendor_id_string = id.substr(8, 4); | 588 string16 vendor_id_string = id.substr(8, 4); |
| 606 string16 device_id_string = id.substr(17, 4); | 589 string16 device_id_string = id.substr(17, 4); |
| 607 base::HexStringToInt(WideToASCII(vendor_id_string), &vendor_id); | 590 base::HexStringToInt(WideToASCII(vendor_id_string), &vendor_id); |
| 608 base::HexStringToInt(WideToASCII(device_id_string), &device_id); | 591 base::HexStringToInt(WideToASCII(device_id_string), &device_id); |
| 609 gpu_info->gpu.vendor_id = vendor_id; | 592 gpu_info->gpu.vendor_id = vendor_id; |
| 610 gpu_info->gpu.device_id = device_id; | 593 gpu_info->gpu.device_id = device_id; |
| 611 // TODO(zmo): we only need to call CollectDriverInfoD3D() if we use ANGLE. | 594 // TODO(zmo): we only need to call CollectDriverInfoD3D() if we use ANGLE. |
| 612 if (!CollectDriverInfoD3D(id, gpu_info)) | 595 if (!CollectDriverInfoD3D(id, gpu_info)) |
| 613 return false; | 596 return false; |
| 614 | 597 |
| 615 // Collect basic information about supported D3D11 features. Delay for 45 | 598 // This is on a field trial so we can turn it off easily if it blows up |
| 616 // seconds so as not to regress performance tests. | 599 // again in stable channel. |
| 617 if (D3D11ShouldWork(*gpu_info)) { | 600 scoped_refptr<base::FieldTrial> trial( |
| 618 base::MessageLoop::current()->PostDelayedTask( | 601 base::FieldTrialList::FactoryGetFieldTrial("D3D11StatsExperiment", 100, |
| 619 FROM_HERE, | 602 "Disabled", 2015, 7, 8, |
| 620 base::Bind(&CollectD3D11Support), | 603 NULL)); |
| 621 base::TimeDelta::FromSeconds(45)); | 604 const int enabled_group = |
| 605 trial->AppendGroup("Enabled", 0); |
| 606 |
| 607 if (trial->group() == enabled_group) { |
| 608 // Collect basic information about supported D3D11 features. Delay for 45 |
| 609 // seconds so as not to regress performance tests. |
| 610 if (D3D11ShouldWork(*gpu_info)) { |
| 611 base::MessageLoop::current()->PostDelayedTask( |
| 612 FROM_HERE, |
| 613 base::Bind(&CollectD3D11Support), |
| 614 base::TimeDelta::FromSeconds(45)); |
| 615 } |
| 622 } | 616 } |
| 623 | 617 |
| 624 return true; | 618 return true; |
| 625 } | 619 } |
| 626 | 620 |
| 627 bool CollectDriverInfoGL(GPUInfo* gpu_info) { | 621 bool CollectDriverInfoGL(GPUInfo* gpu_info) { |
| 628 TRACE_EVENT0("gpu", "CollectDriverInfoGL"); | 622 TRACE_EVENT0("gpu", "CollectDriverInfoGL"); |
| 629 | 623 |
| 630 if (!gpu_info->driver_version.empty()) | 624 if (!gpu_info->driver_version.empty()) |
| 631 return true; | 625 return true; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 645 basic_gpu_info->software_rendering = true; | 639 basic_gpu_info->software_rendering = true; |
| 646 return; | 640 return; |
| 647 } | 641 } |
| 648 | 642 |
| 649 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); | 643 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); |
| 650 | 644 |
| 651 basic_gpu_info->dx_diagnostics = context_gpu_info.dx_diagnostics; | 645 basic_gpu_info->dx_diagnostics = context_gpu_info.dx_diagnostics; |
| 652 } | 646 } |
| 653 | 647 |
| 654 } // namespace gpu | 648 } // namespace gpu |
| OLD | NEW |