Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: gpu/config/gpu_info_collector_mac.mm

Issue 1547793004: Make gpu black list work again on Linux (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clear existing gpu testing switches before each test Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 value = *value_pointer; 54 value = *value_pointer;
55 return value; 55 return value;
56 } 56 }
57 57
58 // Find the info of the current GPU. 58 // Find the info of the current GPU.
59 GPUInfo::GPUDevice GetActiveGPU() { 59 GPUInfo::GPUDevice GetActiveGPU() {
60 GPUInfo::GPUDevice gpu; 60 GPUInfo::GPUDevice gpu;
61 io_registry_entry_t dsp_port = CGDisplayIOServicePort(kCGDirectMainDisplay); 61 io_registry_entry_t dsp_port = CGDisplayIOServicePort(kCGDirectMainDisplay);
62 gpu.vendor_id = GetEntryProperty(dsp_port, CFSTR("vendor-id")); 62 gpu.vendor_id = GetEntryProperty(dsp_port, CFSTR("vendor-id"));
63 gpu.device_id = GetEntryProperty(dsp_port, CFSTR("device-id")); 63 gpu.device_id = GetEntryProperty(dsp_port, CFSTR("device-id"));
64
65 ParseTestingIds(&gpu.vendor_id, &gpu.device_id);
66
64 return gpu; 67 return gpu;
65 } 68 }
66 69
67 // Scan IO registry for PCI video cards. 70 // Scan IO registry for PCI video cards.
68 CollectInfoResult CollectPCIVideoCardInfo(GPUInfo* gpu_info) { 71 CollectInfoResult CollectPCIVideoCardInfo(GPUInfo* gpu_info) {
69 DCHECK(gpu_info); 72 DCHECK(gpu_info);
70 GPUInfo::GPUDevice active_gpu = GetActiveGPU(); 73 GPUInfo::GPUDevice active_gpu = GetActiveGPU();
71 74
72 // Collect all GPUs' info. 75 // Collect all GPUs' info.
73 // match_dictionary will be consumed by IOServiceGetMatchingServices, no need 76 // match_dictionary will be consumed by IOServiceGetMatchingServices, no need
74 // to release it. 77 // to release it.
75 CFMutableDictionaryRef match_dictionary = IOServiceMatching("IOPCIDevice"); 78 CFMutableDictionaryRef match_dictionary = IOServiceMatching("IOPCIDevice");
76 io_iterator_t entry_iterator; 79 io_iterator_t entry_iterator;
77 std::vector<GPUInfo::GPUDevice> gpu_list; 80 std::vector<GPUInfo::GPUDevice> gpu_list;
78 if (IOServiceGetMatchingServices(kIOMasterPortDefault, 81 if (IOServiceGetMatchingServices(kIOMasterPortDefault,
79 match_dictionary, 82 match_dictionary,
80 &entry_iterator) == kIOReturnSuccess) { 83 &entry_iterator) == kIOReturnSuccess) {
81 84
82 base::mac::ScopedIOObject<io_registry_entry_t> entry; 85 base::mac::ScopedIOObject<io_registry_entry_t> entry;
83 while (entry.reset(IOIteratorNext(entry_iterator)), entry) { 86 while (entry.reset(IOIteratorNext(entry_iterator)), entry) {
84 GPUInfo::GPUDevice gpu; 87 GPUInfo::GPUDevice gpu;
85 if (GetEntryProperty(entry, CFSTR("class-code")) != 0x30000) { 88 if (GetEntryProperty(entry, CFSTR("class-code")) != 0x30000) {
86 // 0x30000 : DISPLAY_VGA 89 // 0x30000 : DISPLAY_VGA
87 continue; 90 continue;
88 } 91 }
89 gpu.vendor_id = GetEntryProperty(entry, CFSTR("vendor-id")); 92 gpu.vendor_id = GetEntryProperty(entry, CFSTR("vendor-id"));
90 gpu.device_id = GetEntryProperty(entry, CFSTR("device-id")); 93 gpu.device_id = GetEntryProperty(entry, CFSTR("device-id"));
94
95 ParseTestingIds(&gpu.vendor_id, &gpu.device_id);
96
91 if (gpu.vendor_id && gpu.device_id) { 97 if (gpu.vendor_id && gpu.device_id) {
92 if (gpu.vendor_id == active_gpu.vendor_id && 98 if (gpu.vendor_id == active_gpu.vendor_id &&
93 gpu.device_id == active_gpu.device_id) { 99 gpu.device_id == active_gpu.device_id) {
94 gpu.active = true; 100 gpu.active = true;
95 } 101 }
96 gpu_list.push_back(gpu); 102 gpu_list.push_back(gpu);
97 } 103 }
98 } 104 }
99 IOObjectRelease(entry_iterator); 105 IOObjectRelease(entry_iterator);
100 } 106 }
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 gpu_info->driver_version = gpu_info->gl_version.substr(pos + 1); 223 gpu_info->driver_version = gpu_info->gl_version.substr(pos + 1);
218 return kCollectInfoSuccess; 224 return kCollectInfoSuccess;
219 } 225 }
220 226
221 void MergeGPUInfo(GPUInfo* basic_gpu_info, 227 void MergeGPUInfo(GPUInfo* basic_gpu_info,
222 const GPUInfo& context_gpu_info) { 228 const GPUInfo& context_gpu_info) {
223 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); 229 MergeGPUInfoGL(basic_gpu_info, context_gpu_info);
224 } 230 }
225 231
226 } // namespace gpu 232 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698