clutter: Store vblank duration in ClutterFrameClock

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1762>
This commit is contained in:
Ivan Molodetskikh 2021-01-06 15:20:01 +03:00 committed by Marge Bot
parent d10567ea3e
commit 3aa0e3074f
5 changed files with 22 additions and 0 deletions

View File

@ -76,6 +76,10 @@ struct _ClutterFrameClock
gboolean is_next_presentation_time_valid;
int64_t next_presentation_time_us;
/* Buffer must be submitted to KMS and GPU rendering must be finished
* this amount of time before the next presentation time.
*/
int64_t vblank_duration_us;
/* Last KMS buffer submission time. */
int64_t last_flip_time_us;
@ -587,6 +591,7 @@ init_frame_clock_source (ClutterFrameClock *frame_clock)
ClutterFrameClock *
clutter_frame_clock_new (float refresh_rate,
int64_t vblank_duration_us,
const ClutterFrameListenerIface *iface,
gpointer user_data)
{
@ -602,6 +607,7 @@ clutter_frame_clock_new (float refresh_rate,
init_frame_clock_source (frame_clock);
frame_clock->refresh_rate = refresh_rate;
frame_clock->vblank_duration_us = vblank_duration_us;
return frame_clock;
}

View File

@ -56,6 +56,7 @@ typedef struct _ClutterFrameListenerIface
CLUTTER_EXPORT
ClutterFrameClock * clutter_frame_clock_new (float refresh_rate,
int64_t vblank_duration_us,
const ClutterFrameListenerIface *iface,
gpointer user_data);

View File

@ -1365,6 +1365,7 @@ clutter_stage_view_constructed (GObject *object)
init_shadowfb (view);
priv->frame_clock = clutter_frame_clock_new (priv->refresh_rate,
priv->vblank_duration_us,
&frame_clock_listener_iface,
view);

View File

@ -64,6 +64,7 @@ frame_clock_timeline_basic (void)
main_loop = g_main_loop_new (NULL, FALSE);
frame_clock = clutter_frame_clock_new (refresh_rate,
0,
&timeline_frame_listener_iface,
NULL);
g_object_add_weak_pointer (G_OBJECT (frame_clock), (gpointer *) &frame_clock);
@ -143,10 +144,12 @@ frame_clock_timeline_switch (void)
main_loop = g_main_loop_new (NULL, FALSE);
frame_clock1 = clutter_frame_clock_new (refresh_rate,
0,
&timeline_frame_listener_iface,
NULL);
g_object_add_weak_pointer (G_OBJECT (frame_clock1), (gpointer *) &frame_clock1);
frame_clock2 = clutter_frame_clock_new (refresh_rate,
0,
&timeline_frame_listener_iface,
NULL);
g_object_add_weak_pointer (G_OBJECT (frame_clock2), (gpointer *) &frame_clock2);

View File

@ -146,6 +146,7 @@ frame_clock_schedule_update (void)
test.main_loop = g_main_loop_new (NULL, FALSE);
frame_clock = clutter_frame_clock_new (refresh_rate,
0,
&frame_listener_iface,
&test);
@ -228,6 +229,7 @@ frame_clock_immediate_present (void)
main_loop = g_main_loop_new (NULL, FALSE);
frame_clock = clutter_frame_clock_new (refresh_rate,
0,
&immediate_frame_listener_iface,
main_loop);
@ -306,6 +308,7 @@ frame_clock_delayed_damage (void)
test.main_loop = g_main_loop_new (NULL, FALSE);
frame_clock = clutter_frame_clock_new (refresh_rate,
0,
&delayed_damage_frame_listener_iface,
&test);
@ -366,6 +369,7 @@ frame_clock_no_damage (void)
main_loop = g_main_loop_new (NULL, FALSE);
frame_clock = clutter_frame_clock_new (refresh_rate,
0,
&no_damage_frame_listener_iface,
NULL);
@ -452,6 +456,7 @@ frame_clock_schedule_update_now (void)
test.base.main_loop = g_main_loop_new (NULL, FALSE);
frame_clock = clutter_frame_clock_new (refresh_rate,
0,
&update_now_frame_listener_iface,
&test);
@ -534,6 +539,7 @@ frame_clock_before_frame (void)
main_loop = g_main_loop_new (NULL, FALSE);
frame_clock = clutter_frame_clock_new (refresh_rate,
0,
&before_frame_frame_listener_iface,
&expected_frame_count);
@ -615,6 +621,7 @@ frame_clock_inhibit (void)
test.main_loop = g_main_loop_new (NULL, FALSE);
test.frame_clock = clutter_frame_clock_new (refresh_rate,
0,
&inhibit_frame_listener_iface,
&test);
@ -678,6 +685,7 @@ frame_clock_reschedule_on_idle (void)
test.base.main_loop = g_main_loop_new (NULL, FALSE);
frame_clock = clutter_frame_clock_new (refresh_rate,
0,
&reschedule_on_idle_listener_iface,
&test);
fake_hw_clock = fake_hw_clock_new (frame_clock, NULL, NULL);
@ -714,6 +722,7 @@ frame_clock_destroy_signal (void)
/* Test that the destroy signal is emitted when removing last reference. */
frame_clock = clutter_frame_clock_new (refresh_rate,
0,
&dummy_frame_listener_iface,
NULL);
@ -732,6 +741,7 @@ frame_clock_destroy_signal (void)
*/
frame_clock = clutter_frame_clock_new (refresh_rate,
0,
&dummy_frame_listener_iface,
NULL);
frame_clock_backup = frame_clock;
@ -802,6 +812,7 @@ frame_clock_notify_ready (void)
main_loop = g_main_loop_new (NULL, FALSE);
frame_clock = clutter_frame_clock_new (refresh_rate,
0,
&frame_clock_ready_listener_iface,
main_loop);