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

Side by Side Diff: ui/gl/gl_surface.cc

Issue 1542013005: Add a new driver bug workaround SANDBOX_START_EARLY Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Just rebase Created 4 years, 7 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
« base/sys_info_posix.cc ('K') | « ui/gl/gl_implementation_x11.cc ('k') | no next file » | 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 "ui/gl/gl_surface.h" 5 #include "ui/gl/gl_surface.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 12 matching lines...) Expand all
23 base::LazyInstance<base::ThreadLocalPointer<GLSurface> >::Leaky 23 base::LazyInstance<base::ThreadLocalPointer<GLSurface> >::Leaky
24 current_surface_ = LAZY_INSTANCE_INITIALIZER; 24 current_surface_ = LAZY_INSTANCE_INITIALIZER;
25 } // namespace 25 } // namespace
26 26
27 // static 27 // static
28 bool GLSurface::InitializeOneOff() { 28 bool GLSurface::InitializeOneOff() {
29 DCHECK_EQ(kGLImplementationNone, GetGLImplementation()); 29 DCHECK_EQ(kGLImplementationNone, GetGLImplementation());
30 30
31 TRACE_EVENT0("gpu,startup", "GLSurface::InitializeOneOff"); 31 TRACE_EVENT0("gpu,startup", "GLSurface::InitializeOneOff");
32 32
33 std::vector<GLImplementation> allowed_impls; 33 GLImplementation impl = kGLImplementationNone;
34 GetAllowedGLImplementations(&allowed_impls); 34 bool fallback_to_osmesa = false;
35 DCHECK(!allowed_impls.empty()); 35 bool result = SelectGLImplementation(&impl, &fallback_to_osmesa);
36 if (!result)
37 return false;
36 38
37 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); 39 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess();
38 40
39 // The default implementation is always the first one in list.
40 GLImplementation impl = allowed_impls[0];
41 bool fallback_to_osmesa = false;
42 if (cmd->HasSwitch(switches::kOverrideUseGLWithOSMesaForTests)) {
43 impl = kGLImplementationOSMesaGL;
44 } else if (cmd->HasSwitch(switches::kUseGL)) {
45 std::string requested_implementation_name =
46 cmd->GetSwitchValueASCII(switches::kUseGL);
47 if (requested_implementation_name == "any") {
48 fallback_to_osmesa = true;
49 } else if (requested_implementation_name ==
50 kGLImplementationSwiftShaderName ||
51 requested_implementation_name == kGLImplementationANGLEName) {
52 impl = kGLImplementationEGLGLES2;
53 } else {
54 impl = GetNamedGLImplementation(requested_implementation_name);
55 if (!ContainsValue(allowed_impls, impl)) {
56 LOG(ERROR) << "Requested GL implementation is not available.";
57 return false;
58 }
59 }
60 }
61
62 bool gpu_service_logging = cmd->HasSwitch(switches::kEnableGPUServiceLogging); 41 bool gpu_service_logging = cmd->HasSwitch(switches::kEnableGPUServiceLogging);
63 bool disable_gl_drawing = cmd->HasSwitch(switches::kDisableGLDrawingForTests); 42 bool disable_gl_drawing = cmd->HasSwitch(switches::kDisableGLDrawingForTests);
64 43
65 return InitializeOneOffImplementation( 44 return InitializeOneOffImplementation(
66 impl, fallback_to_osmesa, gpu_service_logging, disable_gl_drawing); 45 impl, fallback_to_osmesa, gpu_service_logging, disable_gl_drawing);
67 } 46 }
68 47
69 // static 48 // static
70 bool GLSurface::InitializeOneOffImplementation(GLImplementation impl, 49 bool GLSurface::InitializeOneOffImplementation(GLImplementation impl,
71 bool fallback_to_osmesa, 50 bool fallback_to_osmesa,
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 return surface_->FlipsVertically(); 375 return surface_->FlipsVertically();
397 } 376 }
398 377
399 bool GLSurfaceAdapter::BuffersFlipped() const { 378 bool GLSurfaceAdapter::BuffersFlipped() const {
400 return surface_->BuffersFlipped(); 379 return surface_->BuffersFlipped();
401 } 380 }
402 381
403 GLSurfaceAdapter::~GLSurfaceAdapter() {} 382 GLSurfaceAdapter::~GLSurfaceAdapter() {}
404 383
405 } // namespace gfx 384 } // namespace gfx
OLDNEW
« base/sys_info_posix.cc ('K') | « ui/gl/gl_implementation_x11.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698