From 5d692b05811f939024fbf92c2e6eb7e66e0790dc Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Mon, 2 Mar 2020 15:30:50 +0100 Subject: Add an adaptive_sync output command This enables/disables adaptive synchronization on the output. For now, the default is disabled because it might cause flickering on some hardware if clients don't submit frames at regular enough intervals. In the future an "auto" option will only enable adaptive sync if a fullscreen client opts-in via a Wayland protocol. --- sway/config/output.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'sway/config') diff --git a/sway/config/output.c b/sway/config/output.c index 40f86b6e..cbcf713b 100644 --- a/sway/config/output.c +++ b/sway/config/output.c @@ -64,6 +64,7 @@ struct output_config *new_output_config(const char *name) { oc->transform = -1; oc->subpixel = WL_OUTPUT_SUBPIXEL_UNKNOWN; oc->max_render_time = -1; + oc->adaptive_sync = -1; return oc; } @@ -104,6 +105,9 @@ void merge_output_config(struct output_config *dst, struct output_config *src) { if (src->max_render_time != -1) { dst->max_render_time = src->max_render_time; } + if (src->adaptive_sync != -1) { + dst->adaptive_sync = src->adaptive_sync; + } if (src->background) { free(dst->background); dst->background = strdup(src->background); @@ -390,6 +394,10 @@ bool apply_output_config(struct output_config *oc, struct sway_output *output) { wlr_output_set_scale(wlr_output, scale); } + if (oc && oc->adaptive_sync != -1) { + wlr_output_enable_adaptive_sync(wlr_output, oc->adaptive_sync == 1); + } + sway_log(SWAY_DEBUG, "Committing output %s", wlr_output->name); if (!wlr_output_commit(wlr_output)) { // Failed to modeset, maybe the output is missing a CRTC. Leave the -- cgit v1.2.3