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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/android/build_info.h" | 10 #include "base/android/build_info.h" |
| 11 #include "base/android/jni_android.h" |
11 #include "base/command_line.h" | 12 #include "base/command_line.h" |
12 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
13 #include "base/logging.h" | 14 #include "base/logging.h" |
14 #include "base/native_library.h" | 15 #include "base/native_library.h" |
15 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
16 #include "base/strings/string_piece.h" | 17 #include "base/strings/string_piece.h" |
17 #include "base/strings/string_split.h" | 18 #include "base/strings/string_split.h" |
18 #include "base/strings/string_util.h" | 19 #include "base/strings/string_util.h" |
19 #include "base/strings/stringprintf.h" | 20 #include "base/strings/stringprintf.h" |
20 #include "ui/gl/egl_util.h" | 21 #include "ui/gl/egl_util.h" |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 CollectInfoResult CollectGpuID(uint32_t* vendor_id, uint32_t* device_id) { | 259 CollectInfoResult CollectGpuID(uint32_t* vendor_id, uint32_t* device_id) { |
259 DCHECK(vendor_id && device_id); | 260 DCHECK(vendor_id && device_id); |
260 *vendor_id = 0; | 261 *vendor_id = 0; |
261 *device_id = 0; | 262 *device_id = 0; |
262 return kCollectInfoNonFatalFailure; | 263 return kCollectInfoNonFatalFailure; |
263 } | 264 } |
264 | 265 |
265 CollectInfoResult CollectBasicGraphicsInfo(GPUInfo* gpu_info) { | 266 CollectInfoResult CollectBasicGraphicsInfo(GPUInfo* gpu_info) { |
266 gpu_info->can_lose_context = false; | 267 gpu_info->can_lose_context = false; |
267 | 268 |
268 gpu_info->machine_model_name = | 269 // When command buffer is compiled as a standalone library, the process might |
269 base::android::BuildInfo::GetInstance()->model(); | 270 // not have a Java environment. |
| 271 if (base::android::IsVMInitialized()) { |
| 272 gpu_info->machine_model_name = |
| 273 base::android::BuildInfo::GetInstance()->model(); |
| 274 } |
270 | 275 |
271 // Create a short-lived context on the UI thread to collect the GL strings. | 276 // Create a short-lived context on the UI thread to collect the GL strings. |
272 // Make sure we restore the existing context if there is one. | 277 // Make sure we restore the existing context if there is one. |
273 CollectInfoResult result = CollectDriverInfo(gpu_info); | 278 CollectInfoResult result = CollectDriverInfo(gpu_info); |
274 if (result == kCollectInfoSuccess) | 279 if (result == kCollectInfoSuccess) |
275 result = CollectDriverInfoGL(gpu_info); | 280 result = CollectDriverInfoGL(gpu_info); |
276 gpu_info->basic_info_state = result; | 281 gpu_info->basic_info_state = result; |
277 gpu_info->context_info_state = result; | 282 gpu_info->context_info_state = result; |
278 return result; | 283 return result; |
279 } | 284 } |
280 | 285 |
281 CollectInfoResult CollectDriverInfoGL(GPUInfo* gpu_info) { | 286 CollectInfoResult CollectDriverInfoGL(GPUInfo* gpu_info) { |
282 gpu_info->driver_version = GetDriverVersionFromString( | 287 gpu_info->driver_version = GetDriverVersionFromString( |
283 gpu_info->gl_version); | 288 gpu_info->gl_version); |
284 gpu_info->gpu.vendor_string = gpu_info->gl_vendor; | 289 gpu_info->gpu.vendor_string = gpu_info->gl_vendor; |
285 gpu_info->gpu.device_string = gpu_info->gl_renderer; | 290 gpu_info->gpu.device_string = gpu_info->gl_renderer; |
286 return kCollectInfoSuccess; | 291 return kCollectInfoSuccess; |
287 } | 292 } |
288 | 293 |
289 void MergeGPUInfo(GPUInfo* basic_gpu_info, | 294 void MergeGPUInfo(GPUInfo* basic_gpu_info, |
290 const GPUInfo& context_gpu_info) { | 295 const GPUInfo& context_gpu_info) { |
291 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); | 296 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); |
292 } | 297 } |
293 | 298 |
294 } // namespace gpu | 299 } // namespace gpu |
OLD | NEW |