From effc985401a343ecd5b7b40a4ba2ebe37d85b794 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Tue, 15 Aug 2023 16:06:49 +0200 Subject: [PATCH] tests/clutter/frame-clock*: Use clutter_frame_get_target_presentation_time Instead of g_get_monotonic_time. This makes sure last_presentation_time_us advances by refresh_interval_us. Doesn't affect test results at this point, but it will with the next commit. Part-of: --- src/tests/clutter/conform/frame-clock-timeline.c | 6 +++++- src/tests/clutter/conform/frame-clock.c | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/tests/clutter/conform/frame-clock-timeline.c b/src/tests/clutter/conform/frame-clock-timeline.c index 175680327..b78021eac 100644 --- a/src/tests/clutter/conform/frame-clock-timeline.c +++ b/src/tests/clutter/conform/frame-clock-timeline.c @@ -12,11 +12,15 @@ timeline_frame_clock_frame (ClutterFrameClock *frame_clock, ClutterFrameInfo frame_info; frame_info = (ClutterFrameInfo) { - .presentation_time = g_get_monotonic_time (), .refresh_rate = refresh_rate, .flags = CLUTTER_FRAME_INFO_FLAG_NONE, .sequence = 0, }; + + if (!clutter_frame_get_target_presentation_time (frame, + &frame_info.presentation_time)) + frame_info.presentation_time = g_get_monotonic_time (); + clutter_frame_clock_notify_presented (frame_clock, &frame_info); clutter_frame_clock_schedule_update (frame_clock); diff --git a/src/tests/clutter/conform/frame-clock.c b/src/tests/clutter/conform/frame-clock.c index d82c70799..3723bea3a 100644 --- a/src/tests/clutter/conform/frame-clock.c +++ b/src/tests/clutter/conform/frame-clock.c @@ -190,6 +190,7 @@ immediate_frame_clock_frame (ClutterFrameClock *frame_clock, gpointer user_data) { GMainLoop *main_loop = user_data; + int64_t target_presentation_time_us; ClutterFrameInfo frame_info; g_assert_cmpint (clutter_frame_get_count (frame), ==, expected_frame_count); @@ -204,7 +205,11 @@ immediate_frame_clock_frame (ClutterFrameClock *frame_clock, test_frame_count--; - init_frame_info (&frame_info, g_get_monotonic_time ()); + if (!clutter_frame_get_target_presentation_time (frame, + &target_presentation_time_us)) + target_presentation_time_us = g_get_monotonic_time (); + + init_frame_info (&frame_info, target_presentation_time_us); clutter_frame_clock_notify_presented (frame_clock, &frame_info); g_idle_add (schedule_update_idle, frame_clock);