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

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

Issue 2481973002: gl_context_glx: add workaround to create default context (Closed)
Patch Set: Created 4 years, 1 month 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_driver_bug_workaround_type.h ('k') | ui/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) 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_context_glx.h" 5 #include "ui/gl/gl_context_glx.h"
6 6
7 extern "C" { 7 extern "C" {
8 #include <X11/Xlib.h> 8 #include <X11/Xlib.h>
9 } 9 }
10 #include <memory> 10 #include <memory>
11 11
12 #include "base/command_line.h"
12 #include "base/logging.h" 13 #include "base/logging.h"
13 #include "base/numerics/safe_conversions.h" 14 #include "base/numerics/safe_conversions.h"
14 #include "base/trace_event/trace_event.h" 15 #include "base/trace_event/trace_event.h"
15 #include "ui/gl/GL/glextchromium.h" 16 #include "ui/gl/GL/glextchromium.h"
16 #include "ui/gl/gl_bindings.h" 17 #include "ui/gl/gl_bindings.h"
17 #include "ui/gl/gl_implementation.h" 18 #include "ui/gl/gl_implementation.h"
18 #include "ui/gl/gl_surface_glx.h" 19 #include "ui/gl/gl_surface_glx.h"
19 20
20 namespace gl { 21 namespace gl {
21 22
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 162
162 bool GLContextGLX::Initialize( 163 bool GLContextGLX::Initialize(
163 GLSurface* compatible_surface, GpuPreference gpu_preference) { 164 GLSurface* compatible_surface, GpuPreference gpu_preference) {
164 display_ = static_cast<XDisplay*>(compatible_surface->GetDisplay()); 165 display_ = static_cast<XDisplay*>(compatible_surface->GetDisplay());
165 166
166 GLXContext share_handle = static_cast<GLXContext>( 167 GLXContext share_handle = static_cast<GLXContext>(
167 share_group() ? share_group()->GetHandle() : nullptr); 168 share_group() ? share_group()->GetHandle() : nullptr);
168 169
169 if (GLSurfaceGLX::IsCreateContextSupported()) { 170 if (GLSurfaceGLX::IsCreateContextSupported()) {
170 DVLOG(1) << "GLX_ARB_create_context supported."; 171 DVLOG(1) << "GLX_ARB_create_context supported.";
171 context_ = CreateHighestVersionContext( 172 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
172 display_, static_cast<GLXFBConfig>(compatible_surface->GetConfig()), 173 switches::kCreateDefaultGLContext)) {
173 share_handle); 174 context_ = CreateContextAttribs(
175 display_, static_cast<GLXFBConfig>(compatible_surface->GetConfig()),
176 share_handle, GLVersion(0, 0), 0);
177 } else {
178 context_ = CreateHighestVersionContext(
179 display_, static_cast<GLXFBConfig>(compatible_surface->GetConfig()),
180 share_handle);
181 }
174 if (!context_) { 182 if (!context_) {
175 LOG(ERROR) << "Failed to create GL context with " 183 LOG(ERROR) << "Failed to create GL context with "
176 << "glXCreateContextAttribsARB."; 184 << "glXCreateContextAttribsARB.";
177 return false; 185 return false;
178 } 186 }
179 } else { 187 } else {
180 DVLOG(1) << "GLX_ARB_create_context not supported."; 188 DVLOG(1) << "GLX_ARB_create_context not supported.";
181 context_ = glXCreateNewContext( 189 context_ = glXCreateNewContext(
182 display_, 190 display_,
183 static_cast<GLXFBConfig>(compatible_surface->GetConfig()), 191 static_cast<GLXFBConfig>(compatible_surface->GetConfig()),
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 320
313 bool GLContextGLX::WasAllocatedUsingRobustnessExtension() { 321 bool GLContextGLX::WasAllocatedUsingRobustnessExtension() {
314 return GLSurfaceGLX::IsCreateContextRobustnessSupported(); 322 return GLSurfaceGLX::IsCreateContextRobustnessSupported();
315 } 323 }
316 324
317 GLContextGLX::~GLContextGLX() { 325 GLContextGLX::~GLContextGLX() {
318 Destroy(); 326 Destroy();
319 } 327 }
320 328
321 } // namespace gl 329 } // namespace gl
OLDNEW
« no previous file with comments | « gpu/config/gpu_driver_bug_workaround_type.h ('k') | ui/gl/gl_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698