mirror of
https://github.com/swaywm/sway.git
synced 2024-11-10 02:13:13 +00:00
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.
This commit is contained in:
parent
1e0031781f
commit
4e38f93f36
|
@ -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_backend_output_state *backend_state = &ctx->states[output_idx];
|
||||||
struct wlr_output_state *state = &backend_state->base;
|
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) {
|
if (cfg->config && cfg->config->adaptive_sync == 1) {
|
||||||
wlr_output_state_set_adaptive_sync_enabled(state, true);
|
wlr_output_state_set_adaptive_sync_enabled(state, true);
|
||||||
if (search_finish(ctx, output_idx)) {
|
if (search_finish(ctx, output_idx)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!cfg->config || cfg->config->adaptive_sync != -1) {
|
|
||||||
wlr_output_state_set_adaptive_sync_enabled(state, false);
|
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;
|
|
||||||
return search_finish(ctx, output_idx);
|
return search_finish(ctx, output_idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue