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/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 if (pieces.size() >= 2) | 73 if (pieces.size() >= 2) |
74 return pieces[0] + "." + pieces[1]; | 74 return pieces[0] + "." + pieces[1]; |
75 } | 75 } |
76 return std::string(); | 76 return std::string(); |
77 } | 77 } |
78 | 78 |
79 } // namespace anonymous | 79 } // namespace anonymous |
80 | 80 |
81 namespace gpu { | 81 namespace gpu { |
82 | 82 |
83 bool CollectGraphicsInfoGL(GPUInfo* gpu_info) { | 83 CollectInfoResult CollectGraphicsInfoGL(GPUInfo* gpu_info) { |
84 TRACE_EVENT0("startup", "gpu_info_collector::CollectGraphicsInfoGL"); | 84 TRACE_EVENT0("startup", "gpu_info_collector::CollectGraphicsInfoGL"); |
85 DCHECK_NE(gfx::GetGLImplementation(), gfx::kGLImplementationNone); | 85 DCHECK_NE(gfx::GetGLImplementation(), gfx::kGLImplementationNone); |
86 | 86 |
87 scoped_refptr<gfx::GLSurface> surface(InitializeGLSurface()); | 87 scoped_refptr<gfx::GLSurface> surface(InitializeGLSurface()); |
88 if (!surface.get()) | 88 if (!surface.get()) { |
89 return false; | 89 LOG(ERROR) << "Could not create surface for info collection."; |
| 90 return kCollectInfoFatalFailure; |
| 91 } |
90 | 92 |
91 scoped_refptr<gfx::GLContext> context(InitializeGLContext(surface.get())); | 93 scoped_refptr<gfx::GLContext> context(InitializeGLContext(surface.get())); |
92 if (!context.get()) | 94 if (!context.get()) { |
93 return false; | 95 LOG(ERROR) << "Could not create context for info collection."; |
| 96 return kCollectInfoFatalFailure; |
| 97 } |
94 | 98 |
95 gpu_info->gl_renderer = GetGLString(GL_RENDERER); | 99 gpu_info->gl_renderer = GetGLString(GL_RENDERER); |
96 gpu_info->gl_vendor = GetGLString(GL_VENDOR); | 100 gpu_info->gl_vendor = GetGLString(GL_VENDOR); |
97 gpu_info->gl_extensions = GetGLString(GL_EXTENSIONS); | 101 gpu_info->gl_extensions = GetGLString(GL_EXTENSIONS); |
98 gpu_info->gl_version_string = GetGLString(GL_VERSION); | 102 gpu_info->gl_version_string = GetGLString(GL_VERSION); |
99 std::string glsl_version_string = GetGLString(GL_SHADING_LANGUAGE_VERSION); | 103 std::string glsl_version_string = GetGLString(GL_SHADING_LANGUAGE_VERSION); |
100 | 104 |
101 gfx::GLWindowSystemBindingInfo window_system_binding_info; | 105 gfx::GLWindowSystemBindingInfo window_system_binding_info; |
102 if (GetGLWindowSystemBindingInfo(&window_system_binding_info)) { | 106 if (GetGLWindowSystemBindingInfo(&window_system_binding_info)) { |
103 gpu_info->gl_ws_vendor = window_system_binding_info.vendor; | 107 gpu_info->gl_ws_vendor = window_system_binding_info.vendor; |
104 gpu_info->gl_ws_version = window_system_binding_info.version; | 108 gpu_info->gl_ws_version = window_system_binding_info.version; |
105 gpu_info->gl_ws_extensions = window_system_binding_info.extensions; | 109 gpu_info->gl_ws_extensions = window_system_binding_info.extensions; |
| 110 gpu_info->direct_rendering = window_system_binding_info.direct_rendering; |
106 } | 111 } |
107 | 112 |
108 bool supports_robustness = | 113 bool supports_robustness = |
109 gpu_info->gl_extensions.find("GL_EXT_robustness") != std::string::npos || | 114 gpu_info->gl_extensions.find("GL_EXT_robustness") != std::string::npos || |
110 gpu_info->gl_extensions.find("GL_ARB_robustness") != std::string::npos; | 115 gpu_info->gl_extensions.find("GL_ARB_robustness") != std::string::npos; |
111 if (supports_robustness) { | 116 if (supports_robustness) { |
112 glGetIntegerv(GL_RESET_NOTIFICATION_STRATEGY_ARB, | 117 glGetIntegerv(GL_RESET_NOTIFICATION_STRATEGY_ARB, |
113 reinterpret_cast<GLint*>(&gpu_info->gl_reset_notification_strategy)); | 118 reinterpret_cast<GLint*>(&gpu_info->gl_reset_notification_strategy)); |
114 } | 119 } |
115 | 120 |
(...skipping 27 matching lines...) Expand all Loading... |
143 basic_gpu_info->gl_reset_notification_strategy = | 148 basic_gpu_info->gl_reset_notification_strategy = |
144 context_gpu_info.gl_reset_notification_strategy; | 149 context_gpu_info.gl_reset_notification_strategy; |
145 | 150 |
146 if (!context_gpu_info.driver_vendor.empty()) | 151 if (!context_gpu_info.driver_vendor.empty()) |
147 basic_gpu_info->driver_vendor = context_gpu_info.driver_vendor; | 152 basic_gpu_info->driver_vendor = context_gpu_info.driver_vendor; |
148 if (!context_gpu_info.driver_version.empty()) | 153 if (!context_gpu_info.driver_version.empty()) |
149 basic_gpu_info->driver_version = context_gpu_info.driver_version; | 154 basic_gpu_info->driver_version = context_gpu_info.driver_version; |
150 | 155 |
151 basic_gpu_info->can_lose_context = context_gpu_info.can_lose_context; | 156 basic_gpu_info->can_lose_context = context_gpu_info.can_lose_context; |
152 basic_gpu_info->sandboxed = context_gpu_info.sandboxed; | 157 basic_gpu_info->sandboxed = context_gpu_info.sandboxed; |
| 158 basic_gpu_info->direct_rendering = context_gpu_info.direct_rendering; |
153 basic_gpu_info->finalized = context_gpu_info.finalized; | 159 basic_gpu_info->finalized = context_gpu_info.finalized; |
154 basic_gpu_info->initialization_time = context_gpu_info.initialization_time; | 160 basic_gpu_info->initialization_time = context_gpu_info.initialization_time; |
155 } | 161 } |
156 | 162 |
157 } // namespace gpu | 163 } // namespace gpu |
158 | 164 |
OLD | NEW |