| 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/src/re2/re2.h" | 8 #include "third_party/re2/src/re2/re2.h" |
| 9 | 9 |
| 10 #include <windows.h> | 10 #include <windows.h> |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 // DirectX diagnostics are collected asynchronously because it takes a | 298 // DirectX diagnostics are collected asynchronously because it takes a |
| 299 // couple of seconds. | 299 // couple of seconds. |
| 300 } else { | 300 } else { |
| 301 gpu_info->dx_diagnostics_info_state = kCollectInfoNonFatalFailure; | 301 gpu_info->dx_diagnostics_info_state = kCollectInfoNonFatalFailure; |
| 302 } | 302 } |
| 303 | 303 |
| 304 gpu_info->context_info_state = kCollectInfoSuccess; | 304 gpu_info->context_info_state = kCollectInfoSuccess; |
| 305 return kCollectInfoSuccess; | 305 return kCollectInfoSuccess; |
| 306 } | 306 } |
| 307 | 307 |
| 308 CollectInfoResult CollectGpuID(uint32_t* vendor_id, uint32_t* device_id) { | |
| 309 DCHECK(vendor_id && device_id); | |
| 310 *vendor_id = 0; | |
| 311 *device_id = 0; | |
| 312 | |
| 313 // Taken from http://www.nvidia.com/object/device_ids.html | |
| 314 DISPLAY_DEVICE dd; | |
| 315 dd.cb = sizeof(DISPLAY_DEVICE); | |
| 316 std::wstring id; | |
| 317 for (int i = 0; EnumDisplayDevices(NULL, i, &dd, 0); ++i) { | |
| 318 if (dd.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE) { | |
| 319 id = dd.DeviceID; | |
| 320 break; | |
| 321 } | |
| 322 } | |
| 323 | |
| 324 if (id.length() > 20) { | |
| 325 DeviceIDToVendorAndDevice(id, vendor_id, device_id); | |
| 326 if (*vendor_id != 0 && *device_id != 0) | |
| 327 return kCollectInfoSuccess; | |
| 328 } | |
| 329 return kCollectInfoNonFatalFailure; | |
| 330 } | |
| 331 | |
| 332 CollectInfoResult CollectBasicGraphicsInfo(GPUInfo* gpu_info) { | 308 CollectInfoResult CollectBasicGraphicsInfo(GPUInfo* gpu_info) { |
| 333 TRACE_EVENT0("gpu", "CollectPreliminaryGraphicsInfo"); | 309 TRACE_EVENT0("gpu", "CollectPreliminaryGraphicsInfo"); |
| 334 | 310 |
| 335 DCHECK(gpu_info); | 311 DCHECK(gpu_info); |
| 336 | 312 |
| 337 // nvd3d9wrap.dll is loaded into all processes when Optimus is enabled. | 313 // nvd3d9wrap.dll is loaded into all processes when Optimus is enabled. |
| 338 HMODULE nvd3d9wrap = GetModuleHandleW(L"nvd3d9wrap.dll"); | 314 HMODULE nvd3d9wrap = GetModuleHandleW(L"nvd3d9wrap.dll"); |
| 339 gpu_info->optimus = nvd3d9wrap != NULL; | 315 gpu_info->optimus = nvd3d9wrap != NULL; |
| 340 | 316 |
| 341 // Taken from http://www.nvidia.com/object/device_ids.html | 317 // Taken from http://www.nvidia.com/object/device_ids.html |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 } | 411 } |
| 436 | 412 |
| 437 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); | 413 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); |
| 438 | 414 |
| 439 basic_gpu_info->dx_diagnostics_info_state = | 415 basic_gpu_info->dx_diagnostics_info_state = |
| 440 context_gpu_info.dx_diagnostics_info_state; | 416 context_gpu_info.dx_diagnostics_info_state; |
| 441 basic_gpu_info->dx_diagnostics = context_gpu_info.dx_diagnostics; | 417 basic_gpu_info->dx_diagnostics = context_gpu_info.dx_diagnostics; |
| 442 } | 418 } |
| 443 | 419 |
| 444 } // namespace gpu | 420 } // namespace gpu |
| OLD | NEW |