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/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 *device_id = gpu.device_id; | 178 *device_id = gpu.device_id; |
179 | 179 |
180 if (*vendor_id != 0 && *device_id != 0) | 180 if (*vendor_id != 0 && *device_id != 0) |
181 return kGpuIDSuccess; | 181 return kGpuIDSuccess; |
182 return kGpuIDFailure; | 182 return kGpuIDFailure; |
183 } | 183 } |
184 | 184 |
185 CollectInfoResult CollectBasicGraphicsInfo(GPUInfo* gpu_info) { | 185 CollectInfoResult CollectBasicGraphicsInfo(GPUInfo* gpu_info) { |
186 DCHECK(gpu_info); | 186 DCHECK(gpu_info); |
187 | 187 |
188 std::string model_name; | |
189 int32 model_major = 0, model_minor = 0; | 188 int32 model_major = 0, model_minor = 0; |
190 base::mac::ParseModelIdentifier(base::mac::GetModelIdentifier(), | 189 base::mac::ParseModelIdentifier(base::mac::GetModelIdentifier(), |
191 &model_name, &model_major, &model_minor); | 190 &gpu_info->machine_model_name, |
192 base::ReplaceChars(model_name, " ", "_", &gpu_info->machine_model); | 191 &model_major, &model_minor); |
193 gpu_info->machine_model += " " + base::IntToString(model_major) + | 192 gpu_info->machine_model_version = |
194 "." + base::IntToString(model_minor); | 193 base::IntToString(model_major) + "." + base::IntToString(model_minor); |
195 | 194 |
196 bool result = CollectPCIVideoCardInfo(gpu_info); | 195 bool result = CollectPCIVideoCardInfo(gpu_info); |
197 return result ? kCollectInfoSuccess : kCollectInfoNonFatalFailure; | 196 return result ? kCollectInfoSuccess : kCollectInfoNonFatalFailure; |
198 } | 197 } |
199 | 198 |
200 CollectInfoResult CollectDriverInfoGL(GPUInfo* gpu_info) { | 199 CollectInfoResult CollectDriverInfoGL(GPUInfo* gpu_info) { |
201 DCHECK(gpu_info); | 200 DCHECK(gpu_info); |
202 | 201 |
203 // Extract the OpenGL driver version string from the GL_VERSION string. | 202 // Extract the OpenGL driver version string from the GL_VERSION string. |
204 // Mac OpenGL drivers have the driver version | 203 // Mac OpenGL drivers have the driver version |
205 // at the end of the gl version string preceded by a dash. | 204 // at the end of the gl version string preceded by a dash. |
206 // Use some jiggery-pokery to turn that utf8 string into a std::wstring. | 205 // Use some jiggery-pokery to turn that utf8 string into a std::wstring. |
207 std::string gl_version_string = gpu_info->gl_version_string; | 206 std::string gl_version_string = gpu_info->gl_version_string; |
208 size_t pos = gl_version_string.find_last_of('-'); | 207 size_t pos = gl_version_string.find_last_of('-'); |
209 if (pos == std::string::npos) | 208 if (pos == std::string::npos) |
210 return kCollectInfoNonFatalFailure; | 209 return kCollectInfoNonFatalFailure; |
211 gpu_info->driver_version = gl_version_string.substr(pos + 1); | 210 gpu_info->driver_version = gl_version_string.substr(pos + 1); |
212 return kCollectInfoSuccess; | 211 return kCollectInfoSuccess; |
213 } | 212 } |
214 | 213 |
215 void MergeGPUInfo(GPUInfo* basic_gpu_info, | 214 void MergeGPUInfo(GPUInfo* basic_gpu_info, |
216 const GPUInfo& context_gpu_info) { | 215 const GPUInfo& context_gpu_info) { |
217 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); | 216 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); |
218 } | 217 } |
219 | 218 |
220 } // namespace gpu | 219 } // namespace gpu |
OLD | NEW |