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

@@ -323,6 +323,7 @@ typedef enum {
enum backend {
BKEND_XRENDER,
BKEND_GLX,
BKEND_XR_GLX_HYBIRD,
NUM_BKEND,
};
@@ -645,7 +646,7 @@ typedef struct {
/// A Picture acting as the painting target.
Picture tgt_picture;
/// Temporary buffer to paint to before sending to display.
Picture tgt_buffer;
paint_t tgt_buffer;
/// DBE back buffer for root window. Used in DBE painting mode.
XdbeBackBuffer root_dbe;
/// Window ID of the window we register as a symbol.
@@ -1712,6 +1713,25 @@ find_toplevel(session_t *ps, Window id) {
return NULL;
}
/**
* Check if current backend uses XRender for rendering.
*/
static inline bool
bkend_use_xrender(session_t *ps) {
return BKEND_XRENDER == ps->o.backend
|| BKEND_XR_GLX_HYBIRD == ps->o.backend;
}
/**
* Check if current backend uses GLX.
*/
static inline bool
bkend_use_glx(session_t *ps) {
return BKEND_GLX == ps->o.backend
|| BKEND_XR_GLX_HYBIRD == ps->o.backend;
}
/**
* Check if a window is really focused.
*/
@@ -2026,7 +2046,7 @@ free_texture(session_t *ps, glx_texture_t **pptex) {
static inline void
glx_mark_(session_t *ps, const char *func, XID xid, bool start) {
#ifdef DEBUG_GLX_MARK
if (BKEND_GLX == ps->o.backend && ps->glStringMarkerGREMEDY) {
if (bkend_use_glx(ps) && ps->glStringMarkerGREMEDY) {
if (!func) func = "(unknown)";
const char *postfix = (start ? " (start)": " (end)");
char *str = malloc((strlen(func) + 12 + 2
@@ -2047,7 +2067,7 @@ glx_mark_(session_t *ps, const char *func, XID xid, bool start) {
static inline void
glx_mark_frame(session_t *ps) {
#ifdef DEBUG_GLX_MARK
if (BKEND_GLX == ps->o.backend && ps->glFrameTerminatorGREMEDY)
if (bkend_use_glx(ps) && ps->glFrameTerminatorGREMEDY)
ps->glFrameTerminatorGREMEDY();
#endif
}