From 43b47ec45346c895c5c555d9771fbdfbaca387ff Mon Sep 17 00:00:00 2001 From: Richard Grenville Date: Tue, 24 Dec 2013 07:46:48 +0800 Subject: Misc #152: Fix a spelling mistake Fix a spelling mistake (xr_glx_hybird -> xr_glx_hybrid). Thanks to cju for reporting. --- common.h | 11 ++++++++--- compton.c | 16 ++++++++-------- compton.h | 2 +- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/common.h b/common.h index 6003cbf16..71ea8975b 100644 --- a/common.h +++ b/common.h @@ -323,7 +323,7 @@ typedef enum { enum backend { BKEND_XRENDER, BKEND_GLX, - BKEND_XR_GLX_HYBIRD, + BKEND_XR_GLX_HYBRID, NUM_BKEND, }; @@ -1491,6 +1491,11 @@ parse_backend(session_t *ps, const char *str) { ps->o.backend = i; return true; } + // Keep compatibility with an old revision containing a spelling mistake... + if (!strcasecmp(str, "xr_glx_hybird")) { + ps->o.backend = BKEND_XR_GLX_HYBRID; + return true; + } printf_errf("(\"%s\"): Invalid backend argument.", str); return false; } @@ -1720,7 +1725,7 @@ find_toplevel(session_t *ps, Window id) { static inline bool bkend_use_xrender(session_t *ps) { return BKEND_XRENDER == ps->o.backend - || BKEND_XR_GLX_HYBIRD == ps->o.backend; + || BKEND_XR_GLX_HYBRID == ps->o.backend; } /** @@ -1729,7 +1734,7 @@ bkend_use_xrender(session_t *ps) { static inline bool bkend_use_glx(session_t *ps) { return BKEND_GLX == ps->o.backend - || BKEND_XR_GLX_HYBIRD == ps->o.backend; + || BKEND_XR_GLX_HYBRID == ps->o.backend; } /** diff --git a/compton.c b/compton.c index 1281c02b7..95f6b77ce 100644 --- a/compton.c +++ b/compton.c @@ -47,7 +47,7 @@ const char * const VSYNC_STRS[NUM_VSYNC + 1] = { const char * const BACKEND_STRS[NUM_BKEND + 1] = { "xrender", // BKEND_XRENDER "glx", // BKEND_GLX - "xr_glx_hybird",// BKEND_XR_GLX_HYBIRD + "xr_glx_hybrid",// BKEND_XR_GLX_HYBRID NULL }; @@ -1405,7 +1405,7 @@ win_blur_background(session_t *ps, win *w, Picture tgt_buffer, switch (ps->o.backend) { case BKEND_XRENDER: - case BKEND_XR_GLX_HYBIRD: + case BKEND_XR_GLX_HYBRID: { // Normalize blur kernels for (int i = 0; i < MAX_BLUR_PASS; ++i) { @@ -1478,7 +1478,7 @@ render(session_t *ps, int x, int y, int dx, int dy, int wid, int hei, XserverRegion reg_paint, const reg_data_t *pcache_reg) { switch (ps->o.backend) { case BKEND_XRENDER: - case BKEND_XR_GLX_HYBIRD: + case BKEND_XR_GLX_HYBRID: { Picture alpha_pict = get_alpha_pict_d(ps, opacity); if (alpha_pict != ps->alpha_picts[0]) { @@ -1643,7 +1643,7 @@ win_paint_win(session_t *ps, win *w, XserverRegion reg_paint, switch (ps->o.backend) { case BKEND_XRENDER: - case BKEND_XR_GLX_HYBIRD: + case BKEND_XR_GLX_HYBRID: { unsigned short cval = 0xffff * dim_opacity; @@ -1759,7 +1759,7 @@ paint_all(session_t *ps, XserverRegion region, XserverRegion region_real, win *t ps->root_width, ps->root_height); break; case BKEND_GLX: - case BKEND_XR_GLX_HYBIRD: + case BKEND_XR_GLX_HYBRID: glClearColor(0.0f, 0.0f, 1.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT); glClearColor(0.0f, 0.0f, 0.0f, 1.0f); @@ -1937,7 +1937,7 @@ paint_all(session_t *ps, XserverRegion region, XserverRegion region_real, win *t } break; #ifdef CONFIG_VSYNC_OPENGL - case BKEND_XR_GLX_HYBIRD: + case BKEND_XR_GLX_HYBRID: XSync(ps->dpy, False); glFinish(); glXWaitX(); @@ -4485,7 +4485,7 @@ usage(int ret) { " screen." WARNING "\n" "--backend backend\n" " Choose backend. Possible choices are xrender, glx, and\n" - " xr_glx_hybird" WARNING ".\n" + " xr_glx_hybrid" WARNING ".\n" "--glx-no-stencil\n" " GLX backend: Avoid using stencil buffer. Might cause issues\n" " when rendering transparent content. My tests show a 15% performance\n" @@ -6204,7 +6204,7 @@ init_filters(session_t *ps) { if (ps->o.blur_background || ps->o.blur_background_frame) { switch (ps->o.backend) { case BKEND_XRENDER: - case BKEND_XR_GLX_HYBIRD: + case BKEND_XR_GLX_HYBRID: { // Query filters XFilters *pf = XRenderQueryFilters(ps->dpy, get_tgt_window(ps)); diff --git a/compton.h b/compton.h index 8d1e90e21..22ee195dd 100644 --- a/compton.h +++ b/compton.h @@ -686,7 +686,7 @@ static inline void set_tgt_clip(session_t *ps, XserverRegion reg, const reg_data_t *pcache_reg) { switch (ps->o.backend) { case BKEND_XRENDER: - case BKEND_XR_GLX_HYBIRD: + case BKEND_XR_GLX_HYBRID: XFixesSetPictureClipRegion(ps->dpy, ps->tgt_buffer.pict, 0, 0, reg); break; #ifdef CONFIG_VSYNC_OPENGL -- cgit v1.2.1 From 0969d7d525ce8e053f9e8e7dd79540570307f477 Mon Sep 17 00:00:00 2001 From: Richard Grenville Date: Thu, 26 Dec 2013 20:43:06 +0800 Subject: Misc #163: Make usage of glFinish() optional Make usage of glFinish() optional to avoid high CPU usage. (#163) --- common.h | 3 +++ compton.c | 12 ++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/common.h b/common.h index 71ea8975b..7786f82b8 100644 --- a/common.h +++ b/common.h @@ -513,6 +513,9 @@ typedef struct { bool dbe; /// Whether to do VSync aggressively. bool vsync_aggressive; + /// Whether to use glFinish() instead of glFlush() for (possibly) better + /// VSync yet probably higher CPU usage. + bool vsync_use_glfinish; // === Shadow === /// Enable/disable shadow for specific window types. diff --git a/compton.c b/compton.c index 95f6b77ce..3ddf46f4c 100644 --- a/compton.c +++ b/compton.c @@ -1905,7 +1905,10 @@ paint_all(session_t *ps, XserverRegion region, XserverRegion region_real, win *t XSync(ps->dpy, False); #ifdef CONFIG_VSYNC_OPENGL if (ps->glx_context) { - glFinish(); + if (ps->o.vsync_use_glfinish) + glFinish(); + else + glFlush(); glXWaitX(); } #endif @@ -1939,7 +1942,10 @@ paint_all(session_t *ps, XserverRegion region, XserverRegion region_real, win *t #ifdef CONFIG_VSYNC_OPENGL case BKEND_XR_GLX_HYBRID: XSync(ps->dpy, False); - glFinish(); + if (ps->o.vsync_use_glfinish) + glFinish(); + else + glFlush(); glXWaitX(); paint_bind_tex_real(ps, &ps->tgt_buffer, ps->root_width, ps->root_height, ps->depth, @@ -5421,6 +5427,7 @@ get_cfg(session_t *ps, int argc, char *const *argv, bool first_pass) { { "unredir-if-possible-exclude", required_argument, NULL, 308 }, { "unredir-if-possible-delay", required_argument, NULL, 309 }, { "write-pid-path", required_argument, NULL, 310 }, + { "vsync-use-glfinish", no_argument, NULL, 311 }, // Must terminate with a NULL entry { NULL, 0, NULL, 0 }, }; @@ -5668,6 +5675,7 @@ get_cfg(session_t *ps, int argc, char *const *argv, bool first_pass) { // --write-pid-path ps->o.write_pid_path = mstrcpy(optarg); break; + P_CASEBOOL(311, vsync_use_glfinish); default: usage(1); break; -- cgit v1.2.1