diff --git a/include/wlr/types/wlr_presentation_time.h b/include/wlr/types/wlr_presentation_time.h index bedd77a6c..717665e68 100644 --- a/include/wlr/types/wlr_presentation_time.h +++ b/include/wlr/types/wlr_presentation_time.h @@ -56,7 +56,7 @@ struct wlr_presentation_event { struct wlr_backend; struct wlr_presentation *wlr_presentation_create(struct wl_display *display, - struct wlr_backend *backend); + struct wlr_backend *backend, int version); /** * Mark the current surface's buffer as sampled. * diff --git a/protocol/meson.build b/protocol/meson.build index a4476918b..3e385d4ec 100644 --- a/protocol/meson.build +++ b/protocol/meson.build @@ -1,5 +1,5 @@ wayland_protos = dependency('wayland-protocols', - version: '>=1.35', + version: '>=1.38', fallback: 'wayland-protocols', default_options: ['tests=false'], ) diff --git a/types/wlr_presentation_time.c b/types/wlr_presentation_time.c index 94e379a54..0e5e88ea6 100644 --- a/types/wlr_presentation_time.c +++ b/types/wlr_presentation_time.c @@ -7,7 +7,7 @@ #include #include "presentation-time-protocol.h" -#define PRESENTATION_VERSION 1 +#define PRESENTATION_VERSION 2 struct wlr_presentation_surface_state { struct wlr_presentation_feedback *feedback; @@ -172,14 +172,16 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) { } struct wlr_presentation *wlr_presentation_create(struct wl_display *display, - struct wlr_backend *backend) { + struct wlr_backend *backend, int version) { + assert(version <= PRESENTATION_VERSION); + struct wlr_presentation *presentation = calloc(1, sizeof(*presentation)); if (presentation == NULL) { return NULL; } presentation->global = wl_global_create(display, &wp_presentation_interface, - PRESENTATION_VERSION, NULL, presentation_bind); + version, NULL, presentation_bind); if (presentation->global == NULL) { free(presentation); return NULL; @@ -283,6 +285,11 @@ static void feedback_handle_output_present(struct wl_listener *listener, if (output_event->presented) { struct wlr_presentation_event event = {0}; wlr_presentation_event_from_output(&event, output_event); + struct wl_resource *resource = wl_resource_from_link(feedback->resources.next); + if (wl_resource_get_version(resource) == 1 && + event.output->adaptive_sync_status == WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED) { + event.refresh = 0; + } if (!feedback->zero_copy) { event.flags &= ~WP_PRESENTATION_FEEDBACK_KIND_ZERO_COPY; }