Use EGL for all X11 GL context creation in Qt and SDL

Using a mix of GLX and EGL can cause interoperability issues when
our EGLRenderer tries to bind an EGL context while Qt already has
a GLX context bound on the same thread. This was the source of a
number of confusing EGLRenderer failures over the years.
This commit is contained in:
Cameron Gutman
2025-11-22 18:51:32 -06:00
parent 54283ce0a1
commit 4d6196c3d3

View File

@@ -475,12 +475,12 @@ int main(int argc, char *argv[])
#endif
}
#ifndef Q_PROCESSOR_X86
// Some ARM and RISC-V embedded devices don't have working GLX which can cause
// SDL to fail to find a working OpenGL implementation at all. Let's force EGL
// on non-x86 platforms, since GLX is deprecated anyway.
// on all platforms for both SDL and Qt. This also avoids GLX-EGL interop issues
// when trying to use EGL on the main thread after Qt uses GLX.
SDL_SetHint(SDL_HINT_VIDEO_X11_FORCE_EGL, "1");
#endif
qputenv("QT_XCB_GL_INTEGRATION", "xcb_egl");
#ifdef Q_OS_MACOS
// This avoids using the default keychain for SSL, which may cause