[mutter] frame-clock: Pass frame info when notifying presented
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] frame-clock: Pass frame info when notifying presented
- Date: Thu, 2 Jul 2020 20:52:44 +0000 (UTC)
commit ff65c95aee0b8aded3f80614c61e89beb5199754
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Wed May 20 22:10:31 2020 +0200
frame-clock: Pass frame info when notifying presented
Instead of just the timestamp, pass the frame info struct we already,
that also include refresh rate.
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
clutter/clutter/clutter-frame-clock.c | 4 +++-
clutter/clutter/clutter-frame-clock.h | 2 +-
src/tests/clutter/conform/frame-clock-timeline.c | 8 ++++++-
src/tests/clutter/conform/frame-clock.c | 28 +++++++++++++++++++-----
4 files changed, 34 insertions(+), 8 deletions(-)
---
diff --git a/clutter/clutter/clutter-frame-clock.c b/clutter/clutter/clutter-frame-clock.c
index d9ef9e1f04..c325c63fee 100644
--- a/clutter/clutter/clutter-frame-clock.c
+++ b/clutter/clutter/clutter-frame-clock.c
@@ -164,8 +164,10 @@ maybe_reschedule_update (ClutterFrameClock *frame_clock)
void
clutter_frame_clock_notify_presented (ClutterFrameClock *frame_clock,
- int64_t presentation_time_us)
+ ClutterFrameInfo *frame_info)
{
+ int64_t presentation_time_us = frame_info->presentation_time;
+
if (presentation_time_us > frame_clock->last_presentation_time_us ||
((presentation_time_us - frame_clock->last_presentation_time_us) >
INT64_MAX / 2))
diff --git a/clutter/clutter/clutter-frame-clock.h b/clutter/clutter/clutter-frame-clock.h
index 6f70546d2a..29360f3077 100644
--- a/clutter/clutter/clutter-frame-clock.h
+++ b/clutter/clutter/clutter-frame-clock.h
@@ -54,7 +54,7 @@ ClutterFrameClock * clutter_frame_clock_new (float re
CLUTTER_EXPORT
void clutter_frame_clock_notify_presented (ClutterFrameClock *frame_clock,
- int64_t presentation_time_us);
+ ClutterFrameInfo *frame_info);
CLUTTER_EXPORT
void clutter_frame_clock_schedule_update (ClutterFrameClock *frame_clock);
diff --git a/src/tests/clutter/conform/frame-clock-timeline.c
b/src/tests/clutter/conform/frame-clock-timeline.c
index f00a938da1..8efea0bf5b 100644
--- a/src/tests/clutter/conform/frame-clock-timeline.c
+++ b/src/tests/clutter/conform/frame-clock-timeline.c
@@ -10,7 +10,13 @@ timeline_frame_clock_frame (ClutterFrameClock *frame_clock,
int64_t time_us,
gpointer user_data)
{
- clutter_frame_clock_notify_presented (frame_clock, g_get_monotonic_time ());
+ ClutterFrameInfo frame_info;
+
+ frame_info = (ClutterFrameInfo) {
+ .presentation_time = g_get_monotonic_time (),
+ .refresh_rate = refresh_rate,
+ };
+ clutter_frame_clock_notify_presented (frame_clock, &frame_info);
clutter_frame_clock_schedule_update (frame_clock);
return CLUTTER_FRAME_RESULT_PENDING_PRESENTED;
diff --git a/src/tests/clutter/conform/frame-clock.c b/src/tests/clutter/conform/frame-clock.c
index d99cfa5dfd..b865b132c3 100644
--- a/src/tests/clutter/conform/frame-clock.c
+++ b/src/tests/clutter/conform/frame-clock.c
@@ -25,6 +25,16 @@ typedef struct _FrameClockTest
GMainLoop *main_loop;
} FrameClockTest;
+static void
+init_frame_info (ClutterFrameInfo *frame_info,
+ int64_t presentation_time_us)
+{
+ *frame_info = (ClutterFrameInfo) {
+ .presentation_time = presentation_time_us,
+ .refresh_rate = refresh_rate,
+ };
+}
+
static gboolean
fake_hw_clock_source_dispatch (GSource *source,
GSourceFunc callback,
@@ -35,9 +45,11 @@ fake_hw_clock_source_dispatch (GSource *source,
if (fake_hw_clock->has_pending_present)
{
+ ClutterFrameInfo frame_info;
+
fake_hw_clock->has_pending_present = FALSE;
- clutter_frame_clock_notify_presented (frame_clock,
- g_source_get_time (source));
+ init_frame_info (&frame_info, g_source_get_time (source));
+ clutter_frame_clock_notify_presented (frame_clock, &frame_info);
if (callback)
callback (user_data);
}
@@ -176,6 +188,7 @@ immediate_frame_clock_frame (ClutterFrameClock *frame_clock,
gpointer user_data)
{
GMainLoop *main_loop = user_data;
+ ClutterFrameInfo frame_info;
g_assert_cmpint (frame_count, ==, expected_frame_count);
@@ -189,7 +202,8 @@ immediate_frame_clock_frame (ClutterFrameClock *frame_clock,
test_frame_count--;
- clutter_frame_clock_notify_presented (frame_clock, g_get_monotonic_time ());
+ init_frame_info (&frame_info, g_get_monotonic_time ());
+ clutter_frame_clock_notify_presented (frame_clock, &frame_info);
g_idle_add (schedule_update_idle, frame_clock);
return CLUTTER_FRAME_RESULT_PENDING_PRESENTED;
@@ -480,12 +494,14 @@ before_frame_frame_clock_frame (ClutterFrameClock *frame_clock,
gpointer user_data)
{
int64_t *expected_frame_count = user_data;
+ ClutterFrameInfo frame_info;
g_assert_cmpint (*expected_frame_count, ==, frame_count);
(*expected_frame_count)++;
- clutter_frame_clock_notify_presented (frame_clock, g_get_monotonic_time ());
+ init_frame_info (&frame_info, g_get_monotonic_time ());
+ clutter_frame_clock_notify_presented (frame_clock, &frame_info);
clutter_frame_clock_schedule_update (frame_clock);
return CLUTTER_FRAME_RESULT_PENDING_PRESENTED;
@@ -547,12 +563,14 @@ inhibit_frame_clock_frame (ClutterFrameClock *frame_clock,
gpointer user_data)
{
InhibitTest *test = user_data;
+ ClutterFrameInfo frame_info;
g_assert_cmpint (frame_count, ==, test->frame_count);
test->frame_count++;
- clutter_frame_clock_notify_presented (frame_clock, g_get_monotonic_time ());
+ init_frame_info (&frame_info, g_get_monotonic_time ());
+ clutter_frame_clock_notify_presented (frame_clock, &frame_info);
clutter_frame_clock_schedule_update (frame_clock);
if (test->pending_inhibit)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]