| 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 #include <winsatcominterfacei.h> | 10 #include <winsatcominterfacei.h> |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 break; | 212 break; |
| 213 } | 213 } |
| 214 } | 214 } |
| 215 | 215 |
| 216 if (id.length() > 20) { | 216 if (id.length() > 20) { |
| 217 int vendor_id = 0, device_id = 0; | 217 int vendor_id = 0, device_id = 0; |
| 218 std::wstring vendor_id_string = id.substr(8, 4); | 218 std::wstring vendor_id_string = id.substr(8, 4); |
| 219 std::wstring device_id_string = id.substr(17, 4); | 219 std::wstring device_id_string = id.substr(17, 4); |
| 220 base::HexStringToInt(WideToASCII(vendor_id_string), &vendor_id); | 220 base::HexStringToInt(WideToASCII(vendor_id_string), &vendor_id); |
| 221 base::HexStringToInt(WideToASCII(device_id_string), &device_id); | 221 base::HexStringToInt(WideToASCII(device_id_string), &device_id); |
| 222 gpu_info->vendor_id = vendor_id; | 222 gpu_info->gpu.vendor_id = vendor_id; |
| 223 gpu_info->device_id = device_id; | 223 gpu_info->gpu.device_id = device_id; |
| 224 // TODO(zmo): we only need to call CollectDriverInfoD3D() if we use ANGLE. | 224 // TODO(zmo): we only need to call CollectDriverInfoD3D() if we use ANGLE. |
| 225 return CollectDriverInfoD3D(id, gpu_info); | 225 return CollectDriverInfoD3D(id, gpu_info); |
| 226 } | 226 } |
| 227 return false; | 227 return false; |
| 228 } | 228 } |
| 229 | 229 |
| 230 bool CollectDriverInfoD3D(const std::wstring& device_id, | 230 bool CollectDriverInfoD3D(const std::wstring& device_id, |
| 231 content::GPUInfo* gpu_info) { | 231 content::GPUInfo* gpu_info) { |
| 232 // create device info for the display device | 232 // create device info for the display device |
| 233 HDEVINFO device_info = SetupDiGetClassDevsW( | 233 HDEVINFO device_info = SetupDiGetClassDevsW( |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 | 311 |
| 312 size_t pos = gl_version_string.find_last_not_of("0123456789."); | 312 size_t pos = gl_version_string.find_last_not_of("0123456789."); |
| 313 if (pos != std::string::npos && pos < gl_version_string.length() - 1) { | 313 if (pos != std::string::npos && pos < gl_version_string.length() - 1) { |
| 314 gpu_info->driver_version = gl_version_string.substr(pos + 1); | 314 gpu_info->driver_version = gl_version_string.substr(pos + 1); |
| 315 return true; | 315 return true; |
| 316 } | 316 } |
| 317 return false; | 317 return false; |
| 318 } | 318 } |
| 319 | 319 |
| 320 } // namespace gpu_info_collector | 320 } // namespace gpu_info_collector |
| OLD | NEW |