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 "base/android/build_info.h" | 7 #include "base/android/build_info.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 return; | 77 return; |
78 | 78 |
79 if (!eglMakeCurrent(display_, draw_surface_, read_surface_, context_)) | 79 if (!eglMakeCurrent(display_, draw_surface_, read_surface_, context_)) |
80 LOG(WARNING) << "Failed to restore EGL context"; | 80 LOG(WARNING) << "Failed to restore EGL context"; |
81 } | 81 } |
82 | 82 |
83 } | 83 } |
84 | 84 |
85 namespace gpu { | 85 namespace gpu { |
86 | 86 |
87 bool CollectContextGraphicsInfo(GPUInfo* gpu_info) { | 87 CollectInfoResult CollectContextGraphicsInfo(GPUInfo* gpu_info) { |
88 return CollectBasicGraphicsInfo(gpu_info); | 88 return CollectBasicGraphicsInfo(gpu_info); |
89 } | 89 } |
90 | 90 |
91 GpuIDResult CollectGpuID(uint32* vendor_id, uint32* device_id) { | 91 GpuIDResult CollectGpuID(uint32* vendor_id, uint32* device_id) { |
92 DCHECK(vendor_id && device_id); | 92 DCHECK(vendor_id && device_id); |
93 *vendor_id = 0; | 93 *vendor_id = 0; |
94 *device_id = 0; | 94 *device_id = 0; |
95 return kGpuIDNotSupported; | 95 return kGpuIDNotSupported; |
96 } | 96 } |
97 | 97 |
98 bool CollectBasicGraphicsInfo(GPUInfo* gpu_info) { | 98 CollectInfoResult CollectBasicGraphicsInfo(GPUInfo* gpu_info) { |
99 gpu_info->can_lose_context = false; | 99 gpu_info->can_lose_context = false; |
100 gpu_info->finalized = true; | 100 gpu_info->finalized = true; |
101 | 101 |
102 gpu_info->machine_model = base::android::BuildInfo::GetInstance()->model(); | 102 gpu_info->machine_model = base::android::BuildInfo::GetInstance()->model(); |
103 | 103 |
104 // Create a short-lived context on the UI thread to collect the GL strings. | 104 // Create a short-lived context on the UI thread to collect the GL strings. |
105 // Make sure we restore the existing context if there is one. | 105 // Make sure we restore the existing context if there is one. |
106 ScopedRestoreNonOwnedEGLContext restore_context; | 106 ScopedRestoreNonOwnedEGLContext restore_context; |
107 return CollectGraphicsInfoGL(gpu_info); | 107 return CollectGraphicsInfoGL(gpu_info); |
108 } | 108 } |
109 | 109 |
110 bool CollectDriverInfoGL(GPUInfo* gpu_info) { | 110 CollectInfoResult CollectDriverInfoGL(GPUInfo* gpu_info) { |
111 gpu_info->driver_version = GetDriverVersionFromString( | 111 gpu_info->driver_version = GetDriverVersionFromString( |
112 gpu_info->gl_version_string); | 112 gpu_info->gl_version_string); |
113 gpu_info->gpu.vendor_string = gpu_info->gl_vendor; | 113 gpu_info->gpu.vendor_string = gpu_info->gl_vendor; |
114 gpu_info->gpu.device_string = gpu_info->gl_renderer; | 114 gpu_info->gpu.device_string = gpu_info->gl_renderer; |
115 return true; | 115 return kCollectInfoSuccess; |
116 } | 116 } |
117 | 117 |
118 void MergeGPUInfo(GPUInfo* basic_gpu_info, | 118 void MergeGPUInfo(GPUInfo* basic_gpu_info, |
119 const GPUInfo& context_gpu_info) { | 119 const GPUInfo& context_gpu_info) { |
120 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); | 120 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); |
121 } | 121 } |
122 | 122 |
123 } // namespace gpu | 123 } // namespace gpu |
OLD | NEW |