From 77413ed9a0f52af49c58539c2c4caf513cf98c27 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Mon, 20 Nov 2023 07:28:34 +0400 Subject: [PATCH] clutter/frame-clock: Store output name Will be used in a subsequent commit for including the output name in COGL_TRACE plot names. Part-of: --- clutter/clutter/clutter-frame-clock.c | 7 +++++++ clutter/clutter/clutter-frame-clock.h | 1 + clutter/clutter/clutter-stage-view.c | 1 + src/tests/clutter/conform/frame-clock-timeline.c | 3 +++ src/tests/clutter/conform/frame-clock.c | 11 +++++++++++ 5 files changed, 23 insertions(+) diff --git a/clutter/clutter/clutter-frame-clock.c b/clutter/clutter/clutter-frame-clock.c index 656e07932..1a42c687d 100644 --- a/clutter/clutter/clutter-frame-clock.c +++ b/clutter/clutter/clutter-frame-clock.c @@ -110,6 +110,8 @@ struct _ClutterFrameClock int64_t missed_frame_report_time_us; int64_t last_dispatch_interval_us; + + char *output_name; }; G_DEFINE_TYPE (ClutterFrameClock, clutter_frame_clock, @@ -897,6 +899,7 @@ init_frame_clock_source (ClutterFrameClock *frame_clock) ClutterFrameClock * clutter_frame_clock_new (float refresh_rate, int64_t vblank_duration_us, + const char *output_name, const ClutterFrameListenerIface *iface, gpointer user_data) { @@ -914,6 +917,8 @@ clutter_frame_clock_new (float refresh_rate, clutter_frame_clock_set_refresh_rate (frame_clock, refresh_rate); frame_clock->vblank_duration_us = vblank_duration_us; + frame_clock->output_name = g_strdup (output_name); + return frame_clock; } @@ -938,6 +943,8 @@ clutter_frame_clock_dispose (GObject *object) g_clear_pointer (&frame_clock->source, g_source_unref); } + g_clear_pointer (&frame_clock->output_name, g_free); + G_OBJECT_CLASS (clutter_frame_clock_parent_class)->dispose (object); } diff --git a/clutter/clutter/clutter-frame-clock.h b/clutter/clutter/clutter-frame-clock.h index 93ebc9438..825776abe 100644 --- a/clutter/clutter/clutter-frame-clock.h +++ b/clutter/clutter/clutter-frame-clock.h @@ -57,6 +57,7 @@ typedef struct _ClutterFrameListenerIface CLUTTER_EXPORT ClutterFrameClock * clutter_frame_clock_new (float refresh_rate, int64_t vblank_duration_us, + const char *name, const ClutterFrameListenerIface *iface, gpointer user_data); diff --git a/clutter/clutter/clutter-stage-view.c b/clutter/clutter/clutter-stage-view.c index 7f2363794..ba7559a3d 100644 --- a/clutter/clutter/clutter-stage-view.c +++ b/clutter/clutter/clutter-stage-view.c @@ -1113,6 +1113,7 @@ clutter_stage_view_constructed (GObject *object) priv->frame_clock = clutter_frame_clock_new (priv->refresh_rate, priv->vblank_duration_us, + priv->name, &frame_clock_listener_iface, view); diff --git a/src/tests/clutter/conform/frame-clock-timeline.c b/src/tests/clutter/conform/frame-clock-timeline.c index b78021eac..6a98722d0 100644 --- a/src/tests/clutter/conform/frame-clock-timeline.c +++ b/src/tests/clutter/conform/frame-clock-timeline.c @@ -71,6 +71,7 @@ frame_clock_timeline_basic (void) main_loop = g_main_loop_new (NULL, FALSE); frame_clock = clutter_frame_clock_new (refresh_rate, 0, + NULL, &timeline_frame_listener_iface, NULL); g_object_add_weak_pointer (G_OBJECT (frame_clock), (gpointer *) &frame_clock); @@ -153,11 +154,13 @@ frame_clock_timeline_switch (void) frame_clock1 = clutter_frame_clock_new (refresh_rate, 0, + NULL, &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, + NULL, &timeline_frame_listener_iface, NULL); g_object_add_weak_pointer (G_OBJECT (frame_clock2), (gpointer *) &frame_clock2); diff --git a/src/tests/clutter/conform/frame-clock.c b/src/tests/clutter/conform/frame-clock.c index 3723bea3a..7522c7f8f 100644 --- a/src/tests/clutter/conform/frame-clock.c +++ b/src/tests/clutter/conform/frame-clock.c @@ -147,6 +147,7 @@ frame_clock_schedule_update (void) test.main_loop = g_main_loop_new (NULL, FALSE); frame_clock = clutter_frame_clock_new (refresh_rate, 0, + NULL, &frame_listener_iface, &test); @@ -234,6 +235,7 @@ frame_clock_immediate_present (void) main_loop = g_main_loop_new (NULL, FALSE); frame_clock = clutter_frame_clock_new (refresh_rate, 0, + NULL, &immediate_frame_listener_iface, main_loop); @@ -312,6 +314,7 @@ frame_clock_delayed_damage (void) test.main_loop = g_main_loop_new (NULL, FALSE); frame_clock = clutter_frame_clock_new (refresh_rate, 0, + NULL, &delayed_damage_frame_listener_iface, &test); @@ -372,6 +375,7 @@ frame_clock_no_damage (void) main_loop = g_main_loop_new (NULL, FALSE); frame_clock = clutter_frame_clock_new (refresh_rate, 0, + NULL, &no_damage_frame_listener_iface, NULL); @@ -459,6 +463,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, + NULL, &update_now_frame_listener_iface, &test); @@ -541,6 +546,7 @@ frame_clock_before_frame (void) main_loop = g_main_loop_new (NULL, FALSE); frame_clock = clutter_frame_clock_new (refresh_rate, 0, + NULL, &before_frame_frame_listener_iface, &expected_frame_count); @@ -622,6 +628,7 @@ frame_clock_inhibit (void) test.main_loop = g_main_loop_new (NULL, FALSE); test.frame_clock = clutter_frame_clock_new (refresh_rate, 0, + NULL, &inhibit_frame_listener_iface, &test); @@ -685,6 +692,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, + NULL, &reschedule_on_idle_listener_iface, &test); fake_hw_clock = fake_hw_clock_new (frame_clock, NULL, NULL); @@ -722,6 +730,7 @@ frame_clock_destroy_signal (void) frame_clock = clutter_frame_clock_new (refresh_rate, 0, + NULL, &dummy_frame_listener_iface, NULL); @@ -741,6 +750,7 @@ frame_clock_destroy_signal (void) frame_clock = clutter_frame_clock_new (refresh_rate, 0, + NULL, &dummy_frame_listener_iface, NULL); frame_clock_backup = frame_clock; @@ -811,6 +821,7 @@ frame_clock_notify_ready (void) main_loop = g_main_loop_new (NULL, FALSE); frame_clock = clutter_frame_clock_new (refresh_rate, 0, + NULL, &frame_clock_ready_listener_iface, main_loop);