1
0
Fork 0
mirror of https://github.com/yshui/picom.git synced 2025-04-14 17:53:25 -04:00

Merge pull request #768 from yshui/deprecation-chore

This commit is contained in:
yshui 2022-01-27 10:42:25 +00:00 committed by GitHub
commit 0ad6685614
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 60 additions and 292 deletions

View file

@ -43,9 +43,6 @@ OPTIONS
*-D*, *--fade-delta*='MILLISECONDS'::
The time between steps in fade step, in milliseconds. (> 0, defaults to 10)
*-m*, *--menu-opacity*='OPACITY'::
Default opacity for dropdown menus and popup menus. (0.0 - 1.0, defaults to 1.0)
*-c*, *--shadow*::
Enabled client-side shadows on windows. Note desktop windows (windows with '_NET_WM_WINDOW_TYPE_DESKTOP') never get shadow, unless explicitly requested using the wintypes option.
@ -130,9 +127,6 @@ OPTIONS
*--detect-client-opacity*::
Detect '_NET_WM_WINDOW_OPACITY' on client windows, useful for window managers not passing '_NET_WM_WINDOW_OPACITY' of client windows to frame windows.
*--refresh-rate* 'REFRESH_RATE'::
Specify refresh rate of the screen. If not specified or 0, picom will try detecting this with X RandR extension.
*--vsync*, *--no-vsync*::
Enable/disable VSync.

View file

@ -241,12 +241,6 @@ detect-rounded-corners = true;
# detect-client-opacity = false
detect-client-opacity = true;
# Specify refresh rate of the screen. If not specified or 0, picom will
# try detecting this with X RandR extension.
#
# refresh-rate = 60
refresh-rate = 0;
# Use EWMH '_NET_ACTIVE_WINDOW' to determine currently focused window,
# rather than listening to 'FocusIn'/'FocusOut' event. Might have more accuracy,
# provided that the WM supports it.

View file

