diff options
author | Simon Ser <contact@emersion.fr> | 2020-03-02 15:30:50 +0100 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2020-03-07 00:32:04 +0100 |
commit | 5d692b05811f939024fbf92c2e6eb7e66e0790dc (patch) | |
tree | adc2973635c6a189e10d444da6d42337131afcf9 /sway/config | |
parent | 9d0aa0cb839624265c366281922a58708a9bcb9a (diff) |
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.
Diffstat (limited to 'sway/config')
-rw-r--r-- | sway/config/output.c | 8 |
1 files changed, 8 insertions, 0 deletions
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 |