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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 namespace { | 29 namespace { |
30 | 30 |
31 const UInt32 kVendorIDIntel = 0x8086; | 31 const UInt32 kVendorIDIntel = 0x8086; |
32 const UInt32 kVendorIDNVidia = 0x10de; | 32 const UInt32 kVendorIDNVidia = 0x10de; |
33 const UInt32 kVendorIDAMD = 0x1002; | 33 const UInt32 kVendorIDAMD = 0x1002; |
34 | 34 |
35 // Return 0 if we couldn't find the property. | 35 // Return 0 if we couldn't find the property. |
36 // The property values we use should not be 0, so it's OK to use 0 as failure. | 36 // The property values we use should not be 0, so it's OK to use 0 as failure. |
37 UInt32 GetEntryProperty(io_registry_entry_t entry, CFStringRef property_name) { | 37 UInt32 GetEntryProperty(io_registry_entry_t entry, CFStringRef property_name) { |
38 base::mac::ScopedCFTypeRef<CFDataRef> data_ref(static_cast<CFDataRef>( | 38 base::ScopedCFTypeRef<CFDataRef> data_ref( |
39 IORegistryEntrySearchCFProperty(entry, | 39 static_cast<CFDataRef>(IORegistryEntrySearchCFProperty( |
40 kIOServicePlane, | 40 entry, |
41 property_name, | 41 kIOServicePlane, |
42 kCFAllocatorDefault, | 42 property_name, |
43 kIORegistryIterateRecursively | | 43 kCFAllocatorDefault, |
44 kIORegistryIterateParents))); | 44 kIORegistryIterateRecursively | kIORegistryIterateParents))); |
45 if (!data_ref) | 45 if (!data_ref) |
46 return 0; | 46 return 0; |
47 | 47 |
48 UInt32 value = 0; | 48 UInt32 value = 0; |
49 const UInt32* value_pointer = | 49 const UInt32* value_pointer = |
50 reinterpret_cast<const UInt32*>(CFDataGetBytePtr(data_ref)); | 50 reinterpret_cast<const UInt32*>(CFDataGetBytePtr(data_ref)); |
51 if (value_pointer != NULL) | 51 if (value_pointer != NULL) |
52 value = *value_pointer; | 52 value = *value_pointer; |
53 return value; | 53 return value; |
54 } | 54 } |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 gpu_info->driver_version = gl_version_string.substr(pos + 1); | 211 gpu_info->driver_version = gl_version_string.substr(pos + 1); |
212 return true; | 212 return true; |
213 } | 213 } |
214 | 214 |
215 void MergeGPUInfo(GPUInfo* basic_gpu_info, | 215 void MergeGPUInfo(GPUInfo* basic_gpu_info, |
216 const GPUInfo& context_gpu_info) { | 216 const GPUInfo& context_gpu_info) { |
217 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); | 217 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); |
218 } | 218 } |
219 | 219 |
220 } // namespace gpu | 220 } // namespace gpu |
OLD | NEW |