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/logging.h" | 9 #include "base/logging.h" |
10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 return 0; | 47 return 0; |
48 | 48 |
49 UInt32 value = 0; | 49 UInt32 value = 0; |
50 const UInt32* value_pointer = | 50 const UInt32* value_pointer = |
51 reinterpret_cast<const UInt32*>(CFDataGetBytePtr(data_ref)); | 51 reinterpret_cast<const UInt32*>(CFDataGetBytePtr(data_ref)); |
52 if (value_pointer != NULL) | 52 if (value_pointer != NULL) |
53 value = *value_pointer; | 53 value = *value_pointer; |
54 return value; | 54 return value; |
55 } | 55 } |
56 | 56 |
| 57 // CGDisplayIOServicePort is deprecated as of macOS 10.9, but has no |
| 58 // replacement. |
| 59 // https://crbug.com/650837 |
| 60 #pragma clang diagnostic push |
| 61 #pragma clang diagnostic ignored "-Wdeprecated-declarations" |
| 62 |
57 // Find the info of the current GPU. | 63 // Find the info of the current GPU. |
58 GPUInfo::GPUDevice GetActiveGPU() { | 64 GPUInfo::GPUDevice GetActiveGPU() { |
59 GPUInfo::GPUDevice gpu; | 65 GPUInfo::GPUDevice gpu; |
60 io_registry_entry_t dsp_port = CGDisplayIOServicePort(kCGDirectMainDisplay); | 66 io_registry_entry_t dsp_port = CGDisplayIOServicePort(kCGDirectMainDisplay); |
61 gpu.vendor_id = GetEntryProperty(dsp_port, CFSTR("vendor-id")); | 67 gpu.vendor_id = GetEntryProperty(dsp_port, CFSTR("vendor-id")); |
62 gpu.device_id = GetEntryProperty(dsp_port, CFSTR("device-id")); | 68 gpu.device_id = GetEntryProperty(dsp_port, CFSTR("device-id")); |
63 return gpu; | 69 return gpu; |
64 } | 70 } |
65 | 71 |
| 72 #pragma clang diagnostic pop |
| 73 |
66 // Scan IO registry for PCI video cards. | 74 // Scan IO registry for PCI video cards. |
67 CollectInfoResult CollectPCIVideoCardInfo(GPUInfo* gpu_info) { | 75 CollectInfoResult CollectPCIVideoCardInfo(GPUInfo* gpu_info) { |
68 DCHECK(gpu_info); | 76 DCHECK(gpu_info); |
69 GPUInfo::GPUDevice active_gpu = GetActiveGPU(); | 77 GPUInfo::GPUDevice active_gpu = GetActiveGPU(); |
70 | 78 |
71 // Collect all GPUs' info. | 79 // Collect all GPUs' info. |
72 // match_dictionary will be consumed by IOServiceGetMatchingServices, no need | 80 // match_dictionary will be consumed by IOServiceGetMatchingServices, no need |
73 // to release it. | 81 // to release it. |
74 CFMutableDictionaryRef match_dictionary = IOServiceMatching("IOPCIDevice"); | 82 CFMutableDictionaryRef match_dictionary = IOServiceMatching("IOPCIDevice"); |
75 io_iterator_t entry_iterator; | 83 io_iterator_t entry_iterator; |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 gpu_info->driver_version = gpu_info->gl_version.substr(pos + 1); | 222 gpu_info->driver_version = gpu_info->gl_version.substr(pos + 1); |
215 return kCollectInfoSuccess; | 223 return kCollectInfoSuccess; |
216 } | 224 } |
217 | 225 |
218 void MergeGPUInfo(GPUInfo* basic_gpu_info, | 226 void MergeGPUInfo(GPUInfo* basic_gpu_info, |
219 const GPUInfo& context_gpu_info) { | 227 const GPUInfo& context_gpu_info) { |
220 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); | 228 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); |
221 } | 229 } |
222 | 230 |
223 } // namespace gpu | 231 } // namespace gpu |
OLD | NEW |