From 74c66a6f8e7ee4730885cc79c88d64ba2fc3cb3d Mon Sep 17 00:00:00 2001 From: "kbr@google.com" Date: Fri, 2 Apr 2010 19:07:05 +0000 Subject: Fixed GPU process startup crash on Linux. Because there was no current OpenGL context, glXGetCurrentDisplay() was returning NULL, leading to crashes in glXQueryVersion. Exposed a new glxewContextInitWithDisplay from GLEW allowing the caller to supply the display connection. Built both with and without GLEW_MX to ensure GLEW changes compile in both scenarios. BUG=40148 TEST=ran WebGL demos in debugger, verified Display* passed to glXQueryVersion Review URL: http://codereview.chromium.org/1556015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43507 0039d316-1c4b-4281-b951-d872f2087c98 --- gpu/command_buffer/service/x_utils.cc | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'gpu/command_buffer') diff --git a/gpu/command_buffer/service/x_utils.cc b/gpu/command_buffer/service/x_utils.cc index 9c10377..30a9167 100644 --- a/gpu/command_buffer/service/x_utils.cc +++ b/gpu/command_buffer/service/x_utils.cc @@ -31,7 +31,7 @@ class ScopedPtrXFree { static bool g_glxew_initialized = false; static bool g_glew_initialized = false; -static bool InitializeGLXEW() { +static bool InitializeGLXEW(Display* display) { if (!g_glxew_initialized) { void* handle = dlopen("libGL.so.1", RTLD_LAZY | RTLD_GLOBAL); if (!handle) { @@ -44,13 +44,11 @@ static bool InitializeGLXEW() { LOG(ERROR) << "glxewInit failed"; return false; } - // Hack to work around apparently incorrect assumption in - // glxewContextInit. Documentation indicates that all of the work - // it does is actually context-independent. We require GLX 1.3 - // entry points to be present for successful initialization of the - // off-screen code path in the GLES2Decoder. TODO(kbr): clean this - // up. - if (glxewContextInit() != GLEW_OK) { + // glxewContextInit really only needs a display connection to + // complete, and we don't want to have to create an OpenGL context + // just to get access to GLX 1.3 entry points to create pbuffers. + // We therefore added a glxewContextInitWithDisplay entry point. + if (glxewContextInitWithDisplay(display) != GLEW_OK) { LOG(ERROR) << "glxewContextInit failed"; return false; } @@ -111,7 +109,7 @@ void GLXContextWrapper::Destroy() { } bool XWindowWrapper::Initialize() { - if (!InitializeGLXEW()) + if (!InitializeGLXEW(GetDisplay())) return false; XWindowAttributes attributes; @@ -162,7 +160,7 @@ void XWindowWrapper::SwapBuffers() { } bool GLXPbufferWrapper::Initialize() { - if (!InitializeGLXEW()) + if (!InitializeGLXEW(GetDisplay())) return false; if (!glXChooseFBConfig || -- cgit v1.1