| 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 LOG(ERROR) << "Setting error handler " << getpid(); |
| 60 auto old_error_handler = XSetErrorHandler(IgnoreX11Errors); | 61 auto old_error_handler = XSetErrorHandler(IgnoreX11Errors); |
| 61 GLXContext context = | 62 GLXContext context = |
| 62 glXCreateContextAttribsARB(display, config, share, True, attribs.data()); | 63 glXCreateContextAttribsARB(display, config, share, True, attribs.data()); |
| 63 XSetErrorHandler(old_error_handler); | 64 XSetErrorHandler(old_error_handler); |
| 64 | 65 |
| 65 return context; | 66 return context; |
| 66 } | 67 } |
| 67 | 68 |
| 68 GLXContext CreateHighestVersionContext(Display* display, | 69 GLXContext CreateHighestVersionContext(Display* display, |
| 69 GLXFBConfig config, | 70 GLXFBConfig config, |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 | 311 |
| 311 bool GLContextGLX::WasAllocatedUsingRobustnessExtension() { | 312 bool GLContextGLX::WasAllocatedUsingRobustnessExtension() { |
| 312 return GLSurfaceGLX::IsCreateContextRobustnessSupported(); | 313 return GLSurfaceGLX::IsCreateContextRobustnessSupported(); |
| 313 } | 314 } |
| 314 | 315 |
| 315 GLContextGLX::~GLContextGLX() { | 316 GLContextGLX::~GLContextGLX() { |
| 316 Destroy(); | 317 Destroy(); |
| 317 } | 318 } |
| 318 | 319 |
| 319 } // namespace gl | 320 } // namespace gl |
| OLD | NEW |