Improvement #7: Add GLX_OML_sync_control VSync support

- Add "vsync-oml" VSync method, using GLX_OML_sync_control. Untested,
  because it's not supported by my driver.

- Unredirect ps->reg_win, because DRI wiki says it's related to the
  behavior of OpenGL VSync extensions.

- Add glFlush() and glXWaitX() calls, in hope they are slightly helpful
  for VSync.

- Change a few functions to make error handling more graceful. Make some
  errors fatal. Code clean-up.

- Add unused function make_text_prop().
This commit is contained in:
Richard Grenville
2013-01-30 13:41:08 +08:00
parent 42e17cb4e9
commit 1b5273c819
4 changed files with 220 additions and 118 deletions

View File

@ -216,6 +216,25 @@ ms_to_tv(int timeout) {
};
}
/**
* Create a XTextProperty of a single string.
*/
static inline XTextProperty *
make_text_prop(session_t *ps, char *str) {
XTextProperty *pprop = malloc(sizeof(XTextProperty));
if (!pprop)
printf_errfq(1, "(): Failed to allocate memory.");
if (XmbTextListToTextProperty(ps->dpy, &str, 1, XStringStyle, pprop)) {
if (pprop->value)
XFree(pprop->value);
free(pprop);
pprop = NULL;
}
return pprop;
}
static void
run_fade(session_t *ps, win *w, unsigned steps);
@ -685,8 +704,8 @@ ev_window(session_t *ps, XEvent *ev);
static void __attribute__ ((noreturn))
usage(void);
static void
register_cm(session_t *ps, bool want_glxct);
static bool
register_cm(session_t *ps, bool glx);
inline static void
ev_focus_in(session_t *ps, XFocusChangeEvent *ev);
@ -878,9 +897,15 @@ vsync_drm_wait(session_t *ps);
static bool
vsync_opengl_init(session_t *ps);
static bool
vsync_opengl_oml_init(session_t *ps);
#ifdef CONFIG_VSYNC_OPENGL
static void
static int
vsync_opengl_wait(session_t *ps);
static int
vsync_opengl_oml_wait(session_t *ps);
#endif
static void
@ -889,7 +914,7 @@ vsync_wait(session_t *ps);
static void
init_alpha_picts(session_t *ps);
static void
static bool
init_dbe(session_t *ps);
static void