aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenny Levinsen <kl@kl.wtf>2024-07-02 00:39:21 +0200
committerSimon Ser <contact@emersion.fr>2024-07-02 19:13:58 +0200
commit4e38f93f367dfb7f1ec66060e6262b806cecf3a7 (patch)
tree8cff788c17d8f624a499823ceb57be7db1641cc0
parent1e0031781fc9283db7096aba34deca5503c2ab91 (diff)
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.c15
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)
struct wlr_backend_output_state *backend_state = &ctx->states[output_idx];
struct wlr_output_state *state = &backend_state->base;
+ if (!backend_state->output->adaptive_sync_supported) {
+ return search_finish(ctx, output_idx);
+ }
+
if (cfg->config && cfg->config->adaptive_sync == 1) {
wlr_output_state_set_adaptive_sync_enabled(state, true);
if (search_finish(ctx, output_idx)) {
return true;
}
}
- if (!cfg->config || cfg->config->adaptive_sync != -1) {
- wlr_output_state_set_adaptive_sync_enabled(state, false);
- if (search_finish(ctx, output_idx)) {
- return true;
- }
- }
- // If adaptive sync has not been set, or fallback in case we are on a
- // backend that cannot disable adaptive sync such as the wayland backend.
- state->committed &= ~WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED;
+
+ wlr_output_state_set_adaptive_sync_enabled(state, false);
return search_finish(ctx, output_idx);
}