| 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 CollectInfoResult CollectContextGraphicsInfo(GPUInfo* gpu_info) { | 175 CollectInfoResult CollectContextGraphicsInfo(GPUInfo* gpu_info) { |
| 176 DCHECK(gpu_info); | 176 DCHECK(gpu_info); |
| 177 | 177 |
| 178 TRACE_EVENT0("gpu", "gpu_info_collector::CollectGraphicsInfo"); | 178 TRACE_EVENT0("gpu", "gpu_info_collector::CollectGraphicsInfo"); |
| 179 | 179 |
| 180 CollectInfoResult result = CollectGraphicsInfoGL(gpu_info); | 180 CollectInfoResult result = CollectGraphicsInfoGL(gpu_info); |
| 181 gpu_info->context_info_state = result; | 181 gpu_info->context_info_state = result; |
| 182 return result; | 182 return result; |
| 183 } | 183 } |
| 184 | 184 |
| 185 CollectInfoResult CollectGpuID(uint32_t* vendor_id, uint32_t* device_id) { | |
| 186 DCHECK(vendor_id && device_id); | |
| 187 | |
| 188 GPUInfo::GPUDevice gpu = GetActiveGPU(); | |
| 189 *vendor_id = gpu.vendor_id; | |
| 190 *device_id = gpu.device_id; | |
| 191 | |
| 192 if (*vendor_id != 0 && *device_id != 0) | |
| 193 return kCollectInfoSuccess; | |
| 194 return kCollectInfoNonFatalFailure; | |
| 195 } | |
| 196 | |
| 197 CollectInfoResult CollectBasicGraphicsInfo(GPUInfo* gpu_info) { | 185 CollectInfoResult CollectBasicGraphicsInfo(GPUInfo* gpu_info) { |
| 198 DCHECK(gpu_info); | 186 DCHECK(gpu_info); |
| 199 | 187 |
| 200 int32_t model_major = 0, model_minor = 0; | 188 int32_t model_major = 0, model_minor = 0; |
| 201 base::mac::ParseModelIdentifier(base::mac::GetModelIdentifier(), | 189 base::mac::ParseModelIdentifier(base::mac::GetModelIdentifier(), |
| 202 &gpu_info->machine_model_name, | 190 &gpu_info->machine_model_name, |
| 203 &model_major, &model_minor); | 191 &model_major, &model_minor); |
| 204 gpu_info->machine_model_version = | 192 gpu_info->machine_model_version = |
| 205 base::IntToString(model_major) + "." + base::IntToString(model_minor); | 193 base::IntToString(model_major) + "." + base::IntToString(model_minor); |
| 206 | 194 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 222 gpu_info->driver_version = gpu_info->gl_version.substr(pos + 1); | 210 gpu_info->driver_version = gpu_info->gl_version.substr(pos + 1); |
| 223 return kCollectInfoSuccess; | 211 return kCollectInfoSuccess; |
| 224 } | 212 } |
| 225 | 213 |
| 226 void MergeGPUInfo(GPUInfo* basic_gpu_info, | 214 void MergeGPUInfo(GPUInfo* basic_gpu_info, |
| 227 const GPUInfo& context_gpu_info) { | 215 const GPUInfo& context_gpu_info) { |
| 228 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); | 216 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); |
| 229 } | 217 } |
| 230 | 218 |
| 231 } // namespace gpu | 219 } // namespace gpu |
| OLD | NEW |