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 #include <stddef.h> |
| 8 #include <stdint.h> |
| 9 |
7 #include <string> | 10 #include <string> |
8 #include <vector> | 11 #include <vector> |
9 | 12 |
10 #include "base/logging.h" | 13 #include "base/logging.h" |
11 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
12 #include "base/metrics/sparse_histogram.h" | 15 #include "base/metrics/sparse_histogram.h" |
13 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
14 #include "base/strings/string_piece.h" | 17 #include "base/strings/string_piece.h" |
15 #include "base/strings/string_split.h" | 18 #include "base/strings/string_split.h" |
16 #include "base/strings/string_util.h" | 19 #include "base/strings/string_util.h" |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 } | 214 } |
212 | 215 |
213 void IdentifyActiveGPU(GPUInfo* gpu_info) { | 216 void IdentifyActiveGPU(GPUInfo* gpu_info) { |
214 const std::string kNVidiaName = "nvidia"; | 217 const std::string kNVidiaName = "nvidia"; |
215 const std::string kIntelName = "intel"; | 218 const std::string kIntelName = "intel"; |
216 const std::string kAMDName = "amd"; | 219 const std::string kAMDName = "amd"; |
217 const std::string kATIName = "ati"; | 220 const std::string kATIName = "ati"; |
218 const std::string kVendorNames[] = { | 221 const std::string kVendorNames[] = { |
219 kNVidiaName, kIntelName, kAMDName, kATIName}; | 222 kNVidiaName, kIntelName, kAMDName, kATIName}; |
220 | 223 |
221 const uint32 kNVidiaID = 0x10de; | 224 const uint32_t kNVidiaID = 0x10de; |
222 const uint32 kIntelID = 0x8086; | 225 const uint32_t kIntelID = 0x8086; |
223 const uint32 kAMDID = 0x1002; | 226 const uint32_t kAMDID = 0x1002; |
224 const uint32 kATIID = 0x1002; | 227 const uint32_t kATIID = 0x1002; |
225 const uint32 kVendorIDs[] = { | 228 const uint32_t kVendorIDs[] = {kNVidiaID, kIntelID, kAMDID, kATIID}; |
226 kNVidiaID, kIntelID, kAMDID, kATIID}; | |
227 | 229 |
228 DCHECK(gpu_info); | 230 DCHECK(gpu_info); |
229 if (gpu_info->secondary_gpus.size() == 0) | 231 if (gpu_info->secondary_gpus.size() == 0) |
230 return; | 232 return; |
231 | 233 |
232 uint32 active_vendor_id = 0; | 234 uint32_t active_vendor_id = 0; |
233 if (!gpu_info->gl_vendor.empty()) { | 235 if (!gpu_info->gl_vendor.empty()) { |
234 std::string gl_vendor_lower = base::ToLowerASCII(gpu_info->gl_vendor); | 236 std::string gl_vendor_lower = base::ToLowerASCII(gpu_info->gl_vendor); |
235 int index = StringContainsName( | 237 int index = StringContainsName( |
236 gl_vendor_lower, kVendorNames, arraysize(kVendorNames)); | 238 gl_vendor_lower, kVendorNames, arraysize(kVendorNames)); |
237 if (index >= 0) { | 239 if (index >= 0) { |
238 active_vendor_id = kVendorIDs[index]; | 240 active_vendor_id = kVendorIDs[index]; |
239 } | 241 } |
240 } | 242 } |
241 if (active_vendor_id == 0 && !gpu_info->gl_renderer.empty()) { | 243 if (active_vendor_id == 0 && !gpu_info->gl_renderer.empty()) { |
242 std::string gl_renderer_lower = base::ToLowerASCII(gpu_info->gl_renderer); | 244 std::string gl_renderer_lower = base::ToLowerASCII(gpu_info->gl_renderer); |
(...skipping 20 matching lines...) Expand all Loading... |
263 for (size_t ii = 0; ii < gpu_info->secondary_gpus.size(); ++ii) { | 265 for (size_t ii = 0; ii < gpu_info->secondary_gpus.size(); ++ii) { |
264 if (active_vendor_id == gpu_info->secondary_gpus[ii].vendor_id) { | 266 if (active_vendor_id == gpu_info->secondary_gpus[ii].vendor_id) { |
265 gpu_info->secondary_gpus[ii].active = true; | 267 gpu_info->secondary_gpus[ii].active = true; |
266 return; | 268 return; |
267 } | 269 } |
268 } | 270 } |
269 } | 271 } |
270 | 272 |
271 } // namespace gpu | 273 } // namespace gpu |
272 | 274 |
OLD | NEW |