mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2025-12-20 02:20:13 +01:00
compositor: Update to presentation-timing version 2
This fixes a bug in version 1 where we should've been giving a 0 refresh for VRR, and introduces version 2 where we're allowed to give a compositor chosen rate for VRR. We currently chose the mode's native refresh rate. Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
parent
2e66195546
commit
fc2e365c1d
3 changed files with 11 additions and 5 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue