From f10327f9155f447fbddf0848309a15ebcb10dd46 Mon Sep 17 00:00:00 2001 From: Kenny Levinsen Date: Fri, 19 Apr 2024 16:37:40 +0200 Subject: [PATCH] wlr_output: Add adaptive_sync_supported This will let compositors know if changing adaptive_sync state has any chance of working. When false, then the current state is the only supported state, including if adaptive_sync is currently enabled as is the case for Wayland and X11 backends. When true, changing state might succeed, but no guarantee is made. It just indicates that the backend does not already know it to be impossible. --- backend/drm/drm.c | 6 ++++++ include/wlr/types/wlr_output.h | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/backend/drm/drm.c b/backend/drm/drm.c index b2e2c392..dff02e87 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -1586,6 +1586,12 @@ static bool connect_drm_connector(struct wlr_drm_connector *wlr_conn, } } + uint64_t vrr_capable = 0; + if (wlr_conn->props.vrr_capable != 0) { + get_drm_prop(drm->fd, wlr_conn->id, wlr_conn->props.vrr_capable, &vrr_capable); + } + output->adaptive_sync_supported = vrr_capable; + size_t edid_len = 0; uint8_t *edid = get_drm_prop_blob(drm->fd, wlr_conn->id, wlr_conn->props.edid, &edid_len); diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h index d349f8ff..ff675bd3 100644 --- a/include/wlr/types/wlr_output.h +++ b/include/wlr/types/wlr_output.h @@ -150,6 +150,11 @@ struct wlr_output { enum wlr_output_adaptive_sync_status adaptive_sync_status; uint32_t render_format; + // Indicates whether making changes to adaptive sync status is supported. + // If false, changes to adaptive sync status is guaranteed to fail. If + // true, changes may either succeed or fail. + bool adaptive_sync_supported; + bool needs_frame; // damage for cursors and fullscreen surface, in output-local coordinates bool frame_pending;