Summary: | [GTK] GLXBadFBConfig error when creating an OpenGL context | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Miguel Gomez <magomez> | ||||||||
Component: | WebKitGTK | Assignee: | Miguel Gomez <magomez> | ||||||||
Status: | RESOLVED FIXED | ||||||||||
Severity: | Normal | CC: | bugs-noreply, commit-queue, Hironori.Fujii | ||||||||
Priority: | P2 | ||||||||||
Version: | WebKit Nightly Build | ||||||||||
Hardware: | Unspecified | ||||||||||
OS: | Unspecified | ||||||||||
Attachments: |
|
Description
Miguel Gomez
2016-11-30 08:44:59 PST
Created attachment 295847 [details]
Patch
Comment on attachment 295847 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=295847&action=review > Source/WebCore/platform/graphics/glx/GLContextGLX.cpp:81 > + // There's no way to know whether glXCreateContextAttribsARB can provide an OpenGL version >= 3.2 until > + // we actually call it and check the return value. > + // To make things more fun, if a version >= 3.2 cannot be provided, glXCreateContextAttribsARB will throw > + // a GLXBadFBConfig X error, causing the app to crash. > + // So, the first time a context is requested, we set a X error trap to disable crashes with GLXBadFBConfig > + // and then check whether the return value is a context or not. I think it's weird that even when we can use glXCreateContextAttribsARB we still fallback to legacy because the requested version is not supported. I think we should still use glXCreateContextAttribsARB but requesting a lower OpenGL version. Here we have two possibilities, always request 3.2 and fallback to not passing the version to the attribs, which means the driver will use the default (this should always work, but it seems Mesa doesn't do this). Another possibility is to try to create the highest version context like chromium does. It's only done for Mesa because context creation is is fast when failing and because it requires a version, for other drivers they only try to create a compatible context (passing no openg version). For mesa they try from 4.5 to 1.0. > Source/WebCore/platform/graphics/glx/GLContextGLX.cpp:100 > + // Set an X error trapper that ignores GLXBadFBConfig. > + // GLXBadFBConfig doesn't seem to be defined anywhere. From the source code it's defined as errorBase + 9. > + int GLXErrorBase = 0; > + glXQueryExtension(display, &GLXErrorBase, nullptr); > + XErrorTrapper trapper(display, XErrorTrapper::Policy::Crash, { (unsigned char)(GLXErrorBase + 9) }); I think it's safe to ignore all Xerrors here, it makes everything simpler. > Source/WebCore/platform/graphics/glx/GLContextGLX.cpp:141 > + if (hasGLXARBCreateContextExtension(display)) > + context.reset(tryCreateGLXARBContext(display, config, sharingContext)); hasGLXARBCreateContextExtension could be checked by tryCreateGLXARBContext that could return a XUniqueGLXContext. Created attachment 296917 [details]
Patch
Comment on attachment 296917 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=296917&action=review > Source/WebCore/platform/graphics/glx/GLContextGLX.cpp:144 > + context.reset((createGLXARBContext(display, config, sharingContext))); I think there are unneeded extra () there. > Source/WebCore/platform/graphics/glx/GLContextGLX.cpp:184 > + context.reset((createGLXARBContext(display, configs.get()[0], sharingContext))); Ditto. Created attachment 297456 [details]
Patch
Comment on attachment 297456 [details] Patch Clearing flags on attachment: 297456 Committed r209982: <http://trac.webkit.org/changeset/209982> All reviewed patches have been landed. Closing bug. |