Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(576)

Side by Side Diff: gpu/config/gpu_info_collector.cc

Issue 2347383002: X11: Use better visuals for OpenGL (Closed)
Patch Set: auto* Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gpu/config/gpu_info.cc ('k') | gpu/ipc/common/gpu_info.mojom » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/metrics/sparse_histogram.h" 15 #include "base/metrics/sparse_histogram.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/trace_event/trace_event.h" 20 #include "base/trace_event/trace_event.h"
21 #include "gpu/config/gpu_switches.h" 21 #include "gpu/config/gpu_switches.h"
22 #include "ui/gl/gl_bindings.h" 22 #include "ui/gl/gl_bindings.h"
23 #include "ui/gl/gl_context.h" 23 #include "ui/gl/gl_context.h"
24 #include "ui/gl/gl_implementation.h" 24 #include "ui/gl/gl_implementation.h"
25 #include "ui/gl/gl_surface.h" 25 #include "ui/gl/gl_surface.h"
26 #include "ui/gl/gl_version_info.h" 26 #include "ui/gl/gl_version_info.h"
27 #include "ui/gl/init/gl_factory.h" 27 #include "ui/gl/init/gl_factory.h"
28 28
29 #if defined(USE_X11) && !defined(OS_CHROMEOS)
30 #include "ui/gl/gl_visual_picker_glx.h"
31 #endif
32
29 namespace { 33 namespace {
30 34
31 scoped_refptr<gl::GLSurface> InitializeGLSurface() { 35 scoped_refptr<gl::GLSurface> InitializeGLSurface() {
32 scoped_refptr<gl::GLSurface> surface( 36 scoped_refptr<gl::GLSurface> surface(
33 gl::init::CreateOffscreenGLSurface(gfx::Size())); 37 gl::init::CreateOffscreenGLSurface(gfx::Size()));
34 if (!surface.get()) { 38 if (!surface.get()) {
35 LOG(ERROR) << "gl::GLContext::CreateOffscreenGLSurface failed"; 39 LOG(ERROR) << "gl::GLContext::CreateOffscreenGLSurface failed";
36 return NULL; 40 return NULL;
37 } 41 }
38 42
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 170
167 bool supports_robustness = 171 bool supports_robustness =
168 gpu_info->gl_extensions.find("GL_EXT_robustness") != std::string::npos || 172 gpu_info->gl_extensions.find("GL_EXT_robustness") != std::string::npos ||
169 gpu_info->gl_extensions.find("GL_KHR_robustness") != std::string::npos || 173 gpu_info->gl_extensions.find("GL_KHR_robustness") != std::string::npos ||
170 gpu_info->gl_extensions.find("GL_ARB_robustness") != std::string::npos; 174 gpu_info->gl_extensions.find("GL_ARB_robustness") != std::string::npos;
171 if (supports_robustness) { 175 if (supports_robustness) {
172 glGetIntegerv(GL_RESET_NOTIFICATION_STRATEGY_ARB, 176 glGetIntegerv(GL_RESET_NOTIFICATION_STRATEGY_ARB,
173 reinterpret_cast<GLint*>(&gpu_info->gl_reset_notification_strategy)); 177 reinterpret_cast<GLint*>(&gpu_info->gl_reset_notification_strategy));
174 } 178 }
175 179
180 #if defined(USE_X11) && !defined(OS_CHROMEOS)
181 if (gl::GetGLImplementation() == gl::kGLImplementationDesktopGL) {
182 gl::GLVisualPickerGLX* visual_picker = gl::GLVisualPickerGLX::GetInstance();
183 gpu_info->system_visual = visual_picker->system_visual().visualid;
184 gpu_info->rgba_visual = visual_picker->rgba_visual().visualid;
185 }
186 #endif
187
176 // TODO(kbr): remove once the destruction of a current context automatically 188 // TODO(kbr): remove once the destruction of a current context automatically
177 // clears the current context. 189 // clears the current context.
178 context->ReleaseCurrent(surface.get()); 190 context->ReleaseCurrent(surface.get());
179 191
180 std::string glsl_version = GetVersionFromString(glsl_version_string); 192 std::string glsl_version = GetVersionFromString(glsl_version_string);
181 gpu_info->pixel_shader_version = glsl_version; 193 gpu_info->pixel_shader_version = glsl_version;
182 gpu_info->vertex_shader_version = glsl_version; 194 gpu_info->vertex_shader_version = glsl_version;
183 195
184 IdentifyActiveGPU(gpu_info); 196 IdentifyActiveGPU(gpu_info);
185 return CollectDriverInfoGL(gpu_info); 197 return CollectDriverInfoGL(gpu_info);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 basic_gpu_info->direct_rendering = context_gpu_info.direct_rendering; 229 basic_gpu_info->direct_rendering = context_gpu_info.direct_rendering;
218 basic_gpu_info->in_process_gpu = context_gpu_info.in_process_gpu; 230 basic_gpu_info->in_process_gpu = context_gpu_info.in_process_gpu;
219 basic_gpu_info->context_info_state = context_gpu_info.context_info_state; 231 basic_gpu_info->context_info_state = context_gpu_info.context_info_state;
220 basic_gpu_info->initialization_time = context_gpu_info.initialization_time; 232 basic_gpu_info->initialization_time = context_gpu_info.initialization_time;
221 basic_gpu_info->video_decode_accelerator_capabilities = 233 basic_gpu_info->video_decode_accelerator_capabilities =
222 context_gpu_info.video_decode_accelerator_capabilities; 234 context_gpu_info.video_decode_accelerator_capabilities;
223 basic_gpu_info->video_encode_accelerator_supported_profiles = 235 basic_gpu_info->video_encode_accelerator_supported_profiles =
224 context_gpu_info.video_encode_accelerator_supported_profiles; 236 context_gpu_info.video_encode_accelerator_supported_profiles;
225 basic_gpu_info->jpeg_decode_accelerator_supported = 237 basic_gpu_info->jpeg_decode_accelerator_supported =
226 context_gpu_info.jpeg_decode_accelerator_supported; 238 context_gpu_info.jpeg_decode_accelerator_supported;
239
240 #if defined(USE_X11) && !defined(OS_CHROMEOS)
241 basic_gpu_info->system_visual = context_gpu_info.system_visual;
242 basic_gpu_info->rgba_visual = context_gpu_info.rgba_visual;
243 #endif
227 } 244 }
228 245
229 void IdentifyActiveGPU(GPUInfo* gpu_info) { 246 void IdentifyActiveGPU(GPUInfo* gpu_info) {
230 const std::string kNVidiaName = "nvidia"; 247 const std::string kNVidiaName = "nvidia";
231 const std::string kNouveauName = "nouveau"; 248 const std::string kNouveauName = "nouveau";
232 const std::string kIntelName = "intel"; 249 const std::string kIntelName = "intel";
233 const std::string kAMDName = "amd"; 250 const std::string kAMDName = "amd";
234 const std::string kATIName = "ati"; 251 const std::string kATIName = "ati";
235 const std::string kVendorNames[] = {kNVidiaName, kNouveauName, kIntelName, 252 const std::string kVendorNames[] = {kNVidiaName, kNouveauName, kIntelName,
236 kAMDName, kATIName}; 253 kAMDName, kATIName};
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 } 296 }
280 for (size_t ii = 0; ii < gpu_info->secondary_gpus.size(); ++ii) { 297 for (size_t ii = 0; ii < gpu_info->secondary_gpus.size(); ++ii) {
281 if (active_vendor_id == gpu_info->secondary_gpus[ii].vendor_id) { 298 if (active_vendor_id == gpu_info->secondary_gpus[ii].vendor_id) {
282 gpu_info->secondary_gpus[ii].active = true; 299 gpu_info->secondary_gpus[ii].active = true;
283 return; 300 return;
284 } 301 }
285 } 302 }
286 } 303 }
287 304
288 } // namespace gpu 305 } // namespace gpu
289
OLDNEW
« no previous file with comments | « gpu/config/gpu_info.cc ('k') | gpu/ipc/common/gpu_info.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698