aboutsummaryrefslogtreecommitdiffstats
path: root/sway/config
diff options
context:
space:
mode:
authorLibravatar Simon Ser <contact@emersion.fr>2020-03-02 15:30:50 +0100
committerLibravatar Drew DeVault <sir@cmpwn.com>2020-03-07 00:32:04 +0100
commit5d692b05811f939024fbf92c2e6eb7e66e0790dc (patch)
treeadc2973635c6a189e10d444da6d42337131afcf9 /sway/config
parentUse wlr_client_buffer (diff)
downloadsway-5d692b05811f939024fbf92c2e6eb7e66e0790dc.tar.gz
sway-5d692b05811f939024fbf92c2e6eb7e66e0790dc.tar.zst
sway-5d692b05811f939024fbf92c2e6eb7e66e0790dc.zip
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.c8
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) {
64 oc->transform = -1; 64 oc->transform = -1;
65 oc->subpixel = WL_OUTPUT_SUBPIXEL_UNKNOWN; 65 oc->subpixel = WL_OUTPUT_SUBPIXEL_UNKNOWN;
66 oc->max_render_time = -1; 66 oc->max_render_time = -1;
67 oc->adaptive_sync = -1;
67 return oc; 68 return oc;
68} 69}
69 70
@@ -104,6 +105,9 @@ void merge_output_config(struct output_config *dst, struct output_config *src) {
104 if (src->max_render_time != -1) { 105 if (src->max_render_time != -1) {
105 dst->max_render_time = src->max_render_time; 106 dst->max_render_time = src->max_render_time;
106 } 107 }
108 if (src->adaptive_sync != -1) {
109 dst->adaptive_sync = src->adaptive_sync;
110 }
107 if (src->background) { 111 if (src->background) {
108 free(dst->background); 112 free(dst->background);
109 dst->background = strdup(src->background); 113 dst->background = strdup(src->background);
@@ -390,6 +394,10 @@ bool apply_output_config(struct output_config *oc, struct sway_output *output) {
390 wlr_output_set_scale(wlr_output, scale); 394 wlr_output_set_scale(wlr_output, scale);
391 } 395 }
392 396
397 if (oc && oc->adaptive_sync != -1) {
398 wlr_output_enable_adaptive_sync(wlr_output, oc->adaptive_sync == 1);
399 }
400
393 sway_log(SWAY_DEBUG, "Committing output %s", wlr_output->name); 401 sway_log(SWAY_DEBUG, "Committing output %s", wlr_output->name);
394 if (!wlr_output_commit(wlr_output)) { 402 if (!wlr_output_commit(wlr_output)) {
395 // Failed to modeset, maybe the output is missing a CRTC. Leave the 403 // Failed to modeset, maybe the output is missing a CRTC. Leave the