From 2ec27d23e01377b341346036176cdc2faf0662cf Mon Sep 17 00:00:00 2001 From: Isaac Freund Date: Tue, 28 Jun 2022 19:55:48 +0200 Subject: [PATCH] backend/wayland: report adaptive sync as enabled Adaptive sync is effectively always enabled when using the Wayland backend. This is not something we have control over, so we set the state to enabled on creating the output and never allow changing it. --- backend/wayland/output.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/backend/wayland/output.c b/backend/wayland/output.c index 36b3911b1..28fa5e99d 100644 --- a/backend/wayland/output.c +++ b/backend/wayland/output.c @@ -29,7 +29,8 @@ static const uint32_t SUPPORTED_OUTPUT_STATE = WLR_OUTPUT_STATE_BACKEND_OPTIONAL | WLR_OUTPUT_STATE_BUFFER | - WLR_OUTPUT_STATE_MODE; + WLR_OUTPUT_STATE_MODE | + WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED; static struct wlr_wl_output *get_wl_output_from_output( struct wlr_output *wlr_output) { @@ -251,6 +252,16 @@ static bool output_test(struct wlr_output *wlr_output, return false; } + // Adaptive sync is effectively always enabled when using the Wayland + // backend. This is not something we have control over, so we set the state + // to enabled on creating the output and never allow changing it. + assert(wlr_output->adaptive_sync_status == WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED); + if (state->committed & WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED) { + if (!state->adaptive_sync_enabled) { + return false; + } + } + if (state->committed & WLR_OUTPUT_STATE_MODE) { assert(state->mode_type == WLR_OUTPUT_STATE_MODE_CUSTOM); } @@ -521,6 +532,8 @@ struct wlr_output *wlr_wl_output_create(struct wlr_backend *wlr_backend) { wlr_output_update_custom_mode(wlr_output, 1280, 720, 0); + wlr_output->adaptive_sync_status = WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED; + char name[64]; snprintf(name, sizeof(name), "WL-%zu", ++backend->last_output_num); wlr_output_set_name(wlr_output, name);