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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3174>
This commit is contained in:
Michel Dänzer 2023-08-15 16:06:49 +02:00 committed by Robert Mader
parent 9f8283a95a
commit effc985401
2 changed files with 11 additions and 2 deletions

View File

@ -12,11 +12,15 @@ timeline_frame_clock_frame (ClutterFrameClock *frame_clock,
ClutterFrameInfo frame_info; ClutterFrameInfo frame_info;
frame_info = (ClutterFrameInfo) { frame_info = (ClutterFrameInfo) {
.presentation_time = g_get_monotonic_time (),
.refresh_rate = refresh_rate, .refresh_rate = refresh_rate,
.flags = CLUTTER_FRAME_INFO_FLAG_NONE, .flags = CLUTTER_FRAME_INFO_FLAG_NONE,
.sequence = 0, .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_notify_presented (frame_clock, &frame_info);
clutter_frame_clock_schedule_update (frame_clock); clutter_frame_clock_schedule_update (frame_clock);

View File

@ -190,6 +190,7 @@ immediate_frame_clock_frame (ClutterFrameClock *frame_clock,
gpointer user_data) gpointer user_data)
{ {
GMainLoop *main_loop = user_data; GMainLoop *main_loop = user_data;
int64_t target_presentation_time_us;
ClutterFrameInfo frame_info; ClutterFrameInfo frame_info;
g_assert_cmpint (clutter_frame_get_count (frame), ==, expected_frame_count); 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--; 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); clutter_frame_clock_notify_presented (frame_clock, &frame_info);
g_idle_add (schedule_update_idle, frame_clock); g_idle_add (schedule_update_idle, frame_clock);