diff options
author | Richard Grenville <[email protected]> | 2013-12-10 22:06:02 +0800 |
---|---|---|
committer | Richard Grenville <[email protected]> | 2013-12-10 22:06:02 +0800 |
commit | 44a13b4e767eef1985a4a34723b7cc279e1dc160 (patch) | |
tree | 901b608ef59ace1f0b4a4759b8e353238b209c7e /common.h | |
parent | 640ef0437814dbc4df57a275cbadecb368ad0950 (diff) | |
download | tdebase-44a13b4e767eef1985a4a34723b7cc279e1dc160.tar.gz tdebase-44a13b4e767eef1985a4a34723b7cc279e1dc160.zip |
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().
Diffstat (limited to 'common.h')
-rw-r--r-- | common.h | 26 |
1 files changed, 23 insertions, 3 deletions
@@ -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 } |