Remove support of Xdbe

--dbe does not seem to have an effect on tearing, as noted in the old
manpage, and confirmed by my own testing.

So remove it, since it complicates the logic of painting.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2018-10-21 19:25:13 +01:00
parent 1f95c74a68
commit f519ee53c1
4 changed files with 16 additions and 96 deletions

View File

@ -83,7 +83,6 @@
#include <X11/Xlib-xcb.h> #include <X11/Xlib-xcb.h>
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/extensions/Xdbe.h>
#ifdef CONFIG_XSYNC #ifdef CONFIG_XSYNC
#include <X11/extensions/sync.h> #include <X11/extensions/sync.h>
#endif #endif
@ -531,8 +530,6 @@ typedef struct options_t {
bool sw_opti; bool sw_opti;
/// VSync method to use; /// VSync method to use;
vsync_t vsync; vsync_t vsync;
/// Whether to enable double buffer.
bool dbe;
/// Whether to do VSync aggressively. /// Whether to do VSync aggressively.
bool vsync_aggressive; bool vsync_aggressive;
/// Whether to use glFinish() instead of glFlush() for (possibly) better /// Whether to use glFinish() instead of glFlush() for (possibly) better
@ -745,8 +742,6 @@ typedef struct session {
#ifdef CONFIG_XSYNC #ifdef CONFIG_XSYNC
XSyncFence tgt_buffer_fence; XSyncFence tgt_buffer_fence;
#endif #endif
/// DBE back buffer for root window. Used in DBE painting mode.
XdbeBackBuffer root_dbe;
/// Window ID of the window we register as a symbol. /// Window ID of the window we register as a symbol.
Window reg_win; Window reg_win;
#ifdef CONFIG_OPENGL #ifdef CONFIG_OPENGL
@ -899,8 +894,6 @@ typedef struct session {
/// Error base number for X GLX extension. /// Error base number for X GLX extension.
int glx_error; int glx_error;
#endif #endif
/// Whether X DBE extension exists.
bool dbe_exists;
#ifdef CONFIG_XINERAMA #ifdef CONFIG_XINERAMA
/// Whether X Xinerama extension exists. /// Whether X Xinerama extension exists.
bool xinerama_exists; bool xinerama_exists;

View File

@ -1675,27 +1675,18 @@ paint_all(session_t *ps, region_t *region, const region_t *region_real, win * co
ps->tgt_buffer.pict = ps->tgt_picture; ps->tgt_buffer.pict = ps->tgt_picture;
#else #else
if (!paint_isvalid(ps, &ps->tgt_buffer)) { if (!paint_isvalid(ps, &ps->tgt_buffer)) {
// DBE painting mode: Directly paint to a Picture of the back buffer if (!ps->tgt_buffer.pixmap) {
if (BKEND_XRENDER == ps->o.backend && ps->o.dbe) { free_paint(ps, &ps->tgt_buffer);
ps->tgt_buffer.pict = x_create_picture_with_visual_and_pixmap( ps->tgt_buffer.pixmap = x_create_pixmap(ps, ps->depth, ps->root, ps->root_width, ps->root_height);
ps, ps->vis, ps->root_dbe, 0, 0); if (ps->tgt_buffer.pixmap == XCB_NONE) {
} fprintf(stderr, "Failed to allocate a screen-sized pixmap\n");
// No-DBE painting mode: Paint to an intermediate Picture then paint exit(1);
// the Picture to root window
else {
if (!ps->tgt_buffer.pixmap) {
free_paint(ps, &ps->tgt_buffer);
ps->tgt_buffer.pixmap = x_create_pixmap(ps, ps->depth, ps->root, ps->root_width, ps->root_height);
if (ps->tgt_buffer.pixmap == XCB_NONE) {
fprintf(stderr, "Failed to allocate a screen-sized pixmap\n");
exit(1);
}
} }
if (BKEND_GLX != ps->o.backend)
ps->tgt_buffer.pict = x_create_picture_with_visual_and_pixmap(
ps, ps->vis, ps->tgt_buffer.pixmap, 0, 0);
} }
if (BKEND_GLX != ps->o.backend)
ps->tgt_buffer.pict = x_create_picture_with_visual_and_pixmap(
ps, ps->vis, ps->tgt_buffer.pixmap, 0, 0);
} }
#endif #endif
@ -1807,8 +1798,7 @@ paint_all(session_t *ps, region_t *region, const region_t *region_real, win * co
pixman_region32_fini(&reg_tmp); pixman_region32_fini(&reg_tmp);
// Do this as early as possible // Do this as early as possible
if (!ps->o.dbe) set_tgt_clip(ps, &ps->screen_reg);
set_tgt_clip(ps, &ps->screen_reg);
if (ps->o.vsync) { if (ps->o.vsync) {
// Make sure all previous requests are processed to achieve best // Make sure all previous requests are processed to achieve best
@ -1833,17 +1823,7 @@ paint_all(session_t *ps, region_t *region, const region_t *region_real, win * co
switch (ps->o.backend) { switch (ps->o.backend) {
case BKEND_XRENDER: case BKEND_XRENDER:
// DBE painting mode, only need to swap the buffer if (ps->tgt_buffer.pict != ps->tgt_picture) {
if (ps->o.dbe) {
XdbeSwapInfo swap_info = {
.swap_window = get_tgt_window(ps),
// Is it safe to use XdbeUndefined?
.swap_action = XdbeCopied
};
XdbeSwapBuffers(ps->dpy, &swap_info, 1);
}
// No-DBE painting mode
else if (ps->tgt_buffer.pict != ps->tgt_picture) {
xcb_render_composite( xcb_render_composite(
ps->c, XCB_RENDER_PICT_OP_SRC, ps->tgt_buffer.pict, None, ps->c, XCB_RENDER_PICT_OP_SRC, ps->tgt_buffer.pict, None,
ps->tgt_picture, 0, 0, 0, 0, ps->tgt_picture, 0, 0, 0, 0,
@ -3299,10 +3279,6 @@ usage(int ret) {
" X Render backend: Step for pregenerating alpha pictures. \n" " X Render backend: Step for pregenerating alpha pictures. \n"
" 0.01 - 1.0. Defaults to 0.03.\n" " 0.01 - 1.0. Defaults to 0.03.\n"
"\n" "\n"
"--dbe\n"
" Enable DBE painting mode, intended to use with VSync to\n"
" (hopefully) eliminate tearing.\n"
"\n"
"--paint-on-overlay\n" "--paint-on-overlay\n"
" Painting on X Composite overlay window.\n" " Painting on X Composite overlay window.\n"
"\n" "\n"
@ -3909,7 +3885,9 @@ get_cfg(session_t *ps, int argc, char *const *argv, bool first_pass) {
// --alpha-step // --alpha-step
ps->o.alpha_step = atof(optarg); ps->o.alpha_step = atof(optarg);
break; break;
P_CASEBOOL(272, dbe); case 272:
printf_errf("(): use of --dbe is deprecated");
break;
P_CASEBOOL(273, paint_on_overlay); P_CASEBOOL(273, paint_on_overlay);
P_CASEBOOL(274, sw_opti); P_CASEBOOL(274, sw_opti);
P_CASEBOOL(275, vsync_aggressive); P_CASEBOOL(275, vsync_aggressive);
@ -4486,21 +4464,6 @@ init_alpha_picts(session_t *ps) {
} }
} }
/**
* Initialize double buffer.
*/
static bool
init_dbe(session_t *ps) {
if (!(ps->root_dbe = XdbeAllocateBackBufferName(ps->dpy,
(ps->o.paint_on_overlay ? ps->overlay: ps->root), XdbeCopied))) {
printf_errf("(): Failed to create double buffer. Double buffering "
"cannot work.");
return false;
}
return true;
}
/** /**
* Initialize X composite overlay window. * Initialize X composite overlay window.
*/ */
@ -4880,7 +4843,6 @@ session_init(session_t *ps_old, int argc, char **argv) {
.root_tile_paint = PAINT_INIT, .root_tile_paint = PAINT_INIT,
.tgt_picture = None, .tgt_picture = None,
.tgt_buffer = PAINT_INIT, .tgt_buffer = PAINT_INIT,
.root_dbe = None,
.reg_win = None, .reg_win = None,
.o = { .o = {
.config_file = NULL, .config_file = NULL,
@ -4910,7 +4872,6 @@ session_init(session_t *ps_old, int argc, char **argv) {
.refresh_rate = 0, .refresh_rate = 0,
.sw_opti = false, .sw_opti = false,
.vsync = VSYNC_NONE, .vsync = VSYNC_NONE,
.dbe = false,
.vsync_aggressive = false, .vsync_aggressive = false,
.wintype_shadow = { false }, .wintype_shadow = { false },
@ -5017,7 +4978,6 @@ session_init(session_t *ps_old, int argc, char **argv) {
.glx_event = 0, .glx_event = 0,
.glx_error = 0, .glx_error = 0,
#endif #endif
.dbe_exists = false,
.xrfilter_convolution_exists = false, .xrfilter_convolution_exists = false,
.atom_opacity = None, .atom_opacity = None,
@ -5222,22 +5182,6 @@ session_init(session_t *ps_old, int argc, char **argv) {
"detection impossible."); "detection impossible.");
} }
// Query X DBE extension
if (ps->o.dbe) {
int dbe_ver_major = 0, dbe_ver_minor = 0;
if (XdbeQueryExtension(ps->dpy, &dbe_ver_major, &dbe_ver_minor))
if (dbe_ver_major >= 1)
ps->dbe_exists = true;
else
fprintf(stderr, "DBE extension version too low. Double buffering "
"impossible.\n");
else {
fprintf(stderr, "No DBE extension. Double buffering impossible.\n");
}
if (!ps->dbe_exists)
ps->o.dbe = false;
}
// Query X Xinerama extension // Query X Xinerama extension
if (ps->o.xinerama_shadow_crop) { if (ps->o.xinerama_shadow_crop) {
#ifdef CONFIG_XINERAMA #ifdef CONFIG_XINERAMA
@ -5255,15 +5199,6 @@ session_init(session_t *ps_old, int argc, char **argv) {
if (ps->o.paint_on_overlay) if (ps->o.paint_on_overlay)
init_overlay(ps); init_overlay(ps);
// Initialize DBE
if (ps->o.dbe && BKEND_XRENDER != ps->o.backend) {
printf_errf("(): DBE couldn't be used on GLX backend.");
ps->o.dbe = false;
}
if (ps->o.dbe && !init_dbe(ps))
exit(1);
// Initialize OpenGL as early as possible // Initialize OpenGL as early as possible
if (bkend_use_glx(ps)) { if (bkend_use_glx(ps)) {
#ifdef CONFIG_OPENGL #ifdef CONFIG_OPENGL
@ -5581,12 +5516,6 @@ session_destroy(session_t *ps) {
glx_destroy(ps); glx_destroy(ps);
#endif #endif
// Free double buffer
if (ps->root_dbe) {
XdbeDeallocateBackBufferName(ps->dpy, ps->root_dbe);
ps->root_dbe = None;
}
#ifdef CONFIG_VSYNC_DRM #ifdef CONFIG_VSYNC_DRM
// Close file opened for DRM VSync // Close file opened for DRM VSync
if (ps->drm_fd >= 0) { if (ps->drm_fd >= 0) {

View File

@ -297,8 +297,6 @@ parse_config(session_t *ps, struct options_tmp *pcfgtmp) {
exit(1); exit(1);
// --alpha-step // --alpha-step
config_lookup_float(&cfg, "alpha-step", &ps->o.alpha_step); config_lookup_float(&cfg, "alpha-step", &ps->o.alpha_step);
// --dbe
lcfg_lookup_bool(&cfg, "dbe", &ps->o.dbe);
// --paint-on-overlay // --paint-on-overlay
lcfg_lookup_bool(&cfg, "paint-on-overlay", &ps->o.paint_on_overlay); lcfg_lookup_bool(&cfg, "paint-on-overlay", &ps->o.paint_on_overlay);
// --sw-opti // --sw-opti

View File

@ -910,7 +910,7 @@ cdbus_process_opts_get(session_t *ps, DBusMessage *msg) {
cdbus_reply_string(ps, msg, BACKEND_STRS[ps->o.backend]); cdbus_reply_string(ps, msg, BACKEND_STRS[ps->o.backend]);
return true; return true;
} }
cdbus_m_opts_get_do(dbe, cdbus_reply_bool); cdbus_m_opts_get_stub(dbe, cdbus_reply_bool, false);
cdbus_m_opts_get_do(vsync_aggressive, cdbus_reply_bool); cdbus_m_opts_get_do(vsync_aggressive, cdbus_reply_bool);
cdbus_m_opts_get_do(shadow_red, cdbus_reply_double); cdbus_m_opts_get_do(shadow_red, cdbus_reply_double);