From 290f48f29a561117709c63cf98459690369e7ef7 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Thu, 21 Mar 2019 11:25:48 +0000 Subject: [PATCH] Replace CLUTTER_SHOW_FPS by a proper debug flag Instead of CLUTTER_SHOW_FPS=1, it should be passed now CLUTTER_DEBUG=frame-time. Also remove the legacy code related to the FPS counter. https://gitlab.gnome.org/GNOME/mutter/merge_requests/502 --- clutter/clutter/clutter-debug.h | 3 +- clutter/clutter/clutter-main.c | 49 +---------------------- clutter/clutter/clutter-private.h | 2 - clutter/clutter/clutter-stage.c | 4 +- clutter/clutter/deprecated/clutter-main.h | 3 -- 5 files changed, 5 insertions(+), 56 deletions(-) diff --git a/clutter/clutter/clutter-debug.h b/clutter/clutter/clutter-debug.h index 2462385f6..e32a04ba5 100644 --- a/clutter/clutter/clutter-debug.h +++ b/clutter/clutter/clutter-debug.h @@ -24,7 +24,8 @@ typedef enum CLUTTER_DEBUG_PICK = 1 << 13, CLUTTER_DEBUG_EVENTLOOP = 1 << 14, CLUTTER_DEBUG_CLIPPING = 1 << 15, - CLUTTER_DEBUG_OOB_TRANSFORMS = 1 << 16 + CLUTTER_DEBUG_OOB_TRANSFORMS = 1 << 16, + CLUTTER_DEBUG_FRAME_TIME = 1 << 17, } ClutterDebugFlag; typedef enum diff --git a/clutter/clutter/clutter-main.c b/clutter/clutter/clutter-main.c index 71ec0d80c..259b53093 100644 --- a/clutter/clutter/clutter-main.c +++ b/clutter/clutter/clutter-main.c @@ -89,7 +89,6 @@ static GCallback clutter_threads_unlock = NULL; /* command line options */ static gboolean clutter_is_initialized = FALSE; -static gboolean clutter_show_fps = FALSE; static gboolean clutter_fatal_warnings = FALSE; static gboolean clutter_disable_mipmap_text = FALSE; static gboolean clutter_use_fuzzy_picking = FALSE; @@ -125,6 +124,7 @@ static const GDebugKey clutter_debug_keys[] = { { "layout", CLUTTER_DEBUG_LAYOUT }, { "clipping", CLUTTER_DEBUG_CLIPPING }, { "oob-transforms", CLUTTER_DEBUG_OOB_TRANSFORMS }, + { "frame-time", CLUTTER_DEBUG_FRAME_TIME }, }; #endif /* CLUTTER_ENABLE_DEBUG */ @@ -204,16 +204,6 @@ clutter_config_read_from_key_file (GKeyFile *keyfile) g_free (str_value); - bool_value = - g_key_file_get_boolean (keyfile, ENVIRONMENT_GROUP, - "ShowFps", - &key_error); - - if (key_error != NULL) - g_clear_error (&key_error); - else - clutter_show_fps = bool_value; - bool_value = g_key_file_get_boolean (keyfile, ENVIRONMENT_GROUP, "DisableMipmappedText", @@ -382,36 +372,6 @@ clutter_config_read (void) g_free (config_path); } -/** - * clutter_get_show_fps: - * - * Returns whether Clutter should print out the frames per second on the - * console. You can enable this setting either using the - * CLUTTER_SHOW_FPS environment variable or passing - * the --clutter-show-fps command line argument. * - * - * Return value: %TRUE if Clutter should show the FPS. - * - * Since: 0.4 - * - * Deprecated: 1.10: This function does not do anything. Use the environment - * variable or the configuration file to determine whether Clutter should - * print out the FPS counter on the console. - */ -gboolean -clutter_get_show_fps (void) -{ - return FALSE; -} - -gboolean -_clutter_context_get_show_fps (void) -{ - ClutterMainContext *context = _clutter_context_get_default (); - - return context->show_fps; -} - /** * clutter_get_accessibility_enabled: * @@ -1370,8 +1330,6 @@ clutter_init_real (GError **error) } static GOptionEntry clutter_args[] = { - { "clutter-show-fps", 0, 0, G_OPTION_ARG_NONE, &clutter_show_fps, - N_("Show frames per second"), NULL }, { "clutter-default-fps", 0, 0, G_OPTION_ARG_INT, &clutter_default_fps, N_("Default frame rate"), "FPS" }, { "g-fatal-warnings", 0, 0, G_OPTION_ARG_NONE, &clutter_fatal_warnings, @@ -1450,10 +1408,6 @@ pre_parse_hook (GOptionContext *context, env_string = NULL; } - env_string = g_getenv ("CLUTTER_SHOW_FPS"); - if (env_string) - clutter_show_fps = TRUE; - env_string = g_getenv ("CLUTTER_DEFAULT_FPS"); if (env_string) { @@ -1502,7 +1456,6 @@ post_parse_hook (GOptionContext *context, } clutter_context->frame_rate = clutter_default_fps; - clutter_context->show_fps = clutter_show_fps; clutter_context->options_parsed = TRUE; /* If not asked to defer display setup, call clutter_init_real(), diff --git a/clutter/clutter/clutter-private.h b/clutter/clutter/clutter-private.h index a5cd1fa19..a60144239 100644 --- a/clutter/clutter/clutter-private.h +++ b/clutter/clutter/clutter-private.h @@ -176,7 +176,6 @@ struct _ClutterMainContext guint motion_events_per_actor : 1; guint defer_display_setup : 1; guint options_parsed : 1; - guint show_fps : 1; }; /* shared between clutter-main.c and clutter-frame-source.c */ @@ -202,7 +201,6 @@ void _clutter_context_push_shader_stack (Clutter ClutterActor * _clutter_context_pop_shader_stack (ClutterActor *actor); ClutterActor * _clutter_context_peek_shader_stack (void); gboolean _clutter_context_get_motion_events_enabled (void); -gboolean _clutter_context_get_show_fps (void); gboolean _clutter_feature_init (GError **error); diff --git a/clutter/clutter/clutter-stage.c b/clutter/clutter/clutter-stage.c index 1eea5b305..44565cf85 100644 --- a/clutter/clutter/clutter-stage.c +++ b/clutter/clutter/clutter-stage.c @@ -1118,7 +1118,7 @@ clutter_stage_do_redraw (ClutterStage *stage) _clutter_actor_get_debug_name (actor), stage); - if (_clutter_context_get_show_fps ()) + if (CLUTTER_HAS_DEBUG (FRAME_TIME)) { if (priv->fps_timer == NULL) priv->fps_timer = g_timer_new (); @@ -1126,7 +1126,7 @@ clutter_stage_do_redraw (ClutterStage *stage) _clutter_stage_window_redraw (priv->impl); - if (_clutter_context_get_show_fps ()) + if (CLUTTER_HAS_DEBUG (FRAME_TIME)) { priv->timer_n_frames += 1; diff --git a/clutter/clutter/deprecated/clutter-main.h b/clutter/clutter/deprecated/clutter-main.h index a2e8d9c72..eb0d95fee 100644 --- a/clutter/clutter/deprecated/clutter-main.h +++ b/clutter/clutter/deprecated/clutter-main.h @@ -77,9 +77,6 @@ gulong clutter_get_timestamp (void); CLUTTER_DEPRECATED gboolean clutter_get_debug_enabled (void); -CLUTTER_DEPRECATED -gboolean clutter_get_show_fps (void); - G_END_DECLS #endif /* __CLUTTER_MAIN_DEPRECATED_H__ */