Fix swap interval checking

Checking for the existence of the call only validated that our header
defined the value, not that the video card/driver supported the call.
We query the extensions string directly to check for support.  This
should fix both the X11 and virtualization issues (potentially other
crashes with older video cards as well)

Fixes https://gitlab.com/kicad/code/kicad/issues/8944

(cherry picked from commit 7c9340f855)
This commit is contained in:
Seth Hillbrand 2022-01-06 10:51:25 -08:00
parent e00e9ff41f
commit 3a730361d3
1 changed files with 2 additions and 6 deletions

View File

@ -25,6 +25,7 @@
#define GL_UTILS_H
#include <gal/opengl/kiglew.h> // Must be included first
#include <wx/glcanvas.h>
#include <wx/utils.h>
#include <limits>
@ -44,11 +45,6 @@ public:
/// Windows would include <wglext.h> and call wglSwapIntervalEXT
#if defined( __linux__ ) && !defined( KICAD_USE_EGL )
/// Do not try to set the swapping over remote connections
/// Video drivers lie and then crash when they can't handle the adaptive swapping
if( wxGetEnv( wxT( "SSH_CONNECTION"), nullptr ) )
return 0;
Display *dpy = glXGetCurrentDisplay();
GLXDrawable drawable = glXGetCurrentDrawable();
@ -56,7 +52,7 @@ public:
{
if( aVal < 0 )
{
if( !GLX_EXT_swap_control_tear )
if( !wxGLCanvas::IsExtensionSupported( "GLX_EXT_swap_control_tear" ) )
{
aVal = 0;
}