diff options
author | 2024-07-02 00:39:21 +0200 | |
---|---|---|
committer | 2024-07-02 19:13:58 +0200 | |
commit | 4e38f93f367dfb7f1ec66060e6262b806cecf3a7 (patch) | |
tree | 8cff788c17d8f624a499823ceb57be7db1641cc0 | |
parent | desktop/output: unify page-flip codepath (diff) | |
download | sway-4e38f93f367dfb7f1ec66060e6262b806cecf3a7.tar.gz sway-4e38f93f367dfb7f1ec66060e6262b806cecf3a7.tar.zst sway-4e38f93f367dfb7f1ec66060e6262b806cecf3a7.zip |
config/output: Skip VRR tests when not supported
Adaptive sync is a "soft" setting which we degrade of off when not
supported. Some outputs types do not support turning it off (Wayland,
X11), which makes for an awkward three-way test where we first enable,
disable and finally unset the setting.
wlr_output.adaptive_sync_supported tells us whether the output
definitely does not support making changes (backend without support,
connector without the feature), or whether it might work.
Use this to avoid wasting time on adaptive sync test that can never
succeed, and to avoid the Wayland/X11-backend specific unset step.
-rw-r--r-- | sway/config/output.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/sway/config/output.c b/sway/config/output.c index 16be49c8..e64efb7f 100644 --- a/sway/config/output.c +++ b/sway/config/output.c | |||
@@ -721,21 +721,18 @@ static bool search_adaptive_sync(struct search_context *ctx, size_t output_idx) | |||
721 | struct wlr_backend_output_state *backend_state = &ctx->states[output_idx]; | 721 | struct wlr_backend_output_state *backend_state = &ctx->states[output_idx]; |
722 | struct wlr_output_state *state = &backend_state->base; | 722 | struct wlr_output_state *state = &backend_state->base; |
723 | 723 | ||
724 | if (!backend_state->output->adaptive_sync_supported) { | ||
725 | return search_finish(ctx, output_idx); | ||
726 | } | ||
727 | |||
724 | if (cfg->config && cfg->config->adaptive_sync == 1) { | 728 | if (cfg->config && cfg->config->adaptive_sync == 1) { |
725 | wlr_output_state_set_adaptive_sync_enabled(state, true); | 729 | wlr_output_state_set_adaptive_sync_enabled(state, true); |
726 | if (search_finish(ctx, output_idx)) { | 730 | if (search_finish(ctx, output_idx)) { |
727 | return true; | 731 | return true; |
728 | } | 732 | } |
729 | } | 733 | } |
730 | if (!cfg->config || cfg->config->adaptive_sync != -1) { | 734 | |
731 | wlr_output_state_set_adaptive_sync_enabled(state, false); | 735 | wlr_output_state_set_adaptive_sync_enabled(state, false); |
732 | if (search_finish(ctx, output_idx)) { | ||
733 | return true; | ||
734 | } | ||
735 | } | ||
736 | // If adaptive sync has not been set, or fallback in case we are on a | ||
737 | // backend that cannot disable adaptive sync such as the wayland backend. | ||
738 | state->committed &= ~WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED; | ||
739 | return search_finish(ctx, output_idx); | 736 | return search_finish(ctx, output_idx); |
740 | } | 737 | } |
741 | 738 | ||