diff --git a/frontend/main.c b/frontend/main.c index c35a16077..2288b7778 100644 --- a/frontend/main.c +++ b/frontend/main.c @@ -4683,6 +4683,8 @@ wet_main(int argc, char *argv[], const struct weston_testsuite_data *test_data) weston_compositor_add_screenshot_authority(wet.compositor, &wet.screenshot_auth, screenshot_allow_all); + + weston_compositor_arm_surface_counter_fps(wet.compositor); } if (flight_rec) diff --git a/include/libweston/libweston.h b/include/libweston/libweston.h index c95287a6e..fd018714a 100644 --- a/include/libweston/libweston.h +++ b/include/libweston/libweston.h @@ -2896,6 +2896,12 @@ weston_output_set_vrr_mode(struct weston_output *output, uint32_t weston_output_get_supported_vrr_modes(struct weston_output *output); +void +weston_compositor_arm_surface_counter_fps(struct weston_compositor *ec); + +void +weston_compositor_disarm_surface_counter_fps(struct weston_compositor *ec); + #ifdef __cplusplus } #endif diff --git a/libweston/compositor.c b/libweston/compositor.c index 652517288..bf8620539 100644 --- a/libweston/compositor.c +++ b/libweston/compositor.c @@ -9718,11 +9718,23 @@ weston_compositor_create_surface_counter_fps(struct weston_compositor *ec, uint3 ec->perf_surface_stats.frame_counter_timer = wl_event_loop_add_timer(loop, surface_statistics_timer_handler, ec); +} +WL_EXPORT void +weston_compositor_arm_surface_counter_fps(struct weston_compositor *ec) +{ + assert(ec->perf_surface_stats.frame_counter_timer); wl_event_source_timer_update(ec->perf_surface_stats.frame_counter_timer, 1000 * ec->perf_surface_stats.frame_counter_interval); } +WL_EXPORT void +weston_compositor_disarm_surface_counter_fps(struct weston_compositor *ec) +{ + assert(ec->perf_surface_stats.frame_counter_timer); + wl_event_source_timer_update(ec->perf_surface_stats.frame_counter_timer, 0); +} + /** * Called when the 'scene-graph' debug scope is bound by a client. This * one-shot weston-debug scope prints the current scene graph when bound,