Commit b23bbc5d authored by Laurent Aimar's avatar Laurent Aimar

Set swap interval to 1 in glx when possible.

It avoids tearing.
parent fb044d45
......@@ -31,6 +31,7 @@
#include <xcb/xcb.h>
#include <X11/Xlib-xcb.h>
#include <GL/glx.h>
#include <GL/glxext.h>
#include <vlc_common.h>
#include <vlc_plugin.h>
......@@ -359,6 +360,24 @@ static int Open (vlc_object_t *obj)
sys->glwin = sys->window;
}
const char *glx_extensions = glXQueryExtensionsString (dpy, snum);
bool is_swap_interval_set = false;
#ifdef GLX_SGI_swap_control
if (strstr (glx_extensions, "GLX_SGI_swap_control")) {
PFNGLXSWAPINTERVALSGIPROC SwapIntervalSGI = (PFNGLXSWAPINTERVALSGIPROC)GetProcAddress (NULL, "glXSwapIntervalSGI");
if (!is_swap_interval_set && SwapIntervalSGI)
is_swap_interval_set = !SwapIntervalSGI (1);
}
#endif
#ifdef GLX_EXT_swap_control
if (strstr (glx_extensions, "GLX_EXT_swap_control")) {
PFNGLXSWAPINTERVALEXTPROC SwapIntervalEXT = (PFNGLXSWAPINTERVALEXTPROC)GetProcAddress (NULL, "glXSwapIntervalEXT");
if (!is_swap_interval_set && SwapIntervalEXT)
is_swap_interval_set = !SwapIntervalEXT (dpy, sys->glwin, 1);
}
#endif
/* Initialize common OpenGL video display */
sys->gl.lock = NULL;
sys->gl.unlock = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment