Revert "Remove xrender-sync and xrender-sync-fence"

This reverts commit 50e2259404.

Temporarily revert the removal until we have more information about this whole
thing.

Turns out a couple of drivers don't work properly without the sync fence,
including intel, llvmpipe and NVIDIA.

Although sync fence is needed, from the information I have gathered (looking
at old bug reports, protocol specifications, look at other compositors' code),
compton's usage of it is not proper. So we need to rewrite it in the future,
after we get more information from driver developers.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui
2018-11-08 14:53:13 +00:00
parent ab7a2f1872
commit b18d46bcbd
9 changed files with 174 additions and 23 deletions

View File

@ -185,6 +185,23 @@ get_visualinfo_from_visual(session_t *ps, xcb_visualid_t visual) {
return XGetVisualInfo(ps->dpy, VisualIDMask, &vreq, &nitems);
}
void
xr_glx_sync(session_t *ps, Drawable d, XSyncFence *pfence) {
if (*pfence) {
// GLsync sync = ps->psglx->glFenceSyncProc(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
GLsync sync = ps->psglx->glImportSyncEXT(GL_SYNC_X11_FENCE_EXT, *pfence, 0);
/* GLenum ret = ps->psglx->glClientWaitSyncProc(sync, GL_SYNC_FLUSH_COMMANDS_BIT,
1000);
assert(GL_CONDITION_SATISFIED == ret); */
XSyncTriggerFence(ps->dpy, *pfence);
XFlush(ps->dpy);
ps->psglx->glWaitSyncProc(sync, 0, GL_TIMEOUT_IGNORED);
// ps->psglx->glDeleteSyncProc(sync);
// XSyncResetFence(ps->dpy, *pfence);
}
glx_check_err(ps);
}
#ifdef DEBUG_GLX_DEBUG_CONTEXT
static inline GLXFBConfig
get_fbconfig_from_visualinfo(session_t *ps, const XVisualInfo *visualinfo) {
@ -362,7 +379,6 @@ glx_init(session_t *ps, bool need_render) {
goto glx_init_end;
}
#ifdef CONFIG_GLX_SYNC
psglx->glFenceSyncProc = (f_FenceSync)
glXGetProcAddress((const GLubyte *) "glFenceSync");
psglx->glIsSyncProc = (f_IsSync)
@ -381,7 +397,6 @@ glx_init(session_t *ps, bool need_render) {
printf_errf("(): Failed to acquire GLX sync functions.");
goto glx_init_end;
}
#endif
}
// Acquire FBConfigs