new backend: glx: use glFinish/glXWaitGL if not on NVIDIA

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2019-04-20 01:10:04 +01:00
parent b35bfd07d1
commit c55088944a
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
3 changed files with 15 additions and 0 deletions

View File

@ -834,6 +834,15 @@ bool gl_init(struct gl_data *gd, session_t *ps) {
log_add_target_tls(gd->logger);
}
const char *vendor = (const char *)glGetString(GL_VENDOR);
log_debug("GL_VENDOR = %s", vendor);
if (strcmp(vendor, "NVIDIA Corporation") == 0) {
log_info("GL vendor is NVIDIA, don't use glFinish");
gd->is_nvidia = true;
} else {
gd->is_nvidia = false;
}
return true;
}

View File

@ -60,6 +60,8 @@ typedef struct gl_texture {
struct gl_data {
backend_t base;
// If we are using proprietary NVIDIA driver
bool is_nvidia;
// Height and width of the viewport
int height, width;
int npasses;

View File

@ -435,6 +435,10 @@ err:
static void glx_present(backend_t *base) {
struct _glx_data *gd = (void *)base;
glXSwapBuffers(gd->display, gd->target_win);
// XXX there should be no need to block compton will wait for render to finish
if (!gd->gl.is_nvidia) {
glXWaitGL();
}
}
static int glx_buffer_age(backend_t *base) {