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

Side by Side Diff: content/gpu/gpu_info_collector_linux.cc

Issue 7530008: Add --gpu-no-context-lost commandline switch. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « content/browser/gpu/gpu_process_host.cc ('k') | ui/gfx/gl/gl_switches.h » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "content/gpu/gpu_info_collector.h" 5 #include "content/gpu/gpu_info_collector.h"
6 6
7 #include <dlfcn.h> 7 #include <dlfcn.h>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h"
10 #include "base/file_util.h" 11 #include "base/file_util.h"
11 #include "base/logging.h" 12 #include "base/logging.h"
12 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
13 #include "base/string_piece.h" 14 #include "base/string_piece.h"
14 #include "base/string_split.h" 15 #include "base/string_split.h"
15 #include "base/string_tokenizer.h" 16 #include "base/string_tokenizer.h"
16 #include "base/string_util.h" 17 #include "base/string_util.h"
17 #include "ui/gfx/gl/gl_bindings.h" 18 #include "ui/gfx/gl/gl_bindings.h"
18 #include "ui/gfx/gl/gl_context.h" 19 #include "ui/gfx/gl/gl_context.h"
19 #include "ui/gfx/gl/gl_implementation.h" 20 #include "ui/gfx/gl/gl_implementation.h"
21 #include "ui/gfx/gl/gl_switches.h"
20 22
21 namespace { 23 namespace {
22 24
23 // PciDevice and PciAccess are defined to access libpci functions. Their 25 // PciDevice and PciAccess are defined to access libpci functions. Their
24 // members match the corresponding structures defined by libpci in size up to 26 // members match the corresponding structures defined by libpci in size up to
25 // fields we may access. For those members we don't use, their names are 27 // fields we may access. For those members we don't use, their names are
26 // defined as "fieldX", etc., or, left out if they are declared after the 28 // defined as "fieldX", etc., or, left out if they are declared after the
27 // members we care about in libpci. 29 // members we care about in libpci.
28 30
29 struct PciDevice { 31 struct PciDevice {
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 return 0; 187 return 0;
186 } 188 }
187 189
188 } // namespace anonymous 190 } // namespace anonymous
189 191
190 namespace gpu_info_collector { 192 namespace gpu_info_collector {
191 193
192 bool CollectGraphicsInfo(GPUInfo* gpu_info) { 194 bool CollectGraphicsInfo(GPUInfo* gpu_info) {
193 DCHECK(gpu_info); 195 DCHECK(gpu_info);
194 196
195 // TODO(zmo): need to consider the case where we are running on top of 197 if (CommandLine::ForCurrentProcess()->HasSwitch(
196 // desktop GL and GL_ARB_robustness extension is available. 198 switches::kGpuNoContextLost)) {
197 gpu_info->can_lose_context = 199 gpu_info->can_lose_context = false;
198 (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2); 200 } else {
201 // TODO(zmo): need to consider the case where we are running on top
202 // of desktop GL and GL_ARB_robustness extension is available.
203 gpu_info->can_lose_context =
204 (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2);
205 }
206
199 gpu_info->finalized = true; 207 gpu_info->finalized = true;
200 return CollectGraphicsInfoGL(gpu_info); 208 return CollectGraphicsInfoGL(gpu_info);
201 } 209 }
202 210
203 bool CollectPreliminaryGraphicsInfo(GPUInfo* gpu_info) { 211 bool CollectPreliminaryGraphicsInfo(GPUInfo* gpu_info) {
204 DCHECK(gpu_info); 212 DCHECK(gpu_info);
205 213
206 bool rt = true; 214 bool rt = true;
207 if (!CollectVideoCardInfo(gpu_info)) 215 if (!CollectVideoCardInfo(gpu_info))
208 rt = false; 216 rt = false;
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 return false; 343 return false;
336 if (pos != std::string::npos) 344 if (pos != std::string::npos)
337 driver_version = driver_version.substr(0, pos); 345 driver_version = driver_version.substr(0, pos);
338 346
339 gpu_info->driver_vendor = pieces[1]; 347 gpu_info->driver_vendor = pieces[1];
340 gpu_info->driver_version = driver_version; 348 gpu_info->driver_version = driver_version;
341 return true; 349 return true;
342 } 350 }
343 351
344 } // namespace gpu_info_collector 352 } // namespace gpu_info_collector
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_process_host.cc ('k') | ui/gfx/gl/gl_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698