| OLD | NEW |
| 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> |
| 8 #include <stdint.h> |
| 9 |
| 7 #include <vector> | 10 #include <vector> |
| 8 | 11 |
| 9 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 10 #include "base/files/file_util.h" | 13 #include "base/files/file_util.h" |
| 11 #include "base/logging.h" | 14 #include "base/logging.h" |
| 12 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/message_loop/message_loop.h" | 16 #include "base/message_loop/message_loop.h" |
| 14 #include "base/strings/string_piece.h" | 17 #include "base/strings/string_piece.h" |
| 15 #include "base/strings/string_split.h" | 18 #include "base/strings/string_split.h" |
| 16 #include "base/strings/string_tokenizer.h" | 19 #include "base/strings/string_tokenizer.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 if (end == std::string::npos) | 67 if (end == std::string::npos) |
| 65 return line.substr(begin); | 68 return line.substr(begin); |
| 66 else | 69 else |
| 67 return line.substr(begin, end - begin); | 70 return line.substr(begin, end - begin); |
| 68 } | 71 } |
| 69 } | 72 } |
| 70 } | 73 } |
| 71 return std::string(); | 74 return std::string(); |
| 72 } | 75 } |
| 73 | 76 |
| 74 const uint32 kVendorIDIntel = 0x8086; | 77 const uint32_t kVendorIDIntel = 0x8086; |
| 75 const uint32 kVendorIDNVidia = 0x10de; | 78 const uint32_t kVendorIDNVidia = 0x10de; |
| 76 const uint32 kVendorIDAMD = 0x1002; | 79 const uint32_t kVendorIDAMD = 0x1002; |
| 77 | 80 |
| 78 CollectInfoResult CollectPCIVideoCardInfo(GPUInfo* gpu_info) { | 81 CollectInfoResult CollectPCIVideoCardInfo(GPUInfo* gpu_info) { |
| 79 DCHECK(gpu_info); | 82 DCHECK(gpu_info); |
| 80 | 83 |
| 81 #if !defined(USE_LIBPCI) | 84 #if !defined(USE_LIBPCI) |
| 82 return kCollectInfoNonFatalFailure; | 85 return kCollectInfoNonFatalFailure; |
| 83 #else | 86 #else |
| 84 | 87 |
| 85 if (IsPciSupported() == false) { | 88 if (IsPciSupported() == false) { |
| 86 VLOG(1) << "PCI bus scanning is not supported"; | 89 VLOG(1) << "PCI bus scanning is not supported"; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 gpu_info->can_lose_context = | 179 gpu_info->can_lose_context = |
| 177 (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2); | 180 (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2); |
| 178 #endif | 181 #endif |
| 179 } | 182 } |
| 180 | 183 |
| 181 CollectInfoResult result = CollectGraphicsInfoGL(gpu_info); | 184 CollectInfoResult result = CollectGraphicsInfoGL(gpu_info); |
| 182 gpu_info->context_info_state = result; | 185 gpu_info->context_info_state = result; |
| 183 return result; | 186 return result; |
| 184 } | 187 } |
| 185 | 188 |
| 186 CollectInfoResult CollectGpuID(uint32* vendor_id, uint32* device_id) { | 189 CollectInfoResult CollectGpuID(uint32_t* vendor_id, uint32_t* device_id) { |
| 187 DCHECK(vendor_id && device_id); | 190 DCHECK(vendor_id && device_id); |
| 188 *vendor_id = 0; | 191 *vendor_id = 0; |
| 189 *device_id = 0; | 192 *device_id = 0; |
| 190 | 193 |
| 191 GPUInfo gpu_info; | 194 GPUInfo gpu_info; |
| 192 CollectInfoResult result = CollectPCIVideoCardInfo(&gpu_info); | 195 CollectInfoResult result = CollectPCIVideoCardInfo(&gpu_info); |
| 193 if (result == kCollectInfoSuccess) { | 196 if (result == kCollectInfoSuccess) { |
| 194 *vendor_id = gpu_info.gpu.vendor_id; | 197 *vendor_id = gpu_info.gpu.vendor_id; |
| 195 *device_id = gpu_info.gpu.device_id; | 198 *device_id = gpu_info.gpu.device_id; |
| 196 } | 199 } |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 gpu_info->driver_version = driver_version; | 269 gpu_info->driver_version = driver_version; |
| 267 return kCollectInfoSuccess; | 270 return kCollectInfoSuccess; |
| 268 } | 271 } |
| 269 | 272 |
| 270 void MergeGPUInfo(GPUInfo* basic_gpu_info, | 273 void MergeGPUInfo(GPUInfo* basic_gpu_info, |
| 271 const GPUInfo& context_gpu_info) { | 274 const GPUInfo& context_gpu_info) { |
| 272 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); | 275 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); |
| 273 } | 276 } |
| 274 | 277 |
| 275 } // namespace gpu | 278 } // namespace gpu |
| OLD | NEW |