| OLD | NEW |
| 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> |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 if (profile_mask != 0 && GLSurfaceGLX::IsCreateContextProfileSupported()) { | 50 if (profile_mask != 0 && GLSurfaceGLX::IsCreateContextProfileSupported()) { |
| 51 attribs.push_back(GLX_CONTEXT_PROFILE_MASK_ARB); | 51 attribs.push_back(GLX_CONTEXT_PROFILE_MASK_ARB); |
| 52 attribs.push_back(profile_mask); | 52 attribs.push_back(profile_mask); |
| 53 } | 53 } |
| 54 | 54 |
| 55 attribs.push_back(0); | 55 attribs.push_back(0); |
| 56 | 56 |
| 57 // When creating a context with glXCreateContextAttribsARB, a variety of X11 | 57 // When creating a context with glXCreateContextAttribsARB, a variety of X11 |
| 58 // errors can be generated. To prevent these errors from crashing our process, | 58 // errors can be generated. To prevent these errors from crashing our process, |
| 59 // we simply ignore them and only look if the GLXContext was created. | 59 // we simply ignore them and only look if the GLXContext was created. |
| 60 // Sync to ensure any errors generated are processed. |
| 61 XSync(display, False); |
| 60 auto old_error_handler = XSetErrorHandler(IgnoreX11Errors); | 62 auto old_error_handler = XSetErrorHandler(IgnoreX11Errors); |
| 61 GLXContext context = | 63 GLXContext context = |
| 62 glXCreateContextAttribsARB(display, config, share, True, attribs.data()); | 64 glXCreateContextAttribsARB(display, config, share, True, attribs.data()); |
| 63 XSetErrorHandler(old_error_handler); | 65 XSetErrorHandler(old_error_handler); |
| 64 | 66 |
| 65 return context; | 67 return context; |
| 66 } | 68 } |
| 67 | 69 |
| 68 GLXContext CreateHighestVersionContext(Display* display, | 70 GLXContext CreateHighestVersionContext(Display* display, |
| 69 GLXFBConfig config, | 71 GLXFBConfig config, |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 | 312 |
| 311 bool GLContextGLX::WasAllocatedUsingRobustnessExtension() { | 313 bool GLContextGLX::WasAllocatedUsingRobustnessExtension() { |
| 312 return GLSurfaceGLX::IsCreateContextRobustnessSupported(); | 314 return GLSurfaceGLX::IsCreateContextRobustnessSupported(); |
| 313 } | 315 } |
| 314 | 316 |
| 315 GLContextGLX::~GLContextGLX() { | 317 GLContextGLX::~GLContextGLX() { |
| 316 Destroy(); | 318 Destroy(); |
| 317 } | 319 } |
| 318 | 320 |
| 319 } // namespace gl | 321 } // namespace gl |
| OLD | NEW |