clutter: Store vblank duration in ClutterFrameClock
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1762>
This commit is contained in:
parent
d10567ea3e
commit
3aa0e3074f
@ -76,6 +76,10 @@ struct _ClutterFrameClock
|
|||||||
gboolean is_next_presentation_time_valid;
|
gboolean is_next_presentation_time_valid;
|
||||||
int64_t next_presentation_time_us;
|
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. */
|
/* Last KMS buffer submission time. */
|
||||||
int64_t last_flip_time_us;
|
int64_t last_flip_time_us;
|
||||||
|
|
||||||
@ -587,6 +591,7 @@ init_frame_clock_source (ClutterFrameClock *frame_clock)
|
|||||||
|
|
||||||
ClutterFrameClock *
|
ClutterFrameClock *
|
||||||
clutter_frame_clock_new (float refresh_rate,
|
clutter_frame_clock_new (float refresh_rate,
|
||||||
|
int64_t vblank_duration_us,
|
||||||
const ClutterFrameListenerIface *iface,
|
const ClutterFrameListenerIface *iface,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
@ -602,6 +607,7 @@ clutter_frame_clock_new (float refresh_rate,
|
|||||||
init_frame_clock_source (frame_clock);
|
init_frame_clock_source (frame_clock);
|
||||||
|
|
||||||
frame_clock->refresh_rate = refresh_rate;
|
frame_clock->refresh_rate = refresh_rate;
|
||||||
|
frame_clock->vblank_duration_us = vblank_duration_us;
|
||||||
|
|
||||||
return frame_clock;
|
return frame_clock;
|
||||||
}
|
}
|
||||||
|
@ -56,6 +56,7 @@ typedef struct _ClutterFrameListenerIface
|
|||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
ClutterFrameClock * clutter_frame_clock_new (float refresh_rate,
|
ClutterFrameClock * clutter_frame_clock_new (float refresh_rate,
|
||||||
|
int64_t vblank_duration_us,
|
||||||
const ClutterFrameListenerIface *iface,
|
const ClutterFrameListenerIface *iface,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
|
@ -1365,6 +1365,7 @@ clutter_stage_view_constructed (GObject *object)
|
|||||||
init_shadowfb (view);
|
init_shadowfb (view);
|
||||||
|
|
||||||
priv->frame_clock = clutter_frame_clock_new (priv->refresh_rate,
|
priv->frame_clock = clutter_frame_clock_new (priv->refresh_rate,
|
||||||
|
priv->vblank_duration_us,
|
||||||
&frame_clock_listener_iface,
|
&frame_clock_listener_iface,
|
||||||
view);
|
view);
|
||||||
|
|
||||||
|
@ -64,6 +64,7 @@ frame_clock_timeline_basic (void)
|
|||||||
|
|
||||||
main_loop = g_main_loop_new (NULL, FALSE);
|
main_loop = g_main_loop_new (NULL, FALSE);
|
||||||
frame_clock = clutter_frame_clock_new (refresh_rate,
|
frame_clock = clutter_frame_clock_new (refresh_rate,
|
||||||
|
0,
|
||||||
&timeline_frame_listener_iface,
|
&timeline_frame_listener_iface,
|
||||||
NULL);
|
NULL);
|
||||||
g_object_add_weak_pointer (G_OBJECT (frame_clock), (gpointer *) &frame_clock);
|
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);
|
main_loop = g_main_loop_new (NULL, FALSE);
|
||||||
|
|
||||||
frame_clock1 = clutter_frame_clock_new (refresh_rate,
|
frame_clock1 = clutter_frame_clock_new (refresh_rate,
|
||||||
|
0,
|
||||||
&timeline_frame_listener_iface,
|
&timeline_frame_listener_iface,
|
||||||
NULL);
|
NULL);
|
||||||
g_object_add_weak_pointer (G_OBJECT (frame_clock1), (gpointer *) &frame_clock1);
|
g_object_add_weak_pointer (G_OBJECT (frame_clock1), (gpointer *) &frame_clock1);
|
||||||
frame_clock2 = clutter_frame_clock_new (refresh_rate,
|
frame_clock2 = clutter_frame_clock_new (refresh_rate,
|
||||||
|
0,
|
||||||
&timeline_frame_listener_iface,
|
&timeline_frame_listener_iface,
|
||||||
NULL);
|
NULL);
|
||||||
g_object_add_weak_pointer (G_OBJECT (frame_clock2), (gpointer *) &frame_clock2);
|
g_object_add_weak_pointer (G_OBJECT (frame_clock2), (gpointer *) &frame_clock2);
|
||||||
|
@ -146,6 +146,7 @@ frame_clock_schedule_update (void)
|
|||||||
|
|
||||||
test.main_loop = g_main_loop_new (NULL, FALSE);
|
test.main_loop = g_main_loop_new (NULL, FALSE);
|
||||||
frame_clock = clutter_frame_clock_new (refresh_rate,
|
frame_clock = clutter_frame_clock_new (refresh_rate,
|
||||||
|
0,
|
||||||
&frame_listener_iface,
|
&frame_listener_iface,
|
||||||
&test);
|
&test);
|
||||||
|
|
||||||
@ -228,6 +229,7 @@ frame_clock_immediate_present (void)
|
|||||||
|
|
||||||
main_loop = g_main_loop_new (NULL, FALSE);
|
main_loop = g_main_loop_new (NULL, FALSE);
|
||||||
frame_clock = clutter_frame_clock_new (refresh_rate,
|
frame_clock = clutter_frame_clock_new (refresh_rate,
|
||||||
|
0,
|
||||||
&immediate_frame_listener_iface,
|
&immediate_frame_listener_iface,
|
||||||
main_loop);
|
main_loop);
|
||||||
|
|
||||||
@ -306,6 +308,7 @@ frame_clock_delayed_damage (void)
|
|||||||
|
|
||||||
test.main_loop = g_main_loop_new (NULL, FALSE);
|
test.main_loop = g_main_loop_new (NULL, FALSE);
|
||||||
frame_clock = clutter_frame_clock_new (refresh_rate,
|
frame_clock = clutter_frame_clock_new (refresh_rate,
|
||||||
|
0,
|
||||||
&delayed_damage_frame_listener_iface,
|
&delayed_damage_frame_listener_iface,
|
||||||
&test);
|
&test);
|
||||||
|
|
||||||
@ -366,6 +369,7 @@ frame_clock_no_damage (void)
|
|||||||
|
|
||||||
main_loop = g_main_loop_new (NULL, FALSE);
|
main_loop = g_main_loop_new (NULL, FALSE);
|
||||||
frame_clock = clutter_frame_clock_new (refresh_rate,
|
frame_clock = clutter_frame_clock_new (refresh_rate,
|
||||||
|
0,
|
||||||
&no_damage_frame_listener_iface,
|
&no_damage_frame_listener_iface,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
@ -452,6 +456,7 @@ frame_clock_schedule_update_now (void)
|
|||||||
|
|
||||||
test.base.main_loop = g_main_loop_new (NULL, FALSE);
|
test.base.main_loop = g_main_loop_new (NULL, FALSE);
|
||||||
frame_clock = clutter_frame_clock_new (refresh_rate,
|
frame_clock = clutter_frame_clock_new (refresh_rate,
|
||||||
|
0,
|
||||||
&update_now_frame_listener_iface,
|
&update_now_frame_listener_iface,
|
||||||
&test);
|
&test);
|
||||||
|
|
||||||
@ -534,6 +539,7 @@ frame_clock_before_frame (void)
|
|||||||
|
|
||||||
main_loop = g_main_loop_new (NULL, FALSE);
|
main_loop = g_main_loop_new (NULL, FALSE);
|
||||||
frame_clock = clutter_frame_clock_new (refresh_rate,
|
frame_clock = clutter_frame_clock_new (refresh_rate,
|
||||||
|
0,
|
||||||
&before_frame_frame_listener_iface,
|
&before_frame_frame_listener_iface,
|
||||||
&expected_frame_count);
|
&expected_frame_count);
|
||||||
|
|
||||||
@ -615,6 +621,7 @@ frame_clock_inhibit (void)
|
|||||||
|
|
||||||
test.main_loop = g_main_loop_new (NULL, FALSE);
|
test.main_loop = g_main_loop_new (NULL, FALSE);
|
||||||
test.frame_clock = clutter_frame_clock_new (refresh_rate,
|
test.frame_clock = clutter_frame_clock_new (refresh_rate,
|
||||||
|
0,
|
||||||
&inhibit_frame_listener_iface,
|
&inhibit_frame_listener_iface,
|
||||||
&test);
|
&test);
|
||||||
|
|
||||||
@ -678,6 +685,7 @@ frame_clock_reschedule_on_idle (void)
|
|||||||
|
|
||||||
test.base.main_loop = g_main_loop_new (NULL, FALSE);
|
test.base.main_loop = g_main_loop_new (NULL, FALSE);
|
||||||
frame_clock = clutter_frame_clock_new (refresh_rate,
|
frame_clock = clutter_frame_clock_new (refresh_rate,
|
||||||
|
0,
|
||||||
&reschedule_on_idle_listener_iface,
|
&reschedule_on_idle_listener_iface,
|
||||||
&test);
|
&test);
|
||||||
fake_hw_clock = fake_hw_clock_new (frame_clock, NULL, NULL);
|
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. */
|
/* Test that the destroy signal is emitted when removing last reference. */
|
||||||
|
|
||||||
frame_clock = clutter_frame_clock_new (refresh_rate,
|
frame_clock = clutter_frame_clock_new (refresh_rate,
|
||||||
|
0,
|
||||||
&dummy_frame_listener_iface,
|
&dummy_frame_listener_iface,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
@ -732,6 +741,7 @@ frame_clock_destroy_signal (void)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
frame_clock = clutter_frame_clock_new (refresh_rate,
|
frame_clock = clutter_frame_clock_new (refresh_rate,
|
||||||
|
0,
|
||||||
&dummy_frame_listener_iface,
|
&dummy_frame_listener_iface,
|
||||||
NULL);
|
NULL);
|
||||||
frame_clock_backup = frame_clock;
|
frame_clock_backup = frame_clock;
|
||||||
@ -802,6 +812,7 @@ frame_clock_notify_ready (void)
|
|||||||
|
|
||||||
main_loop = g_main_loop_new (NULL, FALSE);
|
main_loop = g_main_loop_new (NULL, FALSE);
|
||||||
frame_clock = clutter_frame_clock_new (refresh_rate,
|
frame_clock = clutter_frame_clock_new (refresh_rate,
|
||||||
|
0,
|
||||||
&frame_clock_ready_listener_iface,
|
&frame_clock_ready_listener_iface,
|
||||||
main_loop);
|
main_loop);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user