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; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 basic_gpu_info->gl_reset_notification_strategy = | 147 basic_gpu_info->gl_reset_notification_strategy = |
144 context_gpu_info.gl_reset_notification_strategy; | 148 context_gpu_info.gl_reset_notification_strategy; |
145 | 149 |
146 if (!context_gpu_info.driver_vendor.empty()) | 150 if (!context_gpu_info.driver_vendor.empty()) |
147 basic_gpu_info->driver_vendor = context_gpu_info.driver_vendor; | 151 basic_gpu_info->driver_vendor = context_gpu_info.driver_vendor; |
148 if (!context_gpu_info.driver_version.empty()) | 152 if (!context_gpu_info.driver_version.empty()) |
149 basic_gpu_info->driver_version = context_gpu_info.driver_version; | 153 basic_gpu_info->driver_version = context_gpu_info.driver_version; |
150 | 154 |
151 basic_gpu_info->can_lose_context = context_gpu_info.can_lose_context; | 155 basic_gpu_info->can_lose_context = context_gpu_info.can_lose_context; |
152 basic_gpu_info->sandboxed = context_gpu_info.sandboxed; | 156 basic_gpu_info->sandboxed = context_gpu_info.sandboxed; |
| 157 basic_gpu_info->direct_rendering = context_gpu_info.direct_rendering; |
153 basic_gpu_info->finalized = context_gpu_info.finalized; | 158 basic_gpu_info->finalized = context_gpu_info.finalized; |
154 basic_gpu_info->initialization_time = context_gpu_info.initialization_time; | 159 basic_gpu_info->initialization_time = context_gpu_info.initialization_time; |
155 } | 160 } |
156 | 161 |
157 } // namespace gpu | 162 } // namespace gpu |
158 | 163 |
OLD | NEW |