From 17848c097c89ea933ef185c3cbda229ed376437a Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sun, 16 Oct 2022 22:57:08 -0500 Subject: [PATCH] Don't switch between GLX and EGL if EGL worked --- app/streaming/video/ffmpeg-renderers/eglvid.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/streaming/video/ffmpeg-renderers/eglvid.cpp b/app/streaming/video/ffmpeg-renderers/eglvid.cpp index a6cf96ca..6b7809a3 100644 --- a/app/streaming/video/ffmpeg-renderers/eglvid.cpp +++ b/app/streaming/video/ffmpeg-renderers/eglvid.cpp @@ -732,6 +732,15 @@ bool EGLRenderer::initialize(PDECODER_PARAMETERS params) // Detach the context from this thread, so the render thread can attach it SDL_GL_MakeCurrent(m_Window, nullptr); +#ifdef SDL_HINT_VIDEO_X11_FORCE_EGL + if (err == GL_NO_ERROR) { + // If we got a working GL implementation via EGL, avoid using GLX from now on. + // GLX will cause problems if we later want to use EGL again on this window. + SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "EGL passed preflight checks. Using EGL for GL context creation."); + SDL_SetHint(SDL_HINT_VIDEO_X11_FORCE_EGL, "1"); + } +#endif + return err == GL_NO_ERROR; }