| Index: ui/gl/gl_surface_glx.cc
|
| diff --git a/ui/gl/gl_surface_glx.cc b/ui/gl/gl_surface_glx.cc
|
| index b349e7c9e56bb19498ad680274ec826c2c8b305e..81d5ec353e93bf2adc2f9c71c2cd61baf2a1dfec 100644
|
| --- a/ui/gl/gl_surface_glx.cc
|
| +++ b/ui/gl/gl_surface_glx.cc
|
| @@ -41,6 +41,7 @@ class ScopedPtrXFree {
|
|
|
| Display* g_display;
|
| const char* g_glx_extensions = NULL;
|
| +bool g_glx_context_create = false;
|
| bool g_glx_create_context_robustness_supported = false;
|
| bool g_glx_texture_from_pixmap_supported = false;
|
| bool g_glx_oml_sync_control_supported = false;
|
| @@ -385,6 +386,8 @@ bool GLSurfaceGLX::InitializeOneOff() {
|
| }
|
|
|
| g_glx_extensions = glXQueryExtensionsString(g_display, 0);
|
| + g_glx_context_create =
|
| + HasGLXExtension("GLX_ARB_create_context");
|
| g_glx_create_context_robustness_supported =
|
| HasGLXExtension("GLX_ARB_create_context_robustness");
|
| g_glx_texture_from_pixmap_supported =
|
| @@ -413,6 +416,11 @@ bool GLSurfaceGLX::HasGLXExtension(const char* name) {
|
| }
|
|
|
| // static
|
| +bool GLSurfaceGLX::IsCreateContextSupported() {
|
| + return g_glx_context_create;
|
| +}
|
| +
|
| +// static
|
| bool GLSurfaceGLX::IsCreateContextRobustnessSupported() {
|
| return g_glx_create_context_robustness_supported;
|
| }
|
| @@ -451,10 +459,24 @@ bool NativeViewGLSurfaceGLX::Initialize() {
|
| else if (g_glx_sgi_video_sync_supported)
|
| vsync_provider_.reset(new SGIVideoSyncVSyncProvider(window_));
|
|
|
| + glx_window_ = glXCreateWindow(
|
| + g_display,
|
| + static_cast<GLXFBConfig>(GetConfig()),
|
| + window_,
|
| + NULL);
|
| + if (!glx_window_) {
|
| + LOG(ERROR) << "glXCreateWindow failed for window " << window_ << ".";
|
| + return false;
|
| + }
|
| +
|
| return true;
|
| }
|
|
|
| void NativeViewGLSurfaceGLX::Destroy() {
|
| + if (glx_window_) {
|
| + glXDestroyWindow(g_display, glx_window_);
|
| + glx_window_ = 0;
|
| + }
|
| }
|
|
|
| bool NativeViewGLSurfaceGLX::Resize(const gfx::Size& size) {
|
| @@ -472,7 +494,7 @@ bool NativeViewGLSurfaceGLX::IsOffscreen() {
|
| }
|
|
|
| bool NativeViewGLSurfaceGLX::SwapBuffers() {
|
| - glXSwapBuffers(g_display, window_);
|
| + glXSwapBuffers(g_display, glx_window_);
|
| // For latency_tests.cc:
|
| UNSHIPPED_TRACE_EVENT_INSTANT0("test_gpu", "CompositorSwapBuffersComplete");
|
| return true;
|
| @@ -483,7 +505,7 @@ gfx::Size NativeViewGLSurfaceGLX::GetSize() {
|
| }
|
|
|
| void* NativeViewGLSurfaceGLX::GetHandle() {
|
| - return reinterpret_cast<void*>(window_);
|
| + return reinterpret_cast<void*>(glx_window_);
|
| }
|
|
|
| std::string NativeViewGLSurfaceGLX::GetExtensions() {
|
| @@ -512,10 +534,10 @@ void* NativeViewGLSurfaceGLX::GetConfig() {
|
| XWindowAttributes attributes;
|
| if (!XGetWindowAttributes(
|
| g_display,
|
| - reinterpret_cast<GLXDrawable>(GetHandle()),
|
| + window_,
|
| &attributes)) {
|
| LOG(ERROR) << "XGetWindowAttributes failed for window " <<
|
| - reinterpret_cast<GLXDrawable>(GetHandle()) << ".";
|
| + window_ << ".";
|
| return NULL;
|
| }
|
|
|
| @@ -559,7 +581,7 @@ void* NativeViewGLSurfaceGLX::GetConfig() {
|
| bool NativeViewGLSurfaceGLX::PostSubBuffer(
|
| int x, int y, int width, int height) {
|
| DCHECK(gfx::g_driver_glx.ext.b_GLX_MESA_copy_sub_buffer);
|
| - glXCopySubBufferMESA(g_display, window_, x, y, width, height);
|
| + glXCopySubBufferMESA(g_display, glx_window_, x, y, width, height);
|
| return true;
|
| }
|
|
|
|
|