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

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

Issue 1547793004: Make gpu black list work again on Linux (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
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/logging.h" 14 #include "base/logging.h"
14 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
15 #include "base/metrics/sparse_histogram.h" 16 #include "base/metrics/sparse_histogram.h"
16 #include "base/strings/string_number_conversions.h" 17 #include "base/strings/string_number_conversions.h"
17 #include "base/strings/string_piece.h" 18 #include "base/strings/string_piece.h"
18 #include "base/strings/string_split.h" 19 #include "base/strings/string_split.h"
19 #include "base/strings/string_util.h" 20 #include "base/strings/string_util.h"
20 #include "base/trace_event/trace_event.h" 21 #include "base/trace_event/trace_event.h"
22 #include "gpu/config/gpu_switches.h"
21 #include "ui/gl/gl_bindings.h" 23 #include "ui/gl/gl_bindings.h"
22 #include "ui/gl/gl_context.h" 24 #include "ui/gl/gl_context.h"
23 #include "ui/gl/gl_implementation.h" 25 #include "ui/gl/gl_implementation.h"
24 #include "ui/gl/gl_surface.h" 26 #include "ui/gl/gl_surface.h"
25 #include "ui/gl/gl_version_info.h" 27 #include "ui/gl/gl_version_info.h"
26 28
27 namespace { 29 namespace {
28 30
29 scoped_refptr<gfx::GLSurface> InitializeGLSurface() { 31 scoped_refptr<gfx::GLSurface> InitializeGLSurface() {
30 scoped_refptr<gfx::GLSurface> surface( 32 scoped_refptr<gfx::GLSurface> surface(
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 LOG(ERROR) << "Could not create surface for info collection."; 111 LOG(ERROR) << "Could not create surface for info collection.";
110 return kCollectInfoFatalFailure; 112 return kCollectInfoFatalFailure;
111 } 113 }
112 114
113 scoped_refptr<gfx::GLContext> context(InitializeGLContext(surface.get())); 115 scoped_refptr<gfx::GLContext> context(InitializeGLContext(surface.get()));
114 if (!context.get()) { 116 if (!context.get()) {
115 LOG(ERROR) << "Could not create context for info collection."; 117 LOG(ERROR) << "Could not create context for info collection.";
116 return kCollectInfoFatalFailure; 118 return kCollectInfoFatalFailure;
117 } 119 }
118 120
119 gpu_info->gl_renderer = GetGLString(GL_RENDERER); 121 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
120 gpu_info->gl_vendor = GetGLString(GL_VENDOR); 122
123 if (command_line->HasSwitch(switches::kGpuTestingGLRenderer))
124 gpu_info->gl_renderer =
125 command_line->GetSwitchValueASCII(switches::kGpuTestingGLRenderer);
126 else
127 gpu_info->gl_renderer = GetGLString(GL_RENDERER);
128
129 if (command_line->HasSwitch(switches::kGpuTestingGLVendor))
130 gpu_info->gl_vendor =
131 command_line->GetSwitchValueASCII(switches::kGpuTestingGLVendor);
132 else
133 gpu_info->gl_vendor = GetGLString(GL_VENDOR);
134
121 gpu_info->gl_extensions = gfx::GetGLExtensionsFromCurrentContext(); 135 gpu_info->gl_extensions = gfx::GetGLExtensionsFromCurrentContext();
122 gpu_info->gl_version = GetGLString(GL_VERSION); 136
137 if (command_line->HasSwitch(switches::kGpuTestingGLVersion))
138 gpu_info->gl_version =
139 command_line->GetSwitchValueASCII(switches::kGpuTestingGLVersion);
140 else
141 gpu_info->gl_version =
142 GetGLString(GL_VERSION); // driver vendor driver version
123 std::string glsl_version_string = GetGLString(GL_SHADING_LANGUAGE_VERSION); 143 std::string glsl_version_string = GetGLString(GL_SHADING_LANGUAGE_VERSION);
124 144
125 gfx::GLVersionInfo gl_info(gpu_info->gl_version.c_str(), 145 gfx::GLVersionInfo gl_info(gpu_info->gl_version.c_str(),
126 gpu_info->gl_renderer.c_str(), 146 gpu_info->gl_renderer.c_str(),
127 gpu_info->gl_extensions.c_str()); 147 gpu_info->gl_extensions.c_str());
128 GLint max_samples = 0; 148 GLint max_samples = 0;
129 if (gl_info.IsAtLeastGL(3, 0) || gl_info.IsAtLeastGLES(3, 0) || 149 if (gl_info.IsAtLeastGL(3, 0) || gl_info.IsAtLeastGLES(3, 0) ||
130 gpu_info->gl_extensions.find("GL_ANGLE_framebuffer_multisample") != 150 gpu_info->gl_extensions.find("GL_ANGLE_framebuffer_multisample") !=
131 std::string::npos || 151 std::string::npos ||
132 gpu_info->gl_extensions.find("GL_APPLE_framebuffer_multisample") != 152 gpu_info->gl_extensions.find("GL_APPLE_framebuffer_multisample") !=
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 for (size_t ii = 0; ii < gpu_info->secondary_gpus.size(); ++ii) { 285 for (size_t ii = 0; ii < gpu_info->secondary_gpus.size(); ++ii) {
266 if (active_vendor_id == gpu_info->secondary_gpus[ii].vendor_id) { 286 if (active_vendor_id == gpu_info->secondary_gpus[ii].vendor_id) {
267 gpu_info->secondary_gpus[ii].active = true; 287 gpu_info->secondary_gpus[ii].active = true;
268 return; 288 return;
269 } 289 }
270 } 290 }
271 } 291 }
272 292
273 } // namespace gpu 293 } // namespace gpu
274 294
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698