| 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 "content/gpu/gpu_info_collector.h" | 5 #include "content/gpu/gpu_info_collector.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <d3d9.h> | 8 #include <d3d9.h> |
| 9 #include <setupapi.h> | 9 #include <setupapi.h> |
| 10 | 10 |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 | 353 |
| 354 std::string driver_vendor; | 354 std::string driver_vendor; |
| 355 dwcb_data = sizeof(value); | 355 dwcb_data = sizeof(value); |
| 356 result = RegQueryValueExW( | 356 result = RegQueryValueExW( |
| 357 key, L"ProviderName", NULL, NULL, | 357 key, L"ProviderName", NULL, NULL, |
| 358 reinterpret_cast<LPBYTE>(value), &dwcb_data); | 358 reinterpret_cast<LPBYTE>(value), &dwcb_data); |
| 359 if (result == ERROR_SUCCESS) { | 359 if (result == ERROR_SUCCESS) { |
| 360 driver_vendor = WideToASCII(std::wstring(value)); | 360 driver_vendor = WideToASCII(std::wstring(value)); |
| 361 if (driver_vendor == "Advanced Micro Devices, Inc." || | 361 if (driver_vendor == "Advanced Micro Devices, Inc." || |
| 362 driver_vendor == "ATI Technologies Inc.") { | 362 driver_vendor == "ATI Technologies Inc.") { |
| 363 // We are conservative and assume that in the absense of a clear | 363 // We are conservative and assume that in the absence of a clear |
| 364 // signal the videocard is assumed to be switchable. | 364 // signal the videocard is assumed to be switchable. Additionally, |
| 365 // some switchable systems with Intel GPUs aren't correctly |
| 366 // detected, so always count them. |
| 365 AMDVideoCardType amd_card_type = GetAMDVideocardType(); | 367 AMDVideoCardType amd_card_type = GetAMDVideocardType(); |
| 366 gpu_info->amd_switchable = (amd_card_type != STANDALONE); | 368 gpu_info->amd_switchable = (gpu_info->gpu.vendor_id == 0x8086) || |
| 369 (amd_card_type != STANDALONE); |
| 367 } | 370 } |
| 368 } | 371 } |
| 369 | 372 |
| 370 gpu_info->driver_vendor = driver_vendor; | 373 gpu_info->driver_vendor = driver_vendor; |
| 371 gpu_info->driver_version = driver_version; | 374 gpu_info->driver_version = driver_version; |
| 372 gpu_info->driver_date = driver_date; | 375 gpu_info->driver_date = driver_date; |
| 373 found = true; | 376 found = true; |
| 374 RegCloseKey(key); | 377 RegCloseKey(key); |
| 375 break; | 378 break; |
| 376 } | 379 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 392 | 395 |
| 393 size_t pos = gl_version_string.find_last_not_of("0123456789."); | 396 size_t pos = gl_version_string.find_last_not_of("0123456789."); |
| 394 if (pos != std::string::npos && pos < gl_version_string.length() - 1) { | 397 if (pos != std::string::npos && pos < gl_version_string.length() - 1) { |
| 395 gpu_info->driver_version = gl_version_string.substr(pos + 1); | 398 gpu_info->driver_version = gl_version_string.substr(pos + 1); |
| 396 return true; | 399 return true; |
| 397 } | 400 } |
| 398 return false; | 401 return false; |
| 399 } | 402 } |
| 400 | 403 |
| 401 } // namespace gpu_info_collector | 404 } // namespace gpu_info_collector |
| OLD | NEW |