From e6ac2afa5659276e4050352a5d7626c6903fbce6 Mon Sep 17 00:00:00 2001 From: Alexandros Frantzis Date: Thu, 16 Nov 2017 18:20:53 +0200 Subject: [PATCH] libweston: Use struct timespec for the output presentation timestamp Store the output presentation timestamp as struct timespec. This commit is part of a larger effort to transition the Weston codebase to struct timespec. Signed-off-by: Alexandros Frantzis Reviewed-by: Pekka Paalanen --- libweston/compositor.c | 12 ++++++------ libweston/compositor.h | 2 +- libweston/screenshooter.c | 3 ++- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/libweston/compositor.c b/libweston/compositor.c index 037b4b5f..cfa7eace 100644 --- a/libweston/compositor.c +++ b/libweston/compositor.c @@ -2292,15 +2292,13 @@ weston_output_repaint(struct weston_output *output, void *repaint_data) struct wl_list frame_callback_list; pixman_region32_t output_damage; int r; - struct timespec frame_time; + uint32_t frame_time_msec; if (output->destroying) return 0; TL_POINT("core_repaint_begin", TLP_OUTPUT(output), TLP_END); - timespec_from_msec(&frame_time, output->frame_time); - /* Rebuild the surface list and update surface transforms up front. */ weston_compositor_build_view_list(ec); @@ -2348,14 +2346,16 @@ weston_output_repaint(struct weston_output *output, void *repaint_data) weston_compositor_repick(ec); + frame_time_msec = timespec_to_msec(&output->frame_time); + wl_list_for_each_safe(cb, cnext, &frame_callback_list, link) { - wl_callback_send_done(cb->resource, output->frame_time); + wl_callback_send_done(cb->resource, frame_time_msec); wl_resource_destroy(cb->resource); } wl_list_for_each_safe(animation, next, &output->animation_list, link) { animation->frame_counter++; - animation->frame(animation, output, &frame_time); + animation->frame(animation, output, &output->frame_time); } TL_POINT("core_repaint_posted", TLP_OUTPUT(output), TLP_END); @@ -2520,7 +2520,7 @@ weston_output_finish_frame(struct weston_output *output, output->msc, presented_flags); - output->frame_time = timespec_to_msec(stamp); + output->frame_time = *stamp; timespec_add_nsec(&output->next_repaint, stamp, refresh_nsec); timespec_add_msec(&output->next_repaint, &output->next_repaint, diff --git a/libweston/compositor.h b/libweston/compositor.h index 23d709ce..59c349d5 100644 --- a/libweston/compositor.h +++ b/libweston/compositor.h @@ -193,7 +193,7 @@ struct weston_output { struct wl_signal frame_signal; struct wl_signal destroy_signal; int move_x, move_y; - uint32_t frame_time; /* presentation timestamp in milliseconds */ + struct timespec frame_time; /* presentation timestamp */ uint64_t msc; /* media stream counter */ int disable_planes; int destroying; diff --git a/libweston/screenshooter.c b/libweston/screenshooter.c index 2c5dacc1..f4e3f4de 100644 --- a/libweston/screenshooter.c +++ b/libweston/screenshooter.c @@ -36,6 +36,7 @@ #include "compositor.h" #include "shared/helpers.h" +#include "shared/timespec-util.h" #include "wcap/wcap-decode.h" @@ -259,7 +260,7 @@ weston_recorder_frame_notify(struct wl_listener *listener, void *data) container_of(listener, struct weston_recorder, frame_listener); struct weston_output *output = data; struct weston_compositor *compositor = output->compositor; - uint32_t msecs = output->frame_time; + uint32_t msecs = timespec_to_msec(&output->frame_time); pixman_box32_t *r; pixman_region32_t damage, transformed_damage; int i, j, k, n, width, height, run, stride;