From 7e607bfe81378ac3f07f6e448fd9803f48fddc01 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Sun, 21 Aug 2022 06:00:43 +0100 Subject: [PATCH] Make experimental backends the new default Experimental no longer. Signed-off-by: Yuxuan Shui --- .circleci/config.yml | 2 +- README.md | 14 ------------- man/picom.1.asciidoc | 16 +++++++-------- src/config.c | 1 + src/config.h | 4 ++-- src/options.c | 48 +++++++++++++++++++++---------------------- src/picom.c | 24 +++++++++++----------- src/win.c | 4 ++-- tests/run_one_test.sh | 2 +- 9 files changed, 50 insertions(+), 65 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 90812c82..bed676bf 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -54,7 +54,7 @@ jobs: command: ninja -vC build test - run: name: test config file parsing - command: xvfb-run -s "-screen 0 640x480x24" build/src/picom --experimental-backends --config tests/configs/parsing_test.conf --no-vsync --diagnostics + command: xvfb-run -s "-screen 0 640x480x24" build/src/picom --config tests/configs/parsing_test.conf --no-vsync --diagnostics - run: name: run testsuite command: tests/run_tests.sh build/src/picom diff --git a/README.md b/README.md index 98634bd1..85dab207 100644 --- a/README.md +++ b/README.md @@ -7,20 +7,6 @@ __picom__ is a compositor for X, and a [fork of Compton](History.md). You can leave your feedback or thoughts in the [discussion tab](https://github.com/yshui/picom/discussions). -## Call for testers - -### `--experimental-backends` - -This flag enables the refactored/partially rewritten backends. - -Currently, new backends feature better vsync with the xrender backend and improved input lag with the glx backend (for non-NVIDIA users). The performance should be on par with the old backends. - -New backend features will only be implemented on the new backends from now on, and the old backends will eventually be phased out after the new backends stabilize. - -To test the new backends, add the `--experimental-backends` flag to the command you use to run picom. This flag is not available from the configuration file. - -To report issues with the new backends, please state explicitly you are using the new backends in your report. - ## Change Log See [Releases](https://github.com/yshui/picom/releases) diff --git a/man/picom.1.asciidoc b/man/picom.1.asciidoc index 6c1f4109..e9011547 100644 --- a/man/picom.1.asciidoc +++ b/man/picom.1.asciidoc @@ -67,8 +67,8 @@ OPTIONS *--log-file*:: Set the log file. If *--log-file* is never specified, logs will be written to stderr. Otherwise, logs will to written to the given file, though some of the early logs might still be written to the stderr. When setting this option from the config file, it is recommended to use an absolute path. -*--experimental-backends*:: - Use the new, reimplemented version of the backends. The new backends are HIGHLY UNSTABLE at this point, you have been warned. This option is not available in the config file. +*--legacy-backends*:: + Use the old version of the backends. This option can not be set from the config file. *--show-all-xerrors*:: Show all X errors (for debugging). @@ -194,7 +194,7 @@ A 7x7 Gaussian blur kernel (sigma = 0.84089642) looks like: --blur-kern '7,7,0.000003,0.000102,0.000849,0.001723,0.000849,0.000102,0.000003,0.000102,0.003494,0.029143,0.059106,0.029143,0.003494,0.000102,0.000849,0.029143,0.243117,0.493069,0.243117,0.029143,0.000849,0.001723,0.059106,0.493069,0.493069,0.059106,0.001723,0.000849,0.029143,0.243117,0.493069,0.243117,0.029143,0.000849,0.000102,0.003494,0.029143,0.059106,0.029143,0.003494,0.000102,0.000003,0.000102,0.000849,0.001723,0.000849,0.000102,0.000003' ---- + -May also be one of the predefined kernels: `3x3box` (default), `5x5box`, `7x7box`, `3x3gaussian`, `5x5gaussian`, `7x7gaussian`, `9x9gaussian`, `11x11gaussian`. All Gaussian kernels are generated with sigma = 0.84089642 . If you find yourself needing to generate custom blur kernels, you might want to try the new blur configuration supported by the experimental backends (See *BLUR* and *--experimental-backends*). +May also be one of the predefined kernels: `3x3box` (default), `5x5box`, `7x7box`, `3x3gaussian`, `5x5gaussian`, `7x7gaussian`, `9x9gaussian`, `11x11gaussian`. All Gaussian kernels are generated with sigma = 0.84089642 . If you find yourself needing to generate custom blur kernels, you might want to try the new blur configuration (See *BLUR*). *--blur-background-exclude* 'CONDITION':: Exclude conditions for background blur. @@ -236,7 +236,7 @@ May also be one of the predefined kernels: `3x3box` (default), `5x5box`, `7x7box Use X Sync fence to sync clients' draw calls, to make sure all draw calls are finished before picom starts drawing. Needed on nvidia-drivers with GLX backend for some users. *--glx-fshader-win* 'SHADER':: - GLX backend: Use specified GLSL fragment shader for rendering window contents. See `compton-default-fshader-win.glsl` and `compton-fake-transparency-fshader-win.glsl` in the source tree for examples. Doesn't work with *--experimental-backends* enabled. + GLX backend: Use specified GLSL fragment shader for rendering window contents. See `compton-default-fshader-win.glsl` and `compton-fake-transparency-fshader-win.glsl` in the source tree for examples. Only works with *--legacy-backends* enabled. *--force-win-blend*:: Force all windows to be painted with blending. Useful if you have a *--glx-fshader-win* that could turn opaque pixels transparent. @@ -260,10 +260,10 @@ May also be one of the predefined kernels: `3x3box` (default), `5x5box`, `7x7box Make transparent windows clip other windows like non-transparent windows do, instead of blending on top of them. *--window-shader-fg* 'SHADER':: - Specify GLSL fragment shader path for rendering window contents. Only works when *--experimental-backends* is enabled. Shader is searched first relative to the directory the configuration file is in, then in the usual places for a configuration file. See section *SHADER INTERFACE* below for more details on the interface. + Specify GLSL fragment shader path for rendering window contents. Does not work when *--legacy-backends* is enabled. Shader is searched first relative to the directory the configuration file is in, then in the usual places for a configuration file. See section *SHADER INTERFACE* below for more details on the interface. *--window-shader-fg-rule* 'SHADER':'CONDITION':: - Specify GLSL fragment shader path for rendering window contents using patterns. Similar to *--opacity-rule*, arguments should be in the format of 'SHADER:CONDITION', e.g. "shader.frag:name = \'window\'". Leading and trailing whitespaces in 'SHADER' will be trimmed. If 'SHADER' is "default", then the default shader will be used for the matching windows. (This also unfortunately means you can't use a shader file named "default"). Only works when *--experimental-backends* is enabled. + Specify GLSL fragment shader path for rendering window contents using patterns. Similar to *--opacity-rule*, arguments should be in the format of 'SHADER:CONDITION', e.g. "shader.frag:name = \'window\'". Leading and trailing whitespaces in 'SHADER' will be trimmed. If 'SHADER' is "default", then the default shader will be used for the matching windows. (This also unfortunately means you can't use a shader file named "default"). Does not work when *--legacy-backends* is enabled. FORMAT OF CONDITIONS -------------------- @@ -355,7 +355,7 @@ This is the old condition format we once used. Support of this format might be r SHADER INTERFACE ---------------- -This secion describes the interface of a custom shader, how it is used by picom, and what parameters are passed by picom to the shader. This only applies to the new, experimental backends. +This secion describes the interface of a custom shader, how it is used by picom, and what parameters are passed by picom to the shader. This does not apply to the legacy backends. A custom shader is a GLSL fragment shader program, which can be used to override the default way of how a window is rendered. If a custom shader is used, the default picom effects (e.g. dimming, color inversion, etc.) will no longer be automatically applied. It would be the custom shader's responsibility to apply these effects. @@ -465,7 +465,7 @@ Available options of the 'blur' section are: :: *method*::: A string. Controls the blur method. Corresponds to the *--blur-method* command line option. Available choices are: 'none' to disable blurring; 'gaussian' for gaussian blur; 'box' for box blur; 'kernel' for convolution blur with a custom kernel; 'dual_kawase' for dual-filter kawase blur. - Note: 'gaussian', 'box' and 'dual_kawase' blur methods are only supported by the experimental backends. + Note: 'gaussian', 'box' and 'dual_kawase' blur methods are not supported by the legacy backends. (default: none) *size*::: diff --git a/src/config.c b/src/config.c index 045fa74c..d9b2dd91 100644 --- a/src/config.c +++ b/src/config.c @@ -720,6 +720,7 @@ char *parse_config(options_t *opt, const char *config_file, bool *shadow_enable, // clang-format off *opt = (struct options){ .backend = BKEND_XRENDER, + .legacy_backends = false, .glx_no_stencil = false, .mark_wmwin_focused = false, .mark_ovredir_focused = false, diff --git a/src/config.h b/src/config.h index 51f4f593..93ae09e2 100644 --- a/src/config.h +++ b/src/config.h @@ -80,8 +80,8 @@ typedef struct options { /// Render to a separate window instead of taking over the screen bool debug_mode; // === General === - /// Use the experimental new backends? - bool experimental_backends; + /// Use the legacy backends? + bool legacy_backends; /// Path to write PID to. char *write_pid_path; /// The backend in use. diff --git a/src/options.c b/src/options.c index 58b21d53..451bcf95 100644 --- a/src/options.c +++ b/src/options.c @@ -206,7 +206,7 @@ static void usage(const char *argv0, int ret) { " The algorithm used for background bluring. Available choices are:\n" " 'none' to disable, 'gaussian', 'box' or 'kernel' for custom\n" " convolution blur with --blur-kern.\n" - " Note: 'gaussian' and 'box' require --experimental-backends.\n" + " Note: 'gaussian' and 'box' is not supported by --legacy-backends.\n" "\n" "--blur-size\n" " The radius of the blur kernel for 'box' and 'gaussian' blur method.\n" @@ -349,15 +349,15 @@ static void usage(const char *argv0, int ret) { " do, instead of blending on top of them\n" "\n" "--window-shader-fg shader\n" - " Specify GLSL fragment shader path for rendering window contents. Only\n" - " works when `--experimental-backends` is enabled.\n" + " Specify GLSL fragment shader path for rendering window contents. Does\n" + " not work when `--legacy-backends` is enabled.\n" "\n" "--window-shader-fg-rule shader:condition\n" " Specify GLSL fragment shader path for rendering window contents using\n" " patterns. Pattern should be in the format of `SHADER_PATH:PATTERN`,\n" " similar to `--opacity-rule`. `SHADER_PATH` can be \"default\", in which\n" - " case the default shader will be used. Only works when\n" - " `--experimental-backends` is enabled.\n"; + " case the default shader will be used. Does not work when\n" + " `--legacy-backends` is enabled.\n"; FILE *f = (ret ? stderr : stdout); fprintf(f, usage_text, argv0); #undef WARNING_DISABLED @@ -455,7 +455,7 @@ static const struct option longopts[] = { {"clip-shadow-above", required_argument, NULL, 335}, {"window-shader-fg", required_argument, NULL, 336}, {"window-shader-fg-rule", required_argument, NULL, 337}, - {"experimental-backends", no_argument, NULL, 733}, + {"legacy-backends", no_argument, NULL, 733}, {"monitor-repaint", no_argument, NULL, 800}, {"diagnostics", no_argument, NULL, 801}, {"debug-mode", no_argument, NULL, 802}, @@ -874,7 +874,7 @@ bool get_cfg(options_t *opt, int argc, char *const *argv, bool shadow_enable, // --clip-shadow-above condlst_add(&opt->shadow_clip_list, optarg); break; - P_CASEBOOL(733, experimental_backends); + P_CASEBOOL(733, legacy_backends); P_CASEBOOL(800, monitor_repaint); case 801: opt->print_diagnostics = true; @@ -900,38 +900,37 @@ bool get_cfg(options_t *opt, int argc, char *const *argv, bool shadow_enable, return false; } - if (opt->monitor_repaint && opt->backend != BKEND_XRENDER && - !opt->experimental_backends) { + if (opt->monitor_repaint && opt->backend != BKEND_XRENDER && opt->legacy_backends) { log_warn("--monitor-repaint has no effect when backend is not xrender"); } - if (opt->experimental_backends && !backend_list[opt->backend]) { - log_error("Backend \"%s\" is not available as part of the experimental " + if (!opt->legacy_backends && !backend_list[opt->backend]) { + log_error("Backend \"%s\" is only available as part of the legacy " "backends.", BACKEND_STRS[opt->backend]); return false; } - if (opt->debug_mode && !opt->experimental_backends) { - log_error("Debug mode only works with the experimental backends."); + if (opt->debug_mode && opt->legacy_backends) { + log_error("Debug mode does not work with the legacy backends."); return false; } - if (opt->transparent_clipping && !opt->experimental_backends) { - log_error("Transparent clipping only works with the experimental " + if (opt->transparent_clipping && opt->legacy_backends) { + log_error("Transparent clipping does not work with the legacy " "backends"); return false; } - if (opt->glx_fshader_win_str && opt->experimental_backends) { + if (opt->glx_fshader_win_str && !opt->legacy_backends) { log_warn("--glx-fshader-win has been replaced by " - "\"--window-shader-fg\" for the experimental backends."); + "\"--window-shader-fg\" for the new backends."); } if (opt->window_shader_fg || opt->window_shader_fg_rules) { - if (!opt->experimental_backends || opt->backend != BKEND_GLX) { - log_warn("The new window shader interface only works with the " - "experimental glx backend.%s", + if (opt->legacy_backends || opt->backend != BKEND_GLX) { + log_warn("The new window shader interface does not work with the " + "legacy glx backend.%s", (opt->backend == BKEND_GLX) ? " You may want to use " "\"--glx-fshader-win\" " "instead on the legacy " @@ -960,8 +959,8 @@ bool get_cfg(options_t *opt, int argc, char *const *argv, bool shadow_enable, opt->max_brightness = 1.0; } - if (!opt->experimental_backends || opt->backend != BKEND_GLX) { - log_warn("--max-brightness requires the experimental glx " + if (opt->legacy_backends || opt->backend != BKEND_GLX) { + log_warn("--max-brightness requires the new glx " "backend. Falling back to 1.0"); opt->max_brightness = 1.0; } @@ -1004,10 +1003,9 @@ bool get_cfg(options_t *opt, int argc, char *const *argv, bool shadow_enable, "capping to 20."); opt->blur_strength = 20; } - if (!opt->experimental_backends) { + if (opt->legacy_backends) { log_warn("Dual-kawase blur is not implemented by the legacy " - "backends, you must use the `experimental-backends` " - "option."); + "backends."); } } diff --git a/src/picom.c b/src/picom.c index 65728dbb..ce4f0d22 100644 --- a/src/picom.c +++ b/src/picom.c @@ -493,7 +493,7 @@ static bool initialize_blur(session_t *ps) { /// Init the backend and bind all the window pixmap to backend images static bool initialize_backend(session_t *ps) { - if (ps->o.experimental_backends) { + if (!ps->o.legacy_backends) { assert(!ps->backend_data); // Reinitialize win_data assert(backend_list[ps->o.backend]); @@ -571,7 +571,7 @@ static void configure_root(session_t *ps) { bool has_root_change = false; if (ps->redirected) { // On root window changes - if (ps->o.experimental_backends) { + if (!ps->o.legacy_backends) { assert(ps->backend_data); has_root_change = ps->backend_data->ops->root_change != NULL; } else { @@ -607,7 +607,7 @@ static void configure_root(session_t *ps) { ps->damage = ps->damage_ring + ps->ndamage - 1; #ifdef CONFIG_OPENGL // GLX root change callback - if (BKEND_GLX == ps->o.backend && !ps->o.experimental_backends) { + if (BKEND_GLX == ps->o.backend && ps->o.legacy_backends) { glx_on_root_change(ps); } #endif @@ -1220,10 +1220,10 @@ uint8_t session_redirection_mode(session_t *ps) { if (ps->o.debug_mode) { // If the backend is not rendering to the screen, we don't need to // take over the screen. - assert(ps->o.experimental_backends); + assert(!ps->o.legacy_backends); return XCB_COMPOSITE_REDIRECT_AUTOMATIC; } - if (ps->o.experimental_backends && !backend_list[ps->o.backend]->present) { + if (!ps->o.legacy_backends && !backend_list[ps->o.backend]->present) { // if the backend doesn't render anything, we don't need to take over the // screen. return XCB_COMPOSITE_REDIRECT_AUTOMATIC; @@ -1260,7 +1260,7 @@ static bool redirect_start(session_t *ps) { return false; } - if (ps->o.experimental_backends) { + if (!ps->o.legacy_backends) { assert(ps->backend_data); ps->ndamage = ps->backend_data->ops->max_buffer_age; } else { @@ -1503,7 +1503,7 @@ static void draw_callback_impl(EV_P_ session_t *ps, int revents attr_unused) { static int paint = 0; log_trace("Render start, frame %d", paint); - if (ps->o.experimental_backends) { + if (!ps->o.legacy_backends) { paint_all_new(ps, bottom, false); } else { paint_all(ps, bottom, false); @@ -2056,7 +2056,7 @@ static session_t *session_init(int argc, char **argv, Display *dpy, // The old backends doesn't have a automatic redirection mode log_info("The compositor is started in automatic redirection mode."); - assert(ps->o.experimental_backends); + assert(!ps->o.legacy_backends); if (backend_list[ps->o.backend]->present) { // If the backend has `present`, we couldn't be in automatic @@ -2072,7 +2072,7 @@ static session_t *session_init(int argc, char **argv, Display *dpy, apply_driver_workarounds(ps, ps->drivers); // Initialize filters, must be preceded by OpenGL context creation - if (!ps->o.experimental_backends && !init_render(ps)) { + if (ps->o.legacy_backends && !init_render(ps)) { log_fatal("Failed to initialize the backend"); exit(1); } @@ -2090,7 +2090,7 @@ static session_t *session_init(int argc, char **argv, Display *dpy, free(config_file_to_free); - if (bkend_use_glx(ps) && !ps->o.experimental_backends) { + if (bkend_use_glx(ps) && ps->o.legacy_backends) { auto gl_logger = gl_string_marker_logger_new(); if (gl_logger) { log_info("Enabling gl string marker"); @@ -2098,7 +2098,7 @@ static session_t *session_init(int argc, char **argv, Display *dpy, } } - if (ps->o.experimental_backends) { + if (!ps->o.legacy_backends) { if (ps->o.monitor_repaint && !backend_list[ps->o.backend]->fill) { log_warn("--monitor-repaint is not supported by the backend, " "disabling"); @@ -2391,7 +2391,7 @@ static void session_destroy(session_t *ps) { ps->damaged_region = XCB_NONE; } - if (ps->o.experimental_backends) { + if (!ps->o.legacy_backends) { // backend is deinitialized in unredirect() assert(ps->backend_data == NULL); } else { diff --git a/src/win.c b/src/win.c index 58f71a9c..f70be5d6 100644 --- a/src/win.c +++ b/src/win.c @@ -897,7 +897,7 @@ static void win_set_shadow(session_t *ps, struct managed_win *w, bool shadow_new // Mark the new extents as damaged if the shadow is added assert(!w->shadow_image || win_check_flags_all(w, WIN_FLAGS_SHADOW_STALE) || - !ps->o.experimental_backends); + ps->o.legacy_backends); pixman_region32_clear(&extents); win_extents(w, &extents); add_damage_from_win(ps, w); @@ -905,7 +905,7 @@ static void win_set_shadow(session_t *ps, struct managed_win *w, bool shadow_new // Mark the old extents as damaged if the shadow is removed assert(w->shadow_image || win_check_flags_all(w, WIN_FLAGS_SHADOW_STALE) || - !ps->o.experimental_backends); + ps->o.legacy_backends); add_damage(ps, &extents); } diff --git a/tests/run_one_test.sh b/tests/run_one_test.sh index 46193595..2b745710 100755 --- a/tests/run_one_test.sh +++ b/tests/run_one_test.sh @@ -7,7 +7,7 @@ fi echo "Running test $2" # TODO keep the log file, and parse it to see if test is successful -($1 --dbus --experimental-backends --backend dummy --log-level=debug --log-file=$PWD/log --config=$2) & +($1 --dbus --backend dummy --log-level=debug --log-file=$PWD/log --config=$2) & main_pid=$! $3