OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <dlfcn.h> | 7 #include <dlfcn.h> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 } | 323 } |
324 (interface->pci_cleanup)(access); | 324 (interface->pci_cleanup)(access); |
325 FinalizeLibPci(&interface); | 325 FinalizeLibPci(&interface); |
326 return (gpu_active != NULL); | 326 return (gpu_active != NULL); |
327 } | 327 } |
328 | 328 |
329 bool CollectDriverInfoGL(GPUInfo* gpu_info) { | 329 bool CollectDriverInfoGL(GPUInfo* gpu_info) { |
330 DCHECK(gpu_info); | 330 DCHECK(gpu_info); |
331 | 331 |
332 std::string gl_version_string = gpu_info->gl_version_string; | 332 std::string gl_version_string = gpu_info->gl_version_string; |
| 333 if (StartsWithASCII(gl_version_string, "OpenGL ES", true)) |
| 334 gl_version_string = gl_version_string.substr(10); |
333 std::vector<std::string> pieces; | 335 std::vector<std::string> pieces; |
334 base::SplitStringAlongWhitespace(gl_version_string, &pieces); | 336 base::SplitStringAlongWhitespace(gl_version_string, &pieces); |
335 // In linux, the gl version string might be in the format of | 337 // In linux, the gl version string might be in the format of |
336 // GLVersion DriverVendor DriverVersion | 338 // GLVersion DriverVendor DriverVersion |
337 if (pieces.size() < 3) | 339 if (pieces.size() < 3) |
338 return false; | 340 return false; |
339 | 341 |
340 std::string driver_version = pieces[2]; | 342 std::string driver_version = pieces[2]; |
341 size_t pos = driver_version.find_first_not_of("0123456789."); | 343 size_t pos = driver_version.find_first_not_of("0123456789."); |
342 if (pos == 0) | 344 if (pos == 0) |
343 return false; | 345 return false; |
344 if (pos != std::string::npos) | 346 if (pos != std::string::npos) |
345 driver_version = driver_version.substr(0, pos); | 347 driver_version = driver_version.substr(0, pos); |
346 | 348 |
347 gpu_info->driver_vendor = pieces[1]; | 349 gpu_info->driver_vendor = pieces[1]; |
348 gpu_info->driver_version = driver_version; | 350 gpu_info->driver_version = driver_version; |
349 return true; | 351 return true; |
350 } | 352 } |
351 | 353 |
352 } // namespace gpu_info_collector | 354 } // namespace gpu_info_collector |
OLD | NEW |