Skip to content

Commit

Permalink
options: add a no-frame-pacing option
Browse files Browse the repository at this point in the history
  • Loading branch information
yshui committed Jun 10, 2023
1 parent f480409 commit d72e80f
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 3 deletions.
3 changes: 3 additions & 0 deletions man/picom.1.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
1 change: 1 addition & 0 deletions src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 3 additions & 0 deletions src/config_libconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions src/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand Down Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions src/picom.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
Expand Down

0 comments on commit d72e80f

Please sign in to comment.