@ -139,9 +139,6 @@ typedef struct session {
ev_timer unredir_timer;
/// Timer for fading
ev_timer fade_timer;
/// Timer for delayed drawing, right now only used by
/// swopti
ev_timer delayed_draw_timer;
/// Use an ev_idle callback for drawing
/// So we only start drawing when events are processed
ev_idle draw_idle;
@ -187,7 +184,7 @@ typedef struct session {
int root_width;
// Damage of root window.
// Damage root_damage;
/// X Composite overlay window. Used if <code>--paint-on-overlay</code>.
/// X Composite overlay window.
xcb_window_t overlay;
/// The target window for debug mode
xcb_window_t debug_window;
@ -298,10 +295,6 @@ typedef struct session {
region_t shadow_exclude_reg;
// === Software-optimization-related ===
/// Currently used refresh rate.
int refresh_rate;
/// Interval between refresh in nanoseconds.
long refresh_intv;
/// Nanosecond offset of the first painting.
long paint_tm_offset;

View file

@ -527,8 +527,6 @@ char *parse_config(options_t *opt, const char *config_file, bool *shadow_enable,
.benchmark_wid = XCB_NONE,
.logpath = NULL,
.refresh_rate = 0,
.sw_opti = false,
.use_damage = true,
.shadow_red = 0.0,

View file

@ -130,10 +130,6 @@ typedef struct options {
win_option_t wintype_option[NUM_WINTYPES];
// === VSync & software optimization ===
/// User-specified refresh rate.
int refresh_rate;
/// Whether to enable refresh-rate-based software optimization.
bool sw_opti;
/// VSync method to use;
bool vsync;
/// Whether to use glFinish() instead of glFlush() for (possibly) better

View file

@ -303,6 +303,11 @@ static inline void parse_wintype_config(const config_t *cfg, const char *member_
char *parse_config_libconfig(options_t *opt, const char *config_file, bool *shadow_enable,
bool *fading_enable, bool *conv_kern_hasneg,
win_option_mask_t *winopt_mask) {
const char *deprecation_message =
"option has been deprecated. Please remove it from your configuration file. "
"If you encounter any problems without this feature, please feel free to "
"open a bug report";
char *path = NULL;
FILE *f;
config_t cfg;
@ -387,24 +392,11 @@ char *parse_config_libconfig(options_t *opt, const char *config_file, bool *shad
// -c (shadow_enable)
if (config_lookup_bool(&cfg, "shadow", &ival))
*shadow_enable = ival;
// -C (no_dock_shadow)
if (config_lookup_bool(&cfg, "no-dock-shadow", &ival)) {
log_error("Option `no-dock-shadow` has been removed. Please use the "
"wintype option `shadow` of `dock` instead.");
goto err;
}
// -G (no_dnd_shadow)
if (config_lookup_bool(&cfg, "no-dnd-shadow", &ival)) {
log_error("Option `no-dnd-shadow` has been removed. Please use the "
"wintype option `shadow` of `dnd` instead.");
goto err;
};
// -m (menu_opacity)
if (config_lookup_float(&cfg, "menu-opacity", &dval)) {
log_warn("Option `menu-opacity` is deprecated, and will be "
"removed.Please use the "
"wintype option `opacity` of `popup_menu` and `dropdown_menu` "
"instead.");
log_warn("Option `menu-opacity` is deprecated, and will be removed."
"Please use the wintype option `opacity` of `popup_menu`"
"and `dropdown_menu` instead.");
opt->wintype_option[WINTYPE_DROPDOWN_MENU].opacity = dval;
opt->wintype_option[WINTYPE_POPUP_MENU].opacity = dval;
winopt_mask[WINTYPE_DROPDOWN_MENU].opacity = true;
@ -451,19 +443,16 @@ char *parse_config_libconfig(options_t *opt, const char *config_file, bool *shad
// --detect-client-opacity
lcfg_lookup_bool(&cfg, "detect-client-opacity", &opt->detect_client_opacity);
// --refresh-rate
if (config_lookup_int(&cfg, "refresh-rate", &opt->refresh_rate)) {
if (opt->refresh_rate < 0) {
log_warn("Invalid refresh rate %d, fallback to 0", opt->refresh_rate);
opt->refresh_rate = 0;
}
if (config_lookup_int(&cfg, "refresh-rate", &ival)) {
log_warn("The refresh-rate %s", deprecation_message);
}
// --vsync
if (config_lookup_string(&cfg, "vsync", &sval)) {
opt->vsync = parse_vsync(sval);
log_warn("vsync option will take a boolean from now on. \"%s\" is "
"interpreted as \"%s\" for compatibility, but this will stop "
"working soon",
sval, opt->vsync ? "true" : "false");
bool parsed_vsync = parse_vsync(sval);
log_error("vsync option will take a boolean from now on. \"%s\" in "
"your configuration should be changed to \"%s\"",
sval, parsed_vsync ? "true" : "false");
goto err;
}
lcfg_lookup_bool(&cfg, "vsync", &opt->vsync);
// --backend
@ -492,7 +481,9 @@ char *parse_config_libconfig(options_t *opt, const char *config_file, bool *shad
opt->logpath = strdup(sval);
}
// --sw-opti
lcfg_lookup_bool(&cfg, "sw-opti", &opt->sw_opti);
if (lcfg_lookup_bool(&cfg, "sw-opti", &bval)) {
log_warn("The sw-opti %s", deprecation_message);
}
// --use-ewmh-active-win
lcfg_lookup_bool(&cfg, "use-ewmh-active-win", &opt->use_ewmh_active_win);
// --unredir-if-possible
@ -577,6 +568,7 @@ char *parse_config_libconfig(options_t *opt, const char *config_file, bool *shad
if (config_lookup_string(&cfg, "glx-swap-method", &sval)) {
char *endptr;
long val = strtol(sval, &endptr, 10);
bool should_remove = true;
if (*endptr || !(*sval)) {
// sval is not a number, or an empty string
val = -1;
@ -584,12 +576,13 @@ char *parse_config_libconfig(options_t *opt, const char *config_file, bool *shad
if (strcmp(sval, "undefined") != 0 && val != 0) {
// If not undefined, we will use damage and buffer-age to limit
// the rendering area.
opt->use_damage = true;
should_remove = false;
}
log_warn("glx-swap-method has been deprecated since v6, your setting "
"\"%s\" should be %s.",
sval,
opt->use_damage ? "replaced by `use-damage = true`" : "removed");
log_error("glx-swap-method has been removed, your setting "
"\"%s\" should be %s.",
sval,
!should_remove ? "replaced by `use-damage = true`" : "removed");
goto err;
}
// --use-damage
lcfg_lookup_bool(&cfg, "use-damage", &opt->use_damage);
@ -603,14 +596,9 @@ char *parse_config_libconfig(options_t *opt, const char *config_file, bool *shad
}
// --glx-use-gpushader4
if (config_lookup_bool(&cfg, "glx-use-gpushader4", &ival) && ival) {
log_warn("glx-use-gpushader4 is deprecated since v6, please remove it "
"from"
"your config file");
}
// --xrender-sync
if (config_lookup_bool(&cfg, "xrender-sync", &ival) && ival) {
log_error("Please use xrender-sync-fence instead of xrender-sync.");
if (config_lookup_bool(&cfg, "glx-use-gpushader4", &ival)) {
log_error("glx-use-gpushader4 has been removed, please remove it "
"from your config file");
goto err;
}
// --xrender-sync-fence
@ -619,21 +607,6 @@ char *parse_config_libconfig(options_t *opt, const char *config_file, bool *shad
if (lcfg_lookup_bool(&cfg, "clear-shadow", &bval))
log_warn("\"clear-shadow\" is removed as an option, and is always"
" enabled now. Consider removing it from your config file");
if (lcfg_lookup_bool(&cfg, "paint-on-overlay", &bval)) {
log_error("\"paint-on-overlay\" has been removed as an option, and "
"the feature is enabled whenever possible");
goto err;
}
if (config_lookup_float(&cfg, "alpha-step", &dval)) {
log_error("\"alpha-step\" has been removed, compton now tries to make use"
" of all alpha values");
goto err;
}
const char *deprecation_message attr_unused =
"has been removed. If you encounter problems "
"without this feature, please feel free to open a bug report";
config_setting_t *blur_cfg = config_lookup(&cfg, "blur");
if (blur_cfg) {

View file

@ -1010,8 +1010,8 @@ static bool cdbus_process_opts_get(session_t *ps, DBusMessage *msg) {
cdbus_m_opts_get_do(stoppaint_force, cdbus_reply_enum);
cdbus_m_opts_get_do(logpath, cdbus_reply_string);
cdbus_m_opts_get_do(refresh_rate, cdbus_reply_int32);
cdbus_m_opts_get_do(sw_opti, cdbus_reply_bool);
cdbus_m_opts_get_stub(refresh_rate, cdbus_reply_int32, 0);
cdbus_m_opts_get_stub(sw_opti, cdbus_reply_bool, false);
cdbus_m_opts_get_do(vsync, cdbus_reply_bool);
if (!strcmp("backend", target)) {
assert(ps->o.backend < sizeof(BACKEND_STRS) / sizeof(BACKEND_STRS[0]));

View file

@ -160,16 +160,9 @@ static void usage(const char *argv0, int ret) {
" managers not passing _NET_WM_WINDOW_OPACITY of client windows to frame\n"
" windows.\n"
"\n"
"--refresh-rate val\n"
" Specify refresh rate of the screen. If not specified or 0, we\n"
" will try detecting this with X RandR extension.\n"
"\n"
"--vsync\n"
" Enable VSync\n"
"\n"
"--paint-on-overlay\n"
" Painting on X Composite overlay window.\n"
"\n"
"--use-ewmh-active-win\n"
" Use _NET_WM_ACTIVE_WINDOW on the root window to determine which\n"
" window is focused instead of using FocusIn/Out events.\n"
@ -359,7 +352,7 @@ static void usage(const char *argv0, int ret) {
#undef WARNING_DISABLED
}
static const char *shortopts = "D:I:O:d:r:o:m:l:t:i:e:hscnfFCaSzGb";
static const char *shortopts = "D:I:O:r:o:m:l:t:i:e:hscnfFCazGb";
static const struct option longopts[] = {
{"help", no_argument, NULL, 'h'},
{"config", required_argument, NULL, 256},
@ -372,13 +365,11 @@ static const struct option longopts[] = {
{"fade-delta", required_argument, NULL, 'D'},
{"menu-opacity", required_argument, NULL, 'm'},
{"shadow", no_argument, NULL, 'c'},
{"no-dock-shadow", no_argument, NULL, 'C'},
{"clear-shadow", no_argument, NULL, 'z'},
{"fading", no_argument, NULL, 'f'},
{"inactive-opacity", required_argument, NULL, 'i'},
{"frame-opacity", required_argument, NULL, 'e'},
{"daemon", no_argument, NULL, 'b'},
{"no-dnd-shadow", no_argument, NULL, 'G'},
{"shadow-red", required_argument, NULL, 257},
{"shadow-green", required_argument, NULL, 258},
{"shadow-blue", required_argument, NULL, 259},
@ -393,9 +384,6 @@ static const struct option longopts[] = {
{"detect-client-opacity", no_argument, NULL, 268},
{"refresh-rate", required_argument, NULL, 269},
{"vsync", optional_argument, NULL, 270},
{"alpha-step", required_argument, NULL, 271},
{"dbe", no_argument, NULL, 272},
{"paint-on-overlay", no_argument, NULL, 273},
{"sw-opti", no_argument, NULL, 274},
{"vsync-aggressive", no_argument, NULL, 275},
{"use-ewmh-active-win", no_argument, NULL, 276},
@ -432,7 +420,6 @@ static const struct option longopts[] = {
{"unredir-if-possible-delay", required_argument, NULL, 309},
{"write-pid-path", required_argument, NULL, 310},
{"vsync-use-glfinish", no_argument, NULL, 311},
{"xrender-sync", no_argument, NULL, 312},
{"xrender-sync-fence", no_argument, NULL, 313},
{"show-all-xerrors", no_argument, NULL, 314},
{"no-fading-destroyed-argb", no_argument, NULL, 315},
@ -440,7 +427,6 @@ static const struct option longopts[] = {
{"glx-fshader-win", required_argument, NULL, 317},
{"version", no_argument, NULL, 318},
{"no-x-selection", no_argument, NULL, 319},
{"no-name-pixmap", no_argument, NULL, 320},
{"log-level", required_argument, NULL, 321},
{"log-file", required_argument, NULL, 322},
{"use-damage", no_argument, NULL, 323},
@ -487,21 +473,11 @@ bool get_early_config(int argc, char *const *argv, char **config_file, bool *all
} else if (o == 'b') {
*fork = true;
} else if (o == 'd') {
log_error("-d is removed, please use the DISPLAY "
"environment variable");
goto err;
} else if (o == 314) {
*all_xerrors = true;
} else if (o == 318) {
printf("%s\n", COMPTON_VERSION);
return true;
} else if (o == 'S') {
log_error("-S is no longer available");
goto err;
} else if (o == 320) {
log_error("--no-name-pixmap is no longer available");
goto err;
} else if (o == '?' || o == ':') {
usage(argv[0], 1);
goto err;
@ -570,9 +546,7 @@ bool get_cfg(options_t *opt, int argc, char *const *argv, bool shadow_enable,
// so assert(false) here
assert(false);
break;
case 'd':
case 'b':
case 'S':
case 314:
case 320:
// These options are handled by get_early_config()
@ -581,15 +555,10 @@ bool get_cfg(options_t *opt, int argc, char *const *argv, bool shadow_enable,
case 'I': opt->fade_in_step = normalize_d(atof(optarg)); break;
case 'O': opt->fade_out_step = normalize_d(atof(optarg)); break;
case 'c': shadow_enable = true; break;
case 'C':
log_error("Option `--no-dock-shadow`/`-C` has been removed. Please"
" use the wintype option `shadow` of `dock` instead.");
failed = true; break;
case 'G':
log_error("Option `--no-dnd-shadow`/`-G` has been removed. Please "
"use the wintype option `shadow` of `dnd` instead.");
failed = true; break;
case 'm':;
log_warn("--menu-opacity is deprecated, and will be removed."
"Please use the wintype option `opacity` of `popup_menu`"
"and `dropdown_menu` instead.");
double tmp;
tmp = normalize_d(atof(optarg));
winopt_mask[WINTYPE_DROPDOWN_MENU].opacity = true;
@ -661,35 +630,30 @@ bool get_cfg(options_t *opt, int argc, char *const *argv, bool shadow_enable,
P_CASEBOOL(266, shadow_ignore_shaped);
P_CASEBOOL(267, detect_rounded_corners);
P_CASEBOOL(268, detect_client_opacity);
P_CASEINT(269, refresh_rate);
case 269:
log_warn("--refresh-rate has been deprecated, please remove it from"
"your command line options");
break;
case 270:
if (optarg) {
opt->vsync = parse_vsync(optarg);
log_warn("--vsync doesn't take argument anymore. \"%s\" "
"is interpreted as \"%s\" for compatibility, but "
"this will stop working soon",
optarg, opt->vsync ? "true" : "false");
bool parsed_vsync = parse_vsync(optarg);
log_error("--vsync doesn't take argument anymore. \"%s\" "
"should be changed to \"%s\"",
optarg, parsed_vsync ? "true" : "false");
failed = true;
} else {
opt->vsync = true;
}
break;
case 271:
// --alpha-step
log_error("--alpha-step has been removed, we now tries to "
"make use of all alpha values");
failed = true; break;
case 272:
log_error("--dbe has been removed");
failed = true; break;
case 273:
log_error("--paint-on-overlay has been removed, the feature is enabled "
"whenever possible");
failed = true; break;
P_CASEBOOL(274, sw_opti);
case 274:
log_warn("--sw-opti has been deprecated, please remove it from the "
"command line options");
break;
case 275:
// --vsync-aggressive
log_warn("--vsync-aggressive has been deprecated, please remove it"
log_error("--vsync-aggressive has been removed, please remove it"
" from the command line options");
failed = true;
break;
P_CASEBOOL(276, use_ewmh_active_win);
case 277:
@ -762,14 +726,14 @@ bool get_cfg(options_t *opt, int argc, char *const *argv, bool shadow_enable,
if (strcmp(optarg, "undefined") != 0 && tmpval != 0) {
// If not undefined, we will use damage and buffer-age to
// limit the rendering area.
opt->use_damage = true;
should_remove = false;
}
log_warn("--glx-swap-method has been deprecated, your setting "
log_error("--glx-swap-method has been removed, your setting "
"\"%s\" should be %s.",
optarg,
!should_remove ? "replaced by `--use-damage`" :
"removed");
failed = true;
break;
}
case 300:
@ -787,8 +751,9 @@ bool get_cfg(options_t *opt, int argc, char *const *argv, bool shadow_enable,
P_CASEINT(302, resize_damage);
case 303:
// --glx-use-gpushader4
log_warn("--glx-use-gpushader4 is deprecated since v6."
log_error("--glx-use-gpushader4 has been removed."
" Please remove it from command line options.");
failed = true;
break;
case 304:
// --opacity-rule
@ -821,10 +786,6 @@ bool get_cfg(options_t *opt, int argc, char *const *argv, bool shadow_enable,
}
break;
P_CASEBOOL(311, vsync_use_glfinish);
case 312:
// --xrender-sync
log_error("Please use --xrender-sync-fence instead of --xrender-sync");
failed = true; break;
P_CASEBOOL(313, xrender_sync_fence);
P_CASEBOOL(315, no_fading_destroyed_argb);
P_CASEBOOL(316, force_win_blend);
@ -943,7 +904,6 @@ bool get_cfg(options_t *opt, int argc, char *const *argv, bool shadow_enable,
opt->inactive_dim = normalize_d(opt->inactive_dim);
opt->frame_opacity = normalize_d(opt->frame_opacity);
opt->shadow_opacity = normalize_d(opt->shadow_opacity);
opt->refresh_rate = normalize_i_range(opt->refresh_rate, 0, 300);
opt->max_brightness = normalize_d(opt->max_brightness);
if (opt->max_brightness < 1.0) {

View file

@ -69,8 +69,6 @@
(session_t *)((char *)__mptr - offsetof(session_t, member)); \
})
static const long SWOPTI_TOLERANCE = 3000;
static bool must_use redirect_start(session_t *ps);
static void unredirect(session_t *ps);
@ -611,14 +609,6 @@ static void handle_root_flags(session_t *ps) {
if (ps->o.xinerama_shadow_crop) {
cxinerama_upd_scrs(ps);
}
if (ps->o.sw_opti && !ps->o.refresh_rate) {
update_refresh_rate(ps);
if (!ps->refresh_rate) {
log_warn("Refresh rate detection failed. swopti will be "
"temporarily disabled");
}
}
ps->root_flags &= ~(uint64_t)ROOT_FLAGS_SCREEN_CHANGE;
}
@ -1098,77 +1088,6 @@ static inline bool write_pid(session_t *ps) {
return true;
}
/**
* Update refresh rate info with X Randr extension.
*/
void update_refresh_rate(session_t *ps) {
xcb_randr_get_screen_info_reply_t *randr_info = xcb_randr_get_screen_info_reply(
ps->c, xcb_randr_get_screen_info(ps->c, ps->root), NULL);
if (!randr_info)
return;
ps->refresh_rate = randr_info->rate;
free(randr_info);
if (ps->refresh_rate)
ps->refresh_intv = US_PER_SEC / ps->refresh_rate;
else
ps->refresh_intv = 0;
}
/**
* Initialize refresh-rated based software optimization.
*
* @return true for success, false otherwise
*/
static bool swopti_init(session_t *ps) {
log_warn("--sw-opti is going to be deprecated. If you get real benefits from "
"using "
"this option, please open an issue to let us know.");
// Prepare refresh rate
// Check if user provides one
ps->refresh_rate = ps->o.refresh_rate;
if (ps->refresh_rate)
ps->refresh_intv = US_PER_SEC / ps->refresh_rate;
// Auto-detect refresh rate otherwise
if (!ps->refresh_rate && ps->randr_exists) {
update_refresh_rate(ps);
}
// Turn off vsync_sw if we can't get the refresh rate
if (!ps->refresh_rate)
return false;
return true;
}
/**
* Modify a struct timeval timeout value to render at a fixed pace.
*
* @param ps current session
* @param[in,out] ptv pointer to the timeout
*/
static double swopti_handle_timeout(session_t *ps) {
if (!ps->refresh_intv)
return 0;
// Get the microsecond offset of the time when the we reach the timeout
// I don't think a 32-bit long could overflow here.
long offset = (get_time_timeval().tv_usec - ps->paint_tm_offset) % ps->refresh_intv;
// XXX this formula dones't work if refresh rate is not a whole number
if (offset < 0)
offset += ps->refresh_intv;
// If the target time is sufficiently close to a refresh time, don't add
// an offset, to avoid certain blocking conditions.
if (offset < SWOPTI_TOLERANCE || offset > ps->refresh_intv - SWOPTI_TOLERANCE)
return 0;
// Add an offset so we wait until the next refresh after timeout
return (double)(ps->refresh_intv - offset) / 1e6;
}
/**
* Initialize X composite overlay window.
*/
@ -1567,7 +1486,6 @@ static void draw_callback_impl(EV_P_ session_t *ps, int revents attr_unused) {
}
static void draw_callback(EV_P_ ev_idle *w, int revents) {
// This function is not used if we are using --swopti
session_t *ps = session_ptr(w, draw_idle);
draw_callback_impl(EV_A_ ps, revents);
@ -1578,46 +1496,6 @@ static void draw_callback(EV_P_ ev_idle *w, int revents) {
}
}
static void delayed_draw_timer_callback(EV_P_ ev_timer *w, int revents) {
session_t *ps = session_ptr(w, delayed_draw_timer);
draw_callback_impl(EV_A_ ps, revents);
// We might have stopped the ev_idle in delayed_draw_callback,
// so we restart it if we are in benchmark mode
if (ps->o.benchmark)
ev_idle_start(EV_A_ & ps->draw_idle);
}
static void delayed_draw_callback(EV_P_ ev_idle *w, int revents) {
// This function is only used if we are using --swopti
session_t *ps = session_ptr(w, draw_idle);
assert(ps->redraw_needed);
assert(!ev_is_active(&ps->delayed_draw_timer));
double delay = swopti_handle_timeout(ps);
if (delay < 1e-6) {
if (!ps->o.benchmark) {
ev_idle_stop(EV_A_ & ps->draw_idle);
}
return draw_callback_impl(EV_A_ ps, revents);
}
// This is a little bit hacky. When we get to this point in code, we need
// to update the screen , but we will only be updating after a delay, So
// we want to stop the ev_idle, so this callback doesn't get call repeatedly
// during the delay, we also want queue_redraw to not restart the ev_idle.
// So we stop ev_idle and leave ps->redraw_needed to be true. (effectively,
// ps->redraw_needed means if redraw is needed or if draw is in progress).
//
// We do this anyway even if we are in benchmark mode. That means we will
// have to restart draw_idle after the draw actually happened when we are in
// benchmark mode.
ev_idle_stop(EV_A_ & ps->draw_idle);
ev_timer_set(&ps->delayed_draw_timer, delay, 0);
ev_timer_start(EV_A_ & ps->delayed_draw_timer);
}
static void x_event_callback(EV_P attr_unused, ev_io *w, int revents attr_unused) {
session_t *ps = (session_t *)w;
xcb_generic_event_t *ev = xcb_poll_for_event(ps->c);
@ -1700,10 +1578,6 @@ static session_t *session_init(int argc, char **argv, Display *dpy,
.white_picture = XCB_NONE,
.gaussian_map = NULL,
.refresh_rate = 0,
.refresh_intv = 0UL,
.paint_tm_offset = 0L,
#ifdef CONFIG_VSYNC_DRM
.drm_fd = -1,
#endif
@ -2007,11 +1881,10 @@ static session_t *session_init(int argc, char **argv, Display *dpy,
}
// Query X RandR
if ((ps->o.sw_opti && !ps->o.refresh_rate) || ps->o.xinerama_shadow_crop) {
if (ps->o.xinerama_shadow_crop) {
if (!ps->randr_exists) {
log_fatal("No XRandR extension. sw-opti, refresh-rate or "
"xinerama-shadow-crop "
"cannot be enabled.");
log_fatal("No XRandR extension. xinerama-shadow-crop cannot be "
"enabled.");
goto err;
}
}
@ -2113,15 +1986,11 @@ static session_t *session_init(int argc, char **argv, Display *dpy,
}
}
// Initialize software optimization
if (ps->o.sw_opti)
ps->o.sw_opti = swopti_init(ps);
// Monitor screen changes if vsync_sw is enabled and we are using
// an auto-detected refresh rate, or when Xinerama features are enabled
if (ps->randr_exists &&
((ps->o.sw_opti && !ps->o.refresh_rate) || ps->o.xinerama_shadow_crop))
if (ps->randr_exists && ps->o.xinerama_shadow_crop) {
xcb_randr_select_input(ps->c, ps->root, XCB_RANDR_NOTIFY_MASK_SCREEN_CHANGE);
}
cxinerama_upd_scrs(ps);
@ -2142,13 +2011,9 @@ static session_t *session_init(int argc, char **argv, Display *dpy,
ev_io_init(&ps->xiow, x_event_callback, ConnectionNumber(ps->dpy), EV_READ);
ev_io_start(ps->loop, &ps->xiow);
ev_init(&ps->unredir_timer, tmout_unredir_callback);
if (ps->o.sw_opti)
ev_idle_init(&ps->draw_idle, delayed_draw_callback);
else
ev_idle_init(&ps->draw_idle, draw_callback);
ev_idle_init(&ps->draw_idle, draw_callback);
ev_init(&ps->fade_timer, fade_timer_callback);
ev_init(&ps->delayed_draw_timer, delayed_draw_timer_callback);
// Set up SIGUSR1 signal handler to reset program
ev_signal_init(&ps->usr1_signal, reset_enable, SIGUSR1);
@ -2436,9 +2301,6 @@ static void session_destroy(session_t *ps) {
* @param ps current session
*/
static void session_run(session_t *ps) {
if (ps->o.sw_opti)
ps->paint_tm_offset = get_time_timeval().tv_usec;
// In benchmark mode, we want draw_idle handler to always be active
if (ps->o.benchmark) {
ev_idle_start(ps->loop, &ps->draw_idle);

View file

@ -40,8 +40,6 @@ uint32_t determine_evmask(session_t *ps, xcb_window_t wid, win_evmode_t mode);
void circulate_win(session_t *ps, xcb_circulate_notify_event_t *ce);
void update_refresh_rate(session_t *ps);
void root_damaged(session_t *ps);
void cxinerama_upd_scrs(session_t *ps);