diff --git a/clients/presentation-shm.c b/clients/presentation-shm.c index 2bb0aa1ce..ae5296451 100644 --- a/clients/presentation-shm.c +++ b/clients/presentation-shm.c @@ -775,7 +775,7 @@ registry_handle_global(void *data, struct wl_registry *registry, } else if (strcmp(interface, wp_presentation_interface.name) == 0) { d->presentation = wl_registry_bind(registry, - name, &wp_presentation_interface, 1); + name, &wp_presentation_interface, 2); wp_presentation_add_listener(d->presentation, &presentation_listener, d); } diff --git a/libweston/compositor.c b/libweston/compositor.c index e635d60e1..af245cb48 100644 --- a/libweston/compositor.c +++ b/libweston/compositor.c @@ -846,6 +846,7 @@ weston_presentation_feedback_present( struct wl_client *client = wl_resource_get_client(feedback->resource); struct weston_head *head; struct wl_resource *o; + uint32_t version = wl_resource_get_version(feedback->resource); uint32_t tv_sec_hi; uint32_t tv_sec_lo; uint32_t tv_nsec; @@ -867,6 +868,10 @@ weston_presentation_feedback_present( break; } + /* In version 1, inconsistent rate must give a 0 refresh_nsec */ + if (version < 2 && output->vrr_mode == WESTON_VRR_MODE_GAME) + refresh_nsec = 0; + timespec_to_proto(ts, &tv_sec_hi, &tv_sec_lo, &tv_nsec); wp_presentation_feedback_send_presented(feedback->resource, tv_sec_hi, tv_sec_lo, tv_nsec, @@ -9006,7 +9011,8 @@ presentation_feedback(struct wl_client *client, feedback->resource = wl_resource_create(client, &wp_presentation_feedback_interface, - 1, callback); + wl_resource_get_version(presentation_resource), + callback); if (!feedback->resource) goto err_create; @@ -9695,7 +9701,7 @@ weston_compositor_create(struct wl_display *display, ec, bind_xdg_output_manager)) goto fail; - if (!wl_global_create(ec->wl_display, &wp_presentation_interface, 1, + if (!wl_global_create(ec->wl_display, &wp_presentation_interface, 2, ec, bind_presentation)) goto fail; diff --git a/tests/weston-test-client-helper.c b/tests/weston-test-client-helper.c index cbd3d8a7f..527cf52b9 100644 --- a/tests/weston-test-client-helper.c +++ b/tests/weston-test-client-helper.c @@ -2653,10 +2653,10 @@ client_get_presentation(struct client *client) test_assert_ptr_not_null(global_pres); - test_assert_u32_eq(global_pres->version, 1); + test_assert_u32_eq(global_pres->version, 2); pres = wl_registry_bind(client->wl_registry, global_pres->name, - &wp_presentation_interface, 1); + &wp_presentation_interface, 2); test_assert_ptr_not_null(pres);