backend: drop wlr_backend_get_presentation_clock()

We can just assume CLOCK_MONOTONIC everywhere.

Simplifies the backend API, and fixes clock mismatches when multiple
backends are used together with different clocks.
This commit is contained in:
Simon Ser 2023-10-30 18:37:13 +01:00
parent 5fac9b1beb
commit 1c24b1182b
12 changed files with 13 additions and 56 deletions

View file

@ -913,9 +913,7 @@ void wlr_output_send_present(struct wlr_output *output,
struct timespec now;
if (event->presented && event->when == NULL) {
clockid_t clock = wlr_backend_get_presentation_clock(output->backend);
errno = 0;
if (clock_gettime(clock, &now) != 0) {
if (clock_gettime(CLOCK_MONOTONIC, &now) != 0) {
wlr_log_errno(WLR_ERROR, "failed to send output present event: "
"failed to read clock");
return;

View file

@ -168,7 +168,7 @@ static void presentation_bind(struct wl_client *client, void *data,
wl_resource_set_implementation(resource, &presentation_impl, presentation,
NULL);
wp_presentation_send_clock_id(resource, (uint32_t)presentation->clock);
wp_presentation_send_clock_id(resource, CLOCK_MONOTONIC);
}
static void handle_display_destroy(struct wl_listener *listener, void *data) {
@ -194,8 +194,6 @@ struct wlr_presentation *wlr_presentation_create(struct wl_display *display,
return NULL;
}
presentation->clock = wlr_backend_get_presentation_clock(backend);
wl_signal_init(&presentation->events.destroy);
presentation->display_destroy.notify = handle_display_destroy;