From 63b9ac272442c7645c4940249374e26f12e3006d Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Fri, 27 Nov 2020 20:48:11 +0300 Subject: [PATCH] clutter: Record flip time Will be used for intelligent max render time computation (aka repaint scheduling). Part-of: --- clutter/clutter/clutter-frame-clock.c | 10 ++++++++++ clutter/clutter/clutter-frame-clock.h | 3 +++ clutter/clutter/clutter-stage-view.c | 3 +++ 3 files changed, 16 insertions(+) diff --git a/clutter/clutter/clutter-frame-clock.c b/clutter/clutter/clutter-frame-clock.c index 05e79e662..c5acf51ad 100644 --- a/clutter/clutter/clutter-frame-clock.c +++ b/clutter/clutter/clutter-frame-clock.c @@ -76,6 +76,9 @@ struct _ClutterFrameClock gboolean is_next_presentation_time_valid; int64_t next_presentation_time_us; + /* Last KMS buffer submission time. */ + int64_t last_flip_time_us; + gboolean pending_reschedule; gboolean pending_reschedule_now; @@ -548,6 +551,13 @@ frame_clock_source_dispatch (GSource *source, 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 = { NULL, NULL, diff --git a/clutter/clutter/clutter-frame-clock.h b/clutter/clutter/clutter-frame-clock.h index 9f91b6bfd..b7120aade 100644 --- a/clutter/clutter/clutter-frame-clock.h +++ b/clutter/clutter/clutter-frame-clock.h @@ -90,4 +90,7 @@ void clutter_frame_clock_remove_timeline (ClutterFrameClock *frame_clock, CLUTTER_EXPORT 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 */ diff --git a/clutter/clutter/clutter-stage-view.c b/clutter/clutter/clutter-stage-view.c index b44bf8885..d6755e3c4 100644 --- a/clutter/clutter/clutter-stage-view.c +++ b/clutter/clutter/clutter-stage-view.c @@ -1187,6 +1187,9 @@ handle_frame_clock_frame (ClutterFrameClock *frame_clock, _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); if (_clutter_context_get_show_fps ())