From 6a69cdb002dc6943fd228d73f8b952681b2894b9 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Sat, 10 Jun 2023 14:28:43 +0100 Subject: [PATCH] options: add a no-frame-pacing option Signed-off-by: Yuxuan Shui --- man/picom.1.asciidoc | 3 +++ src/config.c | 1 + src/config.h | 2 ++ src/config_libconfig.c | 3 +++ src/options.c | 2 ++ src/picom.c | 6 +++--- 6 files changed, 14 insertions(+), 3 deletions(-) diff --git a/man/picom.1.asciidoc b/man/picom.1.asciidoc index 0a2e3c31..1ccf0933 100644 --- a/man/picom.1.asciidoc +++ b/man/picom.1.asciidoc @@ -109,6 +109,9 @@ OPTIONS *--rounded-corners-exclude* 'CONDITION':: Exclude conditions for rounded corners. +*--no-frame-pacing*:: + Disable vsync-aware frame pacing. By default, the compositor tries to make sure it only renders once per vblank interval, and also the render happens as late as possible to minimize the latency from updates to the screen. However this can sometimes cause stuttering, or even lowered frame rate. This option can be used to disable frame pacing. + *--mark-wmwin-focused*:: Try to detect WM windows (a non-override-redirect window with no child that has 'WM_STATE') and mark them as active. diff --git a/src/config.c b/src/config.c index 1013d128..3797ffa4 100644 --- a/src/config.c +++ b/src/config.c @@ -742,6 +742,7 @@ char *parse_config(options_t *opt, const char *config_file, bool *shadow_enable, .logpath = NULL, .use_damage = true, + .no_frame_pacing = false, .shadow_red = 0.0, .shadow_green = 0.0, diff --git a/src/config.h b/src/config.h index 5ce3ba96..31e6774c 100644 --- a/src/config.h +++ b/src/config.h @@ -140,6 +140,8 @@ typedef struct options { bool vsync_use_glfinish; /// Whether use damage information to help limit the area to paint bool use_damage; + /// Disable frame pacing + bool no_frame_pacing; // === Shadow === /// Red, green and blue tone of the shadow. diff --git a/src/config_libconfig.c b/src/config_libconfig.c index 63f05412..40bc47b8 100644 --- a/src/config_libconfig.c +++ b/src/config_libconfig.c @@ -363,6 +363,9 @@ char *parse_config_libconfig(options_t *opt, const char *config_file, bool *shad // --corner-radius-rules parse_cfg_condlst_corner(opt, &cfg, "corner-radius-rules"); + // --no-frame-pacing + lcfg_lookup_bool(&cfg, "no-frame-pacing", &opt->no_frame_pacing); + // -e (frame_opacity) config_lookup_float(&cfg, "frame-opacity", &opt->frame_opacity); // -c (shadow_enable) diff --git a/src/options.c b/src/options.c index 9d500b8e..b0d956a2 100644 --- a/src/options.c +++ b/src/options.c @@ -176,6 +176,7 @@ static const struct picom_option picom_options[] = { "rendered screen. Reduces banding artifacts, but might cause performance " "degradation. Only works with OpenGL."}, // 340 is corner-radius-rules + {"no-frame-pacing" , no_argument , 341, NULL , "Disable frame pacing. This might increase the latency."}, {"legacy-backends" , no_argument , 733, NULL , "Use deprecated version of the backends."}, {"monitor-repaint" , no_argument , 800, NULL , "Highlight the updated area of the screen. For debugging."}, {"diagnostics" , no_argument , 801, NULL , "Print diagnostic information"}, @@ -738,6 +739,7 @@ bool get_cfg(options_t *opt, int argc, char *const *argv, bool shadow_enable, // --dithered-present opt->dithered_present = true; break; + P_CASEBOOL(341, no_frame_pacing); P_CASEBOOL(733, legacy_backends); P_CASEBOOL(800, monitor_repaint); case 801: diff --git a/src/picom.c b/src/picom.c index d6b52b58..fb7e49e2 100644 --- a/src/picom.c +++ b/src/picom.c @@ -1445,9 +1445,9 @@ static bool redirect_start(session_t *ps) { pixman_region32_init(&ps->damage_ring[i]); } - ps->frame_pacing = true; - if (ps->o.legacy_backends || ps->o.benchmark || - !ps->backend_data->ops->last_render_time) { + ps->frame_pacing = !ps->o.no_frame_pacing; + if ((ps->o.legacy_backends || ps->o.benchmark || !ps->backend_data->ops->last_render_time) && + ps->frame_pacing) { // Disable frame pacing if we are using a legacy backend or if we are in // benchmark mode, or if the backend doesn't report render time log_info("Disabling frame pacing.");