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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 driver_version = WideToASCII(std::wstring(value)); | 248 driver_version = WideToASCII(std::wstring(value)); |
249 | 249 |
250 std::string driver_date; | 250 std::string driver_date; |
251 dwcb_data = sizeof(value); | 251 dwcb_data = sizeof(value); |
252 result = RegQueryValueExW( | 252 result = RegQueryValueExW( |
253 key, L"DriverDate", NULL, NULL, | 253 key, L"DriverDate", NULL, NULL, |
254 reinterpret_cast<LPBYTE>(value), &dwcb_data); | 254 reinterpret_cast<LPBYTE>(value), &dwcb_data); |
255 if (result == ERROR_SUCCESS) | 255 if (result == ERROR_SUCCESS) |
256 driver_date = WideToASCII(std::wstring(value)); | 256 driver_date = WideToASCII(std::wstring(value)); |
257 | 257 |
| 258 std::string driver_vendor; |
| 259 dwcb_data = sizeof(value); |
| 260 result = RegQueryValueExW( |
| 261 key, L"ProviderName", NULL, NULL, |
| 262 reinterpret_cast<LPBYTE>(value), &dwcb_data); |
| 263 if (result == ERROR_SUCCESS) { |
| 264 driver_vendor = WideToASCII(std::wstring(value)); |
| 265 // If it's an Intel GPU with a driver provided by AMD then it's |
| 266 // probably AMD's Dynamic Switchable Graphics. |
| 267 // TODO: detect only AMD switchable |
| 268 gpu_info->amd_switchable = |
| 269 driver_vendor == "Advanced Micro Devices, Inc." || |
| 270 driver_vendor == "ATI Technologies Inc."; |
| 271 } |
| 272 |
| 273 gpu_info->driver_vendor = driver_vendor; |
258 gpu_info->driver_version = driver_version; | 274 gpu_info->driver_version = driver_version; |
259 gpu_info->driver_date = driver_date; | 275 gpu_info->driver_date = driver_date; |
260 found = true; | 276 found = true; |
261 RegCloseKey(key); | 277 RegCloseKey(key); |
262 break; | 278 break; |
263 } | 279 } |
264 } | 280 } |
265 } | 281 } |
266 fp_destroy_device_info_list(device_info); | 282 fp_destroy_device_info_list(device_info); |
267 FreeLibrary(lib_setupapi); | 283 FreeLibrary(lib_setupapi); |
(...skipping 10 matching lines...) Expand all Loading... |
278 | 294 |
279 size_t pos = gl_version_string.find_last_not_of("0123456789."); | 295 size_t pos = gl_version_string.find_last_not_of("0123456789."); |
280 if (pos != std::string::npos && pos < gl_version_string.length() - 1) { | 296 if (pos != std::string::npos && pos < gl_version_string.length() - 1) { |
281 gpu_info->driver_version = gl_version_string.substr(pos + 1); | 297 gpu_info->driver_version = gl_version_string.substr(pos + 1); |
282 return true; | 298 return true; |
283 } | 299 } |
284 return false; | 300 return false; |
285 } | 301 } |
286 | 302 |
287 } // namespace gpu_info_collector | 303 } // namespace gpu_info_collector |
OLD | NEW |