mirror of
https://gitlab.freedesktop.org/wayland/weston
synced 2024-09-06 18:05:39 +00:00
backend-vnc: Use weston_output_finish_frame_from_timer()
Replace the finish frame handler logic with a call to the weston_output_finish_frame_from_timer() helper function that does the same. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
This commit is contained in:
parent
2fc6a8bbd2
commit
98cd2e9f97
|
@ -709,28 +709,12 @@ vnc_new_client(struct nvnc_client *client)
|
||||||
weston_output_schedule_repaint(&output->base);
|
weston_output_schedule_repaint(&output->base);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
finish_frame_handler(void *data)
|
finish_frame_handler(void *data)
|
||||||
{
|
{
|
||||||
struct vnc_output *output = data;
|
struct vnc_output *output = data;
|
||||||
int refresh_nsec = millihz_to_nsec(output->base.current_mode->refresh);
|
|
||||||
struct timespec now, ts;
|
|
||||||
int delta;
|
|
||||||
|
|
||||||
/* The timer only has msec precision, but if we approximately hit our
|
weston_output_finish_frame_from_timer(&output->base);
|
||||||
* target, report an exact time stamp by adding to the previous frame
|
|
||||||
* time.
|
|
||||||
*/
|
|
||||||
timespec_add_nsec(&ts, &output->base.frame_time, refresh_nsec);
|
|
||||||
|
|
||||||
/* If we are more than 1.5 ms late, report the current time instead. */
|
|
||||||
weston_compositor_read_presentation_clock(output->base.compositor, &now);
|
|
||||||
delta = (int)timespec_sub_to_nsec(&now, &ts);
|
|
||||||
if (delta > 1500000)
|
|
||||||
ts = now;
|
|
||||||
|
|
||||||
weston_output_finish_frame(&output->base, &ts, 0);
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue