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