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 <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/metrics/sparse_histogram.h" | 12 #include "base/metrics/sparse_histogram.h" |
13 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
14 #include "base/strings/string_piece.h" | 14 #include "base/strings/string_piece.h" |
15 #include "base/strings/string_split.h" | 15 #include "base/strings/string_split.h" |
16 #include "base/trace_event/trace_event.h" | 16 #include "base/trace_event/trace_event.h" |
17 #include "ui/gl/gl_bindings.h" | 17 #include "ui/gl/gl_bindings.h" |
18 #include "ui/gl/gl_context.h" | 18 #include "ui/gl/gl_context.h" |
19 #include "ui/gl/gl_implementation.h" | 19 #include "ui/gl/gl_implementation.h" |
20 #include "ui/gl/gl_surface.h" | 20 #include "ui/gl/gl_surface.h" |
| 21 #include "ui/gl/gl_version_info.h" |
21 | 22 |
22 namespace { | 23 namespace { |
23 | 24 |
24 scoped_refptr<gfx::GLSurface> InitializeGLSurface() { | 25 scoped_refptr<gfx::GLSurface> InitializeGLSurface() { |
25 scoped_refptr<gfx::GLSurface> surface( | 26 scoped_refptr<gfx::GLSurface> surface( |
26 gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size())); | 27 gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size())); |
27 if (!surface.get()) { | 28 if (!surface.get()) { |
28 LOG(ERROR) << "gfx::GLContext::CreateOffscreenGLSurface failed"; | 29 LOG(ERROR) << "gfx::GLContext::CreateOffscreenGLSurface failed"; |
29 return NULL; | 30 return NULL; |
30 } | 31 } |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 if (!context.get()) { | 96 if (!context.get()) { |
96 LOG(ERROR) << "Could not create context for info collection."; | 97 LOG(ERROR) << "Could not create context for info collection."; |
97 return kCollectInfoFatalFailure; | 98 return kCollectInfoFatalFailure; |
98 } | 99 } |
99 | 100 |
100 gpu_info->gl_renderer = GetGLString(GL_RENDERER); | 101 gpu_info->gl_renderer = GetGLString(GL_RENDERER); |
101 gpu_info->gl_vendor = GetGLString(GL_VENDOR); | 102 gpu_info->gl_vendor = GetGLString(GL_VENDOR); |
102 gpu_info->gl_extensions = gfx::GetGLExtensionsFromCurrentContext(); | 103 gpu_info->gl_extensions = gfx::GetGLExtensionsFromCurrentContext(); |
103 gpu_info->gl_version = GetGLString(GL_VERSION); | 104 gpu_info->gl_version = GetGLString(GL_VERSION); |
104 std::string glsl_version_string = GetGLString(GL_SHADING_LANGUAGE_VERSION); | 105 std::string glsl_version_string = GetGLString(GL_SHADING_LANGUAGE_VERSION); |
| 106 |
| 107 gfx::GLVersionInfo gl_info(gpu_info->gl_version.c_str(), |
| 108 gpu_info->gl_renderer.c_str(), |
| 109 gpu_info->gl_extensions.c_str()); |
105 GLint max_samples = 0; | 110 GLint max_samples = 0; |
106 glGetIntegerv(GL_MAX_SAMPLES, &max_samples); | 111 if (gl_info.IsAtLeastGL(3, 0) || gl_info.IsAtLeastGLES(3, 0) || |
| 112 gpu_info->gl_extensions.find("GL_ANGLE_framebuffer_multisample") != |
| 113 std::string::npos || |
| 114 gpu_info->gl_extensions.find("GL_APPLE_framebuffer_multisample") != |
| 115 std::string::npos || |
| 116 gpu_info->gl_extensions.find("GL_EXT_framebuffer_multisample") != |
| 117 std::string::npos || |
| 118 gpu_info->gl_extensions.find("GL_EXT_multisampled_render_to_texture") != |
| 119 std::string::npos || |
| 120 gpu_info->gl_extensions.find("GL_NV_framebuffer_multisample") != |
| 121 std::string::npos) { |
| 122 glGetIntegerv(GL_MAX_SAMPLES, &max_samples); |
| 123 } |
107 gpu_info->max_msaa_samples = base::IntToString(max_samples); | 124 gpu_info->max_msaa_samples = base::IntToString(max_samples); |
108 UMA_HISTOGRAM_SPARSE_SLOWLY("GPU.MaxMSAASampleCount", max_samples); | 125 UMA_HISTOGRAM_SPARSE_SLOWLY("GPU.MaxMSAASampleCount", max_samples); |
109 | 126 |
110 gfx::GLWindowSystemBindingInfo window_system_binding_info; | 127 gfx::GLWindowSystemBindingInfo window_system_binding_info; |
111 if (GetGLWindowSystemBindingInfo(&window_system_binding_info)) { | 128 if (GetGLWindowSystemBindingInfo(&window_system_binding_info)) { |
112 gpu_info->gl_ws_vendor = window_system_binding_info.vendor; | 129 gpu_info->gl_ws_vendor = window_system_binding_info.vendor; |
113 gpu_info->gl_ws_version = window_system_binding_info.version; | 130 gpu_info->gl_ws_version = window_system_binding_info.version; |
114 gpu_info->gl_ws_extensions = window_system_binding_info.extensions; | 131 gpu_info->gl_ws_extensions = window_system_binding_info.extensions; |
115 gpu_info->direct_rendering = window_system_binding_info.direct_rendering; | 132 gpu_info->direct_rendering = window_system_binding_info.direct_rendering; |
116 } | 133 } |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 basic_gpu_info->video_decode_accelerator_supported_profiles = | 185 basic_gpu_info->video_decode_accelerator_supported_profiles = |
169 context_gpu_info.video_decode_accelerator_supported_profiles; | 186 context_gpu_info.video_decode_accelerator_supported_profiles; |
170 basic_gpu_info->video_encode_accelerator_supported_profiles = | 187 basic_gpu_info->video_encode_accelerator_supported_profiles = |
171 context_gpu_info.video_encode_accelerator_supported_profiles; | 188 context_gpu_info.video_encode_accelerator_supported_profiles; |
172 basic_gpu_info->jpeg_decode_accelerator_supported = | 189 basic_gpu_info->jpeg_decode_accelerator_supported = |
173 context_gpu_info.jpeg_decode_accelerator_supported; | 190 context_gpu_info.jpeg_decode_accelerator_supported; |
174 } | 191 } |
175 | 192 |
176 } // namespace gpu | 193 } // namespace gpu |
177 | 194 |
OLD | NEW |