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

Side by Side Diff: gpu/config/gpu_info_collector_linux.cc

Issue 1547793004: Make gpu black list work again on Linux (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_linux.h" 5 #include "gpu/config/gpu_info_collector_linux.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/files/file_util.h" 13 #include "base/files/file_util.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/message_loop/message_loop.h" 16 #include "base/message_loop/message_loop.h"
17 #include "base/strings/string_number_conversions.h"
17 #include "base/strings/string_piece.h" 18 #include "base/strings/string_piece.h"
18 #include "base/strings/string_split.h" 19 #include "base/strings/string_split.h"
19 #include "base/strings/string_tokenizer.h" 20 #include "base/strings/string_tokenizer.h"
20 #include "base/strings/string_util.h" 21 #include "base/strings/string_util.h"
21 #include "base/trace_event/trace_event.h" 22 #include "base/trace_event/trace_event.h"
22 #include "gpu/config/gpu_info_collector.h" 23 #include "gpu/config/gpu_info_collector.h"
24 #include "gpu/config/gpu_switches.h"
23 #include "ui/gl/gl_bindings.h" 25 #include "ui/gl/gl_bindings.h"
24 #include "ui/gl/gl_context.h" 26 #include "ui/gl/gl_context.h"
25 #include "ui/gl/gl_implementation.h" 27 #include "ui/gl/gl_implementation.h"
26 #include "ui/gl/gl_surface.h" 28 #include "ui/gl/gl_surface.h"
27 #include "ui/gl/gl_switches.h" 29 #include "ui/gl/gl_switches.h"
28 30
29 #if defined(USE_LIBPCI) 31 #if defined(USE_LIBPCI)
30 #include "library_loaders/libpci.h" 32 #include "library_loaders/libpci.h"
31 #endif 33 #endif
32 34
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 case PCI_CLASS_DISPLAY_OTHER: 119 case PCI_CLASS_DISPLAY_OTHER:
118 default: 120 default:
119 break; 121 break;
120 } 122 }
121 if (!is_gpu) 123 if (!is_gpu)
122 continue; 124 continue;
123 if (device->vendor_id == 0 || device->device_id == 0) 125 if (device->vendor_id == 0 || device->device_id == 0)
124 continue; 126 continue;
125 127
126 GPUInfo::GPUDevice gpu; 128 GPUInfo::GPUDevice gpu;
127 gpu.vendor_id = device->vendor_id; 129
128 gpu.device_id = device->device_id; 130 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
131
132 if (command_line->HasSwitch(switches::kGpuTestingVendorId))
133 base::HexStringToUInt(
134 command_line->GetSwitchValueASCII(switches::kGpuTestingVendorId),
135 &gpu.vendor_id);
136 else
137 gpu.vendor_id = device->vendor_id;
138
139 if (command_line->HasSwitch(switches::kGpuTestingDeviceId))
140 base::HexStringToUInt(
141 command_line->GetSwitchValueASCII(switches::kGpuTestingDeviceId),
142 &gpu.device_id);
143 else
144 gpu.device_id = device->device_id;
129 145
130 if (!primary_gpu_identified) { 146 if (!primary_gpu_identified) {
131 primary_gpu_identified = true; 147 primary_gpu_identified = true;
132 gpu_info->gpu = gpu; 148 gpu_info->gpu = gpu;
133 } else { 149 } else {
134 // TODO(zmo): if there are multiple GPUs, we assume the non Intel 150 // TODO(zmo): if there are multiple GPUs, we assume the non Intel
135 // one is primary. Revisit this logic because we actually don't know 151 // one is primary. Revisit this logic because we actually don't know
136 // which GPU we are using at this point. 152 // which GPU we are using at this point.
137 if (gpu_info->gpu.vendor_id == kVendorIDIntel && 153 if (gpu_info->gpu.vendor_id == kVendorIDIntel &&
138 gpu.vendor_id != kVendorIDIntel) { 154 gpu.vendor_id != kVendorIDIntel) {
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 gpu_info->driver_version = driver_version; 285 gpu_info->driver_version = driver_version;
270 return kCollectInfoSuccess; 286 return kCollectInfoSuccess;
271 } 287 }
272 288
273 void MergeGPUInfo(GPUInfo* basic_gpu_info, 289 void MergeGPUInfo(GPUInfo* basic_gpu_info,
274 const GPUInfo& context_gpu_info) { 290 const GPUInfo& context_gpu_info) {
275 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); 291 MergeGPUInfoGL(basic_gpu_info, context_gpu_info);
276 } 292 }
277 293
278 } // namespace gpu 294 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698