| 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/android/jni_android.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/native_library.h" | 15 #include "base/native_library.h" |
| 16 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
| 17 #include "base/strings/string_piece.h" | 17 #include "base/strings/string_piece.h" |
| 18 #include "base/strings/string_split.h" | 18 #include "base/strings/string_split.h" |
| 19 #include "base/strings/string_util.h" | 19 #include "base/strings/string_util.h" |
| 20 #include "base/strings/stringprintf.h" | 20 #include "base/strings/stringprintf.h" |
| 21 #include "gpu/config/gpu_switches.h" | |
| 22 #include "ui/gl/egl_util.h" | 21 #include "ui/gl/egl_util.h" |
| 23 #include "ui/gl/gl_bindings.h" | 22 #include "ui/gl/gl_bindings.h" |
| 24 #include "ui/gl/gl_context.h" | 23 #include "ui/gl/gl_context.h" |
| 25 #include "ui/gl/gl_surface.h" | 24 #include "ui/gl/gl_surface.h" |
| 26 | 25 |
| 27 namespace { | 26 namespace { |
| 28 | 27 |
| 29 std::pair<std::string, size_t> GetVersionFromString( | 28 std::pair<std::string, size_t> GetVersionFromString( |
| 30 const std::string& version_string, | 29 const std::string& version_string, |
| 31 size_t begin = 0) { | 30 size_t begin = 0) { |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 eglMakeCurrentFn(temp_display, temp_surface, temp_surface, temp_context); | 198 eglMakeCurrentFn(temp_display, temp_surface, temp_surface, temp_context); |
| 200 | 199 |
| 201 gpu_info->gl_vendor = reinterpret_cast<const char*>(glGetStringFn(GL_VENDOR)); | 200 gpu_info->gl_vendor = reinterpret_cast<const char*>(glGetStringFn(GL_VENDOR)); |
| 202 gpu_info->gl_version = | 201 gpu_info->gl_version = |
| 203 reinterpret_cast<const char*>(glGetStringFn(GL_VERSION)); | 202 reinterpret_cast<const char*>(glGetStringFn(GL_VERSION)); |
| 204 gpu_info->gl_renderer = | 203 gpu_info->gl_renderer = |
| 205 reinterpret_cast<const char*>(glGetStringFn(GL_RENDERER)); | 204 reinterpret_cast<const char*>(glGetStringFn(GL_RENDERER)); |
| 206 gpu_info->gl_extensions = | 205 gpu_info->gl_extensions = |
| 207 reinterpret_cast<const char*>(glGetStringFn(GL_EXTENSIONS)); | 206 reinterpret_cast<const char*>(glGetStringFn(GL_EXTENSIONS)); |
| 208 | 207 |
| 209 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | |
| 210 if (command_line->HasSwitch(switches::kGpuTestingGLVendor)) { | |
| 211 gpu_info->gl_vendor = | |
| 212 command_line->GetSwitchValueASCII(switches::kGpuTestingGLVendor); | |
| 213 } | |
| 214 if (command_line->HasSwitch(switches::kGpuTestingGLRenderer)) { | |
| 215 gpu_info->gl_renderer = | |
| 216 command_line->GetSwitchValueASCII(switches::kGpuTestingGLRenderer); | |
| 217 } | |
| 218 if (command_line->HasSwitch(switches::kGpuTestingGLVersion)) { | |
| 219 gpu_info->gl_version = | |
| 220 command_line->GetSwitchValueASCII(switches::kGpuTestingGLVersion); | |
| 221 } | |
| 222 | |
| 223 GLint max_samples = 0; | 208 GLint max_samples = 0; |
| 224 glGetIntegervFn(GL_MAX_SAMPLES, &max_samples); | 209 glGetIntegervFn(GL_MAX_SAMPLES, &max_samples); |
| 225 gpu_info->max_msaa_samples = base::IntToString(max_samples); | 210 gpu_info->max_msaa_samples = base::IntToString(max_samples); |
| 226 | 211 |
| 227 bool supports_robustness = | 212 bool supports_robustness = |
| 228 gpu_info->gl_extensions.find("GL_EXT_robustness") != std::string::npos || | 213 gpu_info->gl_extensions.find("GL_EXT_robustness") != std::string::npos || |
| 229 gpu_info->gl_extensions.find("GL_KHR_robustness") != std::string::npos || | 214 gpu_info->gl_extensions.find("GL_KHR_robustness") != std::string::npos || |
| 230 gpu_info->gl_extensions.find("GL_ARB_robustness") != std::string::npos; | 215 gpu_info->gl_extensions.find("GL_ARB_robustness") != std::string::npos; |
| 231 | 216 |
| 232 if (supports_robustness) { | 217 if (supports_robustness) { |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 gpu_info->gpu.device_string = gpu_info->gl_renderer; | 290 gpu_info->gpu.device_string = gpu_info->gl_renderer; |
| 306 return kCollectInfoSuccess; | 291 return kCollectInfoSuccess; |
| 307 } | 292 } |
| 308 | 293 |
| 309 void MergeGPUInfo(GPUInfo* basic_gpu_info, | 294 void MergeGPUInfo(GPUInfo* basic_gpu_info, |
| 310 const GPUInfo& context_gpu_info) { | 295 const GPUInfo& context_gpu_info) { |
| 311 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); | 296 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); |
| 312 } | 297 } |
| 313 | 298 |
| 314 } // namespace gpu | 299 } // namespace gpu |
| OLD | NEW |