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
This commit is contained in:
Georges Basile Stavracas Neto 2019-03-21 11:25:48 +00:00
parent 22884b0b00
commit 290f48f29a
No known key found for this signature in database
GPG Key ID: 886C17EE170D1385
5 changed files with 5 additions and 56 deletions

View File

@ -24,7 +24,8 @@ typedef enum
CLUTTER_DEBUG_PICK = 1 << 13, CLUTTER_DEBUG_PICK = 1 << 13,
CLUTTER_DEBUG_EVENTLOOP = 1 << 14, CLUTTER_DEBUG_EVENTLOOP = 1 << 14,
CLUTTER_DEBUG_CLIPPING = 1 << 15, CLUTTER_DEBUG_CLIPPING = 1 << 15,
CLUTTER_DEBUG_OOB_TRANSFORMS = 1 << 16 CLUTTER_DEBUG_OOB_TRANSFORMS = 1 << 16,
CLUTTER_DEBUG_FRAME_TIME = 1 << 17,
} ClutterDebugFlag; } ClutterDebugFlag;
typedef enum typedef enum

View File

@ -89,7 +89,6 @@ static GCallback clutter_threads_unlock = NULL;
/* command line options */ /* command line options */
static gboolean clutter_is_initialized = FALSE; static gboolean clutter_is_initialized = FALSE;
static gboolean clutter_show_fps = FALSE;
static gboolean clutter_fatal_warnings = FALSE; static gboolean clutter_fatal_warnings = FALSE;
static gboolean clutter_disable_mipmap_text = FALSE; static gboolean clutter_disable_mipmap_text = FALSE;
static gboolean clutter_use_fuzzy_picking = FALSE; static gboolean clutter_use_fuzzy_picking = FALSE;
@ -125,6 +124,7 @@ static const GDebugKey clutter_debug_keys[] = {
{ "layout", CLUTTER_DEBUG_LAYOUT }, { "layout", CLUTTER_DEBUG_LAYOUT },
{ "clipping", CLUTTER_DEBUG_CLIPPING }, { "clipping", CLUTTER_DEBUG_CLIPPING },
{ "oob-transforms", CLUTTER_DEBUG_OOB_TRANSFORMS }, { "oob-transforms", CLUTTER_DEBUG_OOB_TRANSFORMS },
{ "frame-time", CLUTTER_DEBUG_FRAME_TIME },
}; };
#endif /* CLUTTER_ENABLE_DEBUG */ #endif /* CLUTTER_ENABLE_DEBUG */
@ -204,16 +204,6 @@ clutter_config_read_from_key_file (GKeyFile *keyfile)
g_free (str_value); 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 = bool_value =
g_key_file_get_boolean (keyfile, ENVIRONMENT_GROUP, g_key_file_get_boolean (keyfile, ENVIRONMENT_GROUP,
"DisableMipmappedText", "DisableMipmappedText",
@ -382,36 +372,6 @@ clutter_config_read (void)
g_free (config_path); 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
* <literal>CLUTTER_SHOW_FPS</literal> environment variable or passing
* the <literal>--clutter-show-fps</literal> 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: * clutter_get_accessibility_enabled:
* *
@ -1370,8 +1330,6 @@ clutter_init_real (GError **error)
} }
static GOptionEntry clutter_args[] = { 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, { "clutter-default-fps", 0, 0, G_OPTION_ARG_INT, &clutter_default_fps,
N_("Default frame rate"), "FPS" }, N_("Default frame rate"), "FPS" },
{ "g-fatal-warnings", 0, 0, G_OPTION_ARG_NONE, &clutter_fatal_warnings, { "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 = NULL;
} }
env_string = g_getenv ("CLUTTER_SHOW_FPS");
if (env_string)
clutter_show_fps = TRUE;
env_string = g_getenv ("CLUTTER_DEFAULT_FPS"); env_string = g_getenv ("CLUTTER_DEFAULT_FPS");
if (env_string) if (env_string)
{ {
@ -1502,7 +1456,6 @@ post_parse_hook (GOptionContext *context,
} }
clutter_context->frame_rate = clutter_default_fps; clutter_context->frame_rate = clutter_default_fps;
clutter_context->show_fps = clutter_show_fps;
clutter_context->options_parsed = TRUE; clutter_context->options_parsed = TRUE;
/* If not asked to defer display setup, call clutter_init_real(), /* If not asked to defer display setup, call clutter_init_real(),

View File

@ -176,7 +176,6 @@ struct _ClutterMainContext
guint motion_events_per_actor : 1; guint motion_events_per_actor : 1;
guint defer_display_setup : 1; guint defer_display_setup : 1;
guint options_parsed : 1; guint options_parsed : 1;
guint show_fps : 1;
}; };
/* shared between clutter-main.c and clutter-frame-source.c */ /* 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_pop_shader_stack (ClutterActor *actor);
ClutterActor * _clutter_context_peek_shader_stack (void); ClutterActor * _clutter_context_peek_shader_stack (void);
gboolean _clutter_context_get_motion_events_enabled (void); gboolean _clutter_context_get_motion_events_enabled (void);
gboolean _clutter_context_get_show_fps (void);
gboolean _clutter_feature_init (GError **error); gboolean _clutter_feature_init (GError **error);

View File

@ -1118,7 +1118,7 @@ clutter_stage_do_redraw (ClutterStage *stage)
_clutter_actor_get_debug_name (actor), _clutter_actor_get_debug_name (actor),
stage); stage);
if (_clutter_context_get_show_fps ()) if (CLUTTER_HAS_DEBUG (FRAME_TIME))
{ {
if (priv->fps_timer == NULL) if (priv->fps_timer == NULL)
priv->fps_timer = g_timer_new (); priv->fps_timer = g_timer_new ();
@ -1126,7 +1126,7 @@ clutter_stage_do_redraw (ClutterStage *stage)
_clutter_stage_window_redraw (priv->impl); _clutter_stage_window_redraw (priv->impl);
if (_clutter_context_get_show_fps ()) if (CLUTTER_HAS_DEBUG (FRAME_TIME))
{ {
priv->timer_n_frames += 1; priv->timer_n_frames += 1;

View File

@ -77,9 +77,6 @@ gulong clutter_get_timestamp (void);
CLUTTER_DEPRECATED CLUTTER_DEPRECATED
gboolean clutter_get_debug_enabled (void); gboolean clutter_get_debug_enabled (void);
CLUTTER_DEPRECATED
gboolean clutter_get_show_fps (void);
G_END_DECLS G_END_DECLS
#endif /* __CLUTTER_MAIN_DEPRECATED_H__ */ #endif /* __CLUTTER_MAIN_DEPRECATED_H__ */