clutter: Record flip time

Will be used for intelligent max render time computation (aka repaint
scheduling).

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1762>
This commit is contained in:
Ivan Molodetskikh 2020-11-27 20:48:11 +03:00 committed by Marge Bot
parent 9f492a0ee0
commit 63b9ac2724
3 changed files with 16 additions and 0 deletions

View File

@ -76,6 +76,9 @@ 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;
/* Last KMS buffer submission time. */
int64_t last_flip_time_us;
gboolean pending_reschedule; gboolean pending_reschedule;
gboolean pending_reschedule_now; gboolean pending_reschedule_now;
@ -548,6 +551,13 @@ frame_clock_source_dispatch (GSource *source,
return G_SOURCE_CONTINUE; return G_SOURCE_CONTINUE;
} }
void
clutter_frame_clock_record_flip_time (ClutterFrameClock *frame_clock,
int64_t flip_time_us)
{
frame_clock->last_flip_time_us = flip_time_us;
}
static GSourceFuncs frame_clock_source_funcs = { static GSourceFuncs frame_clock_source_funcs = {
NULL, NULL,
NULL, NULL,

View File

@ -90,4 +90,7 @@ void clutter_frame_clock_remove_timeline (ClutterFrameClock *frame_clock,
CLUTTER_EXPORT CLUTTER_EXPORT
float clutter_frame_clock_get_refresh_rate (ClutterFrameClock *frame_clock); float clutter_frame_clock_get_refresh_rate (ClutterFrameClock *frame_clock);
void clutter_frame_clock_record_flip_time (ClutterFrameClock *frame_clock,
int64_t flip_time_us);
#endif /* CLUTTER_FRAME_CLOCK_H */ #endif /* CLUTTER_FRAME_CLOCK_H */

View File

@ -1187,6 +1187,9 @@ handle_frame_clock_frame (ClutterFrameClock *frame_clock,
_clutter_stage_window_redraw_view (stage_window, view, &frame); _clutter_stage_window_redraw_view (stage_window, view, &frame);
clutter_frame_clock_record_flip_time (frame_clock,
g_get_monotonic_time ());
clutter_stage_emit_after_paint (stage, view); clutter_stage_emit_after_paint (stage, view);
if (_clutter_context_get_show_fps ()) if (_clutter_context_get_show_fps ())