Feature: Add XRender-GLX hybird backend

- Add new backend "xr_glx_hybird", which uses X Render for all
  compositing but GLX on the last step of rendering to screen.  This
  makes GLX-backend-specific VSync methods usable while may avoid
  certain bugs with GLX backend. The idea comes from ali1234.
  Experimental.

- GLX backend: Stop using or rendering to depth buffer.

- Use glFinish() instead of glFlush() before VSync. It probably uses
  more CPU but could be more reliable than glFlush().
This commit is contained in:
Richard Grenville
2013-12-10 22:06:02 +08:00
parent c02a867e6f
commit fbd70e146c
4 changed files with 95 additions and 51 deletions

View File

@ -219,7 +219,7 @@ paint_isvalid(session_t *ps, const paint_t *ppaint) {
if (!ppaint)
return false;
if (BKEND_XRENDER == ps->o.backend && !ppaint->pict)
if (bkend_use_xrender(ps) && !ppaint->pict)
return false;
#ifdef CONFIG_VSYNC_OPENGL
@ -229,25 +229,32 @@ paint_isvalid(session_t *ps, const paint_t *ppaint) {
return true;
}
/**
* Bind texture in paint_t if we are using GLX backend.
*/
static inline bool
paint_bind_tex(session_t *ps, paint_t *ppaint,
paint_bind_tex_real(session_t *ps, paint_t *ppaint,
unsigned wid, unsigned hei, unsigned depth, bool force) {
#ifdef CONFIG_VSYNC_OPENGL
if (BKEND_GLX == ps->o.backend) {
if (!ppaint->pixmap)
return false;
if (!ppaint->pixmap)
return false;
if (force || !glx_tex_binded(ppaint->ptex, ppaint->pixmap))
return glx_bind_pixmap(ps, &ppaint->ptex, ppaint->pixmap, wid, hei, depth);
}
if (force || !glx_tex_binded(ppaint->ptex, ppaint->pixmap))
return glx_bind_pixmap(ps, &ppaint->ptex, ppaint->pixmap, wid, hei, depth);
#endif
return true;
}
static inline bool
paint_bind_tex(session_t *ps, paint_t *ppaint,
unsigned wid, unsigned hei, unsigned depth, bool force) {
if (BKEND_GLX == ps->o.backend)
return paint_bind_tex_real(ps, ppaint, wid, hei, depth, force);
return true;
}
/**
* Free data in a reg_data_t.
*/
@ -679,7 +686,8 @@ static inline void
set_tgt_clip(session_t *ps, XserverRegion reg, const reg_data_t *pcache_reg) {
switch (ps->o.backend) {
case BKEND_XRENDER:
XFixesSetPictureClipRegion(ps->dpy, ps->tgt_buffer, 0, 0, reg);
case BKEND_XR_GLX_HYBIRD:
XFixesSetPictureClipRegion(ps->dpy, ps->tgt_buffer.pict, 0, 0, reg);
break;
#ifdef CONFIG_VSYNC_OPENGL
case BKEND_GLX: