]> git.mdlowis.com Git - proto/labwc.git/commitdiff
output: test adaptive sync
authorJohan Malm <jgm323@gmail.com>
Sat, 12 Nov 2022 15:51:46 +0000 (15:51 +0000)
committerJohan Malm <johanmalm@users.noreply.github.com>
Tue, 15 Nov 2022 21:58:18 +0000 (21:58 +0000)
Required by https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3637
See also swaywm/sway@07bfeb2

Fixes #516

src/output.c

index d61518b08791ee7cf8d8e1ed9371ba3e02f88b04..0e9d898b0651e990abe8aaab86cd84800c80508f 100644 (file)
@@ -176,9 +176,17 @@ new_output_notify(struct wl_listener *listener, void *data)
        wlr_scene_node_raise_to_top(&output->layer_popup_tree->node);
 
        if (rc.adaptive_sync) {
-               wlr_log(WLR_INFO, "enable adaptive sync on %s",
-                       wlr_output->name);
-               wlr_output_enable_adaptive_sync(wlr_output, true);
+               wlr_log(WLR_INFO, "enable adaptive sync on %s", wlr_output->name);
+               struct wlr_output_state pending = { 0 };
+               wlr_output_state_set_adaptive_sync_enabled(&pending, true);
+               if (!wlr_output_test_state(wlr_output, &pending)) {
+                       wlr_log(WLR_ERROR, "adaptive sync failed, ignoring");
+                       wlr_output_state_set_adaptive_sync_enabled(&pending, false);
+               }
+               if (!wlr_output_commit_state(wlr_output, &pending)) {
+                       wlr_log(WLR_ERROR, "failed to commit output %s",
+                               wlr_output->name);
+               }
        }
 
        /*