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
10 changed files with 60 additions and 292 deletions

View File

@@ -43,9 +43,6 @@ OPTIONS
*-D*, *--fade-delta*='MILLISECONDS':: *-D*, *--fade-delta*='MILLISECONDS'::
The time between steps in fade step, in milliseconds. (> 0, defaults to 10) 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*:: *-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. 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-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. 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*:: *--vsync*, *--no-vsync*::
Enable/disable VSync. Enable/disable VSync.

View File

@@ -241,12 +241,6 @@ detect-rounded-corners = true;
# detect-client-opacity = false # detect-client-opacity = false
detect-client-opacity = true; 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, # Use EWMH '_NET_ACTIVE_WINDOW' to determine currently focused window,
# rather than listening to 'FocusIn'/'FocusOut' event. Might have more accuracy, # rather than listening to 'FocusIn'/'FocusOut' event. Might have more accuracy,
# provided that the WM supports it. # provided that the WM supports it.

View File

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

View File

@@ -130,10 +130,6 @@ typedef struct options {
win_option_t wintype_option[NUM_WINTYPES]; win_option_t wintype_option[NUM_WINTYPES];
// === VSync & software optimization === // === 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; /// VSync method to use;
bool vsync; bool vsync;
/// Whether to use glFinish() instead of glFlush() for (possibly) better /// 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, char *parse_config_libconfig(options_t *opt, const char *config_file, bool *shadow_enable,
bool *fading_enable, bool *conv_kern_hasneg, bool *fading_enable, bool *conv_kern_hasneg,
win_option_mask_t *winopt_mask) { 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; char *path = NULL;
FILE *f; FILE *f;
config_t cfg; config_t cfg;
@@ -387,24 +392,11 @@ char *parse_config_libconfig(options_t *opt, const char *config_file, bool *shad
// -c (shadow_enable) // -c (shadow_enable)
if (config_lookup_bool(&cfg, "shadow", &ival)) if (config_lookup_bool(&cfg, "shadow", &ival))
*shadow_enable = 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) // -m (menu_opacity)
if (config_lookup_float(&cfg, "menu-opacity", &dval)) { if (config_lookup_float(&cfg, "menu-opacity", &dval)) {
log_warn("Option `menu-opacity` is deprecated, and will be " log_warn("Option `menu-opacity` is deprecated, and will be removed."
"removed.Please use the " "Please use the wintype option `opacity` of `popup_menu`"
"wintype option `opacity` of `popup_menu` and `dropdown_menu` " "and `dropdown_menu` instead.");
"instead.");
opt->wintype_option[WINTYPE_DROPDOWN_MENU].opacity = dval; opt->wintype_option[WINTYPE_DROPDOWN_MENU].opacity = dval;
opt->wintype_option[WINTYPE_POPUP_MENU].opacity = dval; opt->wintype_option[WINTYPE_POPUP_MENU].opacity = dval;
winopt_mask[WINTYPE_DROPDOWN_MENU].opacity = true; 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 // --detect-client-opacity
lcfg_lookup_bool(&cfg, "detect-client-opacity", &opt->detect_client_opacity); lcfg_lookup_bool(&cfg, "detect-client-opacity", &opt->detect_client_opacity);
// --refresh-rate // --refresh-rate
if (config_lookup_int(&cfg, "refresh-rate", &opt->refresh_rate)) { if (config_lookup_int(&cfg, "refresh-rate", &ival)) {
if (opt->refresh_rate < 0) { log_warn("The refresh-rate %s", deprecation_message);
log_warn("Invalid refresh rate %d, fallback to 0", opt->refresh_rate);
opt->refresh_rate = 0;
}
} }
// --vsync // --vsync
if (config_lookup_string(&cfg, "vsync", &sval)) { if (config_lookup_string(&cfg, "vsync", &sval)) {
opt->vsync = parse_vsync(sval); bool parsed_vsync = parse_vsync(sval);
log_warn("vsync option will take a boolean from now on. \"%s\" is " log_error("vsync option will take a boolean from now on. \"%s\" in "
"interpreted as \"%s\" for compatibility, but this will stop " "your configuration should be changed to \"%s\"",
"working soon", sval, parsed_vsync ? "true" : "false");
sval, opt->vsync ? "true" : "false"); goto err;
} }
lcfg_lookup_bool(&cfg, "vsync", &opt->vsync); lcfg_lookup_bool(&cfg, "vsync", &opt->vsync);
// --backend // --backend
@@ -492,7 +481,9 @@ char *parse_config_libconfig(options_t *opt, const char *config_file, bool *shad
opt->logpath = strdup(sval); opt->logpath = strdup(sval);
} }
// --sw-opti // --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 // --use-ewmh-active-win
lcfg_lookup_bool(&cfg, "use-ewmh-active-win", &opt->use_ewmh_active_win); lcfg_lookup_bool(&cfg, "use-ewmh-active-win", &opt->use_ewmh_active_win);
// --unredir-if-possible // --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)) { if (config_lookup_string(&cfg, "glx-swap-method", &sval)) {
char *endptr; char *endptr;
long val = strtol(sval, &endptr, 10); long val = strtol(sval, &endptr, 10);
bool should_remove = true;
if (*endptr || !(*sval)) { if (*endptr || !(*sval)) {
// sval is not a number, or an empty string // sval is not a number, or an empty string
val = -1; 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 (strcmp(sval, "undefined") != 0 && val != 0) {
// If not undefined, we will use damage and buffer-age to limit // If not undefined, we will use damage and buffer-age to limit
// the rendering area. // the rendering area.
opt->use_damage = true; should_remove = false;
} }
log_warn("glx-swap-method has been deprecated since v6, your setting " log_error("glx-swap-method has been removed, your setting "
"\"%s\" should be %s.", "\"%s\" should be %s.",
sval, sval,
opt->use_damage ? "replaced by `use-damage = true`" : "removed"); !should_remove ? "replaced by `use-damage = true`" : "removed");
goto err;
} }
// --use-damage // --use-damage
lcfg_lookup_bool(&cfg, "use-damage", &opt->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 // --glx-use-gpushader4
if (config_lookup_bool(&cfg, "glx-use-gpushader4", &ival) && ival) { if (config_lookup_bool(&cfg, "glx-use-gpushader4", &ival)) {
log_warn("glx-use-gpushader4 is deprecated since v6, please remove it " log_error("glx-use-gpushader4 has been removed, please remove it "
"from" "from your config file");
"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.");
goto err; goto err;
} }
// --xrender-sync-fence // --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)) if (lcfg_lookup_bool(&cfg, "clear-shadow", &bval))
log_warn("\"clear-shadow\" is removed as an option, and is always" log_warn("\"clear-shadow\" is removed as an option, and is always"
" enabled now. Consider removing it from your config file"); " 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"); config_setting_t *blur_cfg = config_lookup(&cfg, "blur");
if (blur_cfg) { 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(stoppaint_force, cdbus_reply_enum);
cdbus_m_opts_get_do(logpath, cdbus_reply_string); cdbus_m_opts_get_do(logpath, cdbus_reply_string);
cdbus_m_opts_get_do(refresh_rate, cdbus_reply_int32); cdbus_m_opts_get_stub(refresh_rate, cdbus_reply_int32, 0);
cdbus_m_opts_get_do(sw_opti, cdbus_reply_bool); cdbus_m_opts_get_stub(sw_opti, cdbus_reply_bool, false);
cdbus_m_opts_get_do(vsync, cdbus_reply_bool); cdbus_m_opts_get_do(vsync, cdbus_reply_bool);
if (!strcmp("backend", target)) { if (!strcmp("backend", target)) {
assert(ps->o.backend < sizeof(BACKEND_STRS) / sizeof(BACKEND_STRS[0])); 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" " managers not passing _NET_WM_WINDOW_OPACITY of client windows to frame\n"
" windows.\n" " windows.\n"
"\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" "--vsync\n"
" Enable VSync\n" " Enable VSync\n"
"\n" "\n"
"--paint-on-overlay\n"
" Painting on X Composite overlay window.\n"
"\n"
"--use-ewmh-active-win\n" "--use-ewmh-active-win\n"
" Use _NET_WM_ACTIVE_WINDOW on the root window to determine which\n" " Use _NET_WM_ACTIVE_WINDOW on the root window to determine which\n"
" window is focused instead of using FocusIn/Out events.\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 #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[] = { static const struct option longopts[] = {
{"help", no_argument, NULL, 'h'}, {"help", no_argument, NULL, 'h'},
{"config", required_argument, NULL, 256}, {"config", required_argument, NULL, 256},
@@ -372,13 +365,11 @@ static const struct option longopts[] = {
{"fade-delta", required_argument, NULL, 'D'}, {"fade-delta", required_argument, NULL, 'D'},
{"menu-opacity", required_argument, NULL, 'm'}, {"menu-opacity", required_argument, NULL, 'm'},
{"shadow", no_argument, NULL, 'c'}, {"shadow", no_argument, NULL, 'c'},
{"no-dock-shadow", no_argument, NULL, 'C'},
{"clear-shadow", no_argument, NULL, 'z'}, {"clear-shadow", no_argument, NULL, 'z'},
{"fading", no_argument, NULL, 'f'}, {"fading", no_argument, NULL, 'f'},
{"inactive-opacity", required_argument, NULL, 'i'}, {"inactive-opacity", required_argument, NULL, 'i'},
{"frame-opacity", required_argument, NULL, 'e'}, {"frame-opacity", required_argument, NULL, 'e'},
{"daemon", no_argument, NULL, 'b'}, {"daemon", no_argument, NULL, 'b'},
{"no-dnd-shadow", no_argument, NULL, 'G'},
{"shadow-red", required_argument, NULL, 257}, {"shadow-red", required_argument, NULL, 257},
{"shadow-green", required_argument, NULL, 258}, {"shadow-green", required_argument, NULL, 258},
{"shadow-blue", required_argument, NULL, 259}, {"shadow-blue", required_argument, NULL, 259},
@@ -393,9 +384,6 @@ static const struct option longopts[] = {
{"detect-client-opacity", no_argument, NULL, 268}, {"detect-client-opacity", no_argument, NULL, 268},
{"refresh-rate", required_argument, NULL, 269}, {"refresh-rate", required_argument, NULL, 269},
{"vsync", optional_argument, NULL, 270}, {"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}, {"sw-opti", no_argument, NULL, 274},
{"vsync-aggressive", no_argument, NULL, 275}, {"vsync-aggressive", no_argument, NULL, 275},
{"use-ewmh-active-win", no_argument, NULL, 276}, {"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}, {"unredir-if-possible-delay", required_argument, NULL, 309},
{"write-pid-path", required_argument, NULL, 310}, {"write-pid-path", required_argument, NULL, 310},
{"vsync-use-glfinish", no_argument, NULL, 311}, {"vsync-use-glfinish", no_argument, NULL, 311},
{"xrender-sync", no_argument, NULL, 312},
{"xrender-sync-fence", no_argument, NULL, 313}, {"xrender-sync-fence", no_argument, NULL, 313},
{"show-all-xerrors", no_argument, NULL, 314}, {"show-all-xerrors", no_argument, NULL, 314},
{"no-fading-destroyed-argb", no_argument, NULL, 315}, {"no-fading-destroyed-argb", no_argument, NULL, 315},
@@ -440,7 +427,6 @@ static const struct option longopts[] = {
{"glx-fshader-win", required_argument, NULL, 317}, {"glx-fshader-win", required_argument, NULL, 317},
{"version", no_argument, NULL, 318}, {"version", no_argument, NULL, 318},
{"no-x-selection", no_argument, NULL, 319}, {"no-x-selection", no_argument, NULL, 319},
{"no-name-pixmap", no_argument, NULL, 320},
{"log-level", required_argument, NULL, 321}, {"log-level", required_argument, NULL, 321},
{"log-file", required_argument, NULL, 322}, {"log-file", required_argument, NULL, 322},
{"use-damage", no_argument, NULL, 323}, {"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') { } else if (o == 'b') {
*fork = true; *fork = true;
} else if (o == 'd') {
log_error("-d is removed, please use the DISPLAY "
"environment variable");
goto err;
} else if (o == 314) { } else if (o == 314) {
*all_xerrors = true; *all_xerrors = true;
} else if (o == 318) { } else if (o == 318) {
printf("%s\n", COMPTON_VERSION); printf("%s\n", COMPTON_VERSION);
return true; 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 == ':') { } else if (o == '?' || o == ':') {
usage(argv[0], 1); usage(argv[0], 1);
goto err; goto err;
@@ -570,9 +546,7 @@ bool get_cfg(options_t *opt, int argc, char *const *argv, bool shadow_enable,
// so assert(false) here // so assert(false) here
assert(false); assert(false);
break; break;
case 'd':
case 'b': case 'b':
case 'S':
case 314: case 314:
case 320: case 320:
// These options are handled by get_early_config() // 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 'I': opt->fade_in_step = normalize_d(atof(optarg)); break;
case 'O': opt->fade_out_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': 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':; 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; double tmp;
tmp = normalize_d(atof(optarg)); tmp = normalize_d(atof(optarg));
winopt_mask[WINTYPE_DROPDOWN_MENU].opacity = true; 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(266, shadow_ignore_shaped);
P_CASEBOOL(267, detect_rounded_corners); P_CASEBOOL(267, detect_rounded_corners);
P_CASEBOOL(268, detect_client_opacity); 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: case 270:
if (optarg) { if (optarg) {
opt->vsync = parse_vsync(optarg); bool parsed_vsync = parse_vsync(optarg);
log_warn("--vsync doesn't take argument anymore. \"%s\" " log_error("--vsync doesn't take argument anymore. \"%s\" "
"is interpreted as \"%s\" for compatibility, but " "should be changed to \"%s\"",
"this will stop working soon", optarg, parsed_vsync ? "true" : "false");
optarg, opt->vsync ? "true" : "false"); failed = true;
} else { } else {
opt->vsync = true; opt->vsync = true;
} }
break; break;
case 271: case 274:
// --alpha-step log_warn("--sw-opti has been deprecated, please remove it from the "
log_error("--alpha-step has been removed, we now tries to " "command line options");
"make use of all alpha values"); break;
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 275: case 275:
// --vsync-aggressive // --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"); " from the command line options");
failed = true;
break; break;
P_CASEBOOL(276, use_ewmh_active_win); P_CASEBOOL(276, use_ewmh_active_win);
case 277: 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 (strcmp(optarg, "undefined") != 0 && tmpval != 0) {
// If not undefined, we will use damage and buffer-age to // If not undefined, we will use damage and buffer-age to
// limit the rendering area. // limit the rendering area.
opt->use_damage = true;
should_remove = false; 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.", "\"%s\" should be %s.",
optarg, optarg,
!should_remove ? "replaced by `--use-damage`" : !should_remove ? "replaced by `--use-damage`" :
"removed"); "removed");
failed = true;
break; break;
} }
case 300: 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); P_CASEINT(302, resize_damage);
case 303: case 303:
// --glx-use-gpushader4 // --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."); " Please remove it from command line options.");
failed = true;
break; break;
case 304: case 304:
// --opacity-rule // --opacity-rule
@@ -821,10 +786,6 @@ bool get_cfg(options_t *opt, int argc, char *const *argv, bool shadow_enable,
} }
break; break;
P_CASEBOOL(311, vsync_use_glfinish); 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(313, xrender_sync_fence);
P_CASEBOOL(315, no_fading_destroyed_argb); P_CASEBOOL(315, no_fading_destroyed_argb);
P_CASEBOOL(316, force_win_blend); 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->inactive_dim = normalize_d(opt->inactive_dim);
opt->frame_opacity = normalize_d(opt->frame_opacity); opt->frame_opacity = normalize_d(opt->frame_opacity);
opt->shadow_opacity = normalize_d(opt->shadow_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); opt->max_brightness = normalize_d(opt->max_brightness);
if (opt->max_brightness < 1.0) { if (opt->max_brightness < 1.0) {

View File

@@ -69,8 +69,6 @@
(session_t *)((char *)__mptr - offsetof(session_t, member)); \ (session_t *)((char *)__mptr - offsetof(session_t, member)); \
}) })
static const long SWOPTI_TOLERANCE = 3000;
static bool must_use redirect_start(session_t *ps); static bool must_use redirect_start(session_t *ps);
static void unredirect(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) { if (ps->o.xinerama_shadow_crop) {
cxinerama_upd_scrs(ps); 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; ps->root_flags &= ~(uint64_t)ROOT_FLAGS_SCREEN_CHANGE;
} }
@@ -1098,77 +1088,6 @@ static inline bool write_pid(session_t *ps) {
return true; 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. * 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) { 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); session_t *ps = session_ptr(w, draw_idle);
draw_callback_impl(EV_A_ ps, revents); 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) { static void x_event_callback(EV_P attr_unused, ev_io *w, int revents attr_unused) {
session_t *ps = (session_t *)w; session_t *ps = (session_t *)w;
xcb_generic_event_t *ev = xcb_poll_for_event(ps->c); 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, .white_picture = XCB_NONE,
.gaussian_map = NULL, .gaussian_map = NULL,
.refresh_rate = 0,
.refresh_intv = 0UL,
.paint_tm_offset = 0L,
#ifdef CONFIG_VSYNC_DRM #ifdef CONFIG_VSYNC_DRM
.drm_fd = -1, .drm_fd = -1,
#endif #endif
@@ -2007,11 +1881,10 @@ static session_t *session_init(int argc, char **argv, Display *dpy,
} }
// Query X RandR // 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) { if (!ps->randr_exists) {
log_fatal("No XRandR extension. sw-opti, refresh-rate or " log_fatal("No XRandR extension. xinerama-shadow-crop cannot be "
"xinerama-shadow-crop " "enabled.");
"cannot be enabled.");
goto err; 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 // Monitor screen changes if vsync_sw is enabled and we are using
// an auto-detected refresh rate, or when Xinerama features are enabled // an auto-detected refresh rate, or when Xinerama features are enabled
if (ps->randr_exists && if (ps->randr_exists && ps->o.xinerama_shadow_crop) {
((ps->o.sw_opti && !ps->o.refresh_rate) || ps->o.xinerama_shadow_crop))
xcb_randr_select_input(ps->c, ps->root, XCB_RANDR_NOTIFY_MASK_SCREEN_CHANGE); xcb_randr_select_input(ps->c, ps->root, XCB_RANDR_NOTIFY_MASK_SCREEN_CHANGE);
}
cxinerama_upd_scrs(ps); 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_init(&ps->xiow, x_event_callback, ConnectionNumber(ps->dpy), EV_READ);
ev_io_start(ps->loop, &ps->xiow); ev_io_start(ps->loop, &ps->xiow);
ev_init(&ps->unredir_timer, tmout_unredir_callback); ev_init(&ps->unredir_timer, tmout_unredir_callback);
if (ps->o.sw_opti) ev_idle_init(&ps->draw_idle, draw_callback);
ev_idle_init(&ps->draw_idle, delayed_draw_callback);
else
ev_idle_init(&ps->draw_idle, draw_callback);
ev_init(&ps->fade_timer, fade_timer_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 // Set up SIGUSR1 signal handler to reset program
ev_signal_init(&ps->usr1_signal, reset_enable, SIGUSR1); ev_signal_init(&ps->usr1_signal, reset_enable, SIGUSR1);
@@ -2436,9 +2301,6 @@ static void session_destroy(session_t *ps) {
* @param ps current session * @param ps current session
*/ */
static void session_run(session_t *ps) { 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 // In benchmark mode, we want draw_idle handler to always be active
if (ps->o.benchmark) { if (ps->o.benchmark) {
ev_idle_start(ps->loop, &ps->draw_idle); 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 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 root_damaged(session_t *ps);
void cxinerama_upd_scrs(session_t *ps); void cxinerama_upd_scrs(session_t *ps);