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 <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This commit is contained in:
Alexandros Frantzis 2017-11-16 18:20:53 +02:00 committed by Pekka Paalanen
parent 8250a61de1
commit e6ac2afa56
3 changed files with 9 additions and 8 deletions

View File

@ -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,

View File

@ -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;

View File

@ -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;