clutter: Add an lg command to set max render time constant

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1762>
This commit is contained in:
Ivan Molodetskikh 2020-11-28 22:15:02 +03:00 committed by Marge Bot
parent 565e34b4d2
commit f55c9af618
4 changed files with 16 additions and 6 deletions

View File

@ -41,6 +41,7 @@ G_BEGIN_DECLS
extern guint clutter_debug_flags; extern guint clutter_debug_flags;
extern guint clutter_pick_debug_flags; extern guint clutter_pick_debug_flags;
extern guint clutter_paint_debug_flags; extern guint clutter_paint_debug_flags;
extern int clutter_max_render_time_constant_us;
void _clutter_debug_messagev (const char *format, void _clutter_debug_messagev (const char *format,
va_list var_args) G_GNUC_PRINTF (1, 0); va_list var_args) G_GNUC_PRINTF (1, 0);

View File

@ -50,11 +50,6 @@ typedef struct _EstimateQueue
*/ */
#define SYNC_DELAY_FALLBACK_US ms2us (2) #define SYNC_DELAY_FALLBACK_US ms2us (2)
/* A constant added to heuristic max render time to account for variations
* in the estimates.
*/
#define MAX_RENDER_TIME_CONSTANT_US ms2us (2)
typedef struct _ClutterFrameListener typedef struct _ClutterFrameListener
{ {
const ClutterFrameListenerIface *iface; const ClutterFrameListenerIface *iface;
@ -340,7 +335,7 @@ clutter_frame_clock_compute_max_render_time_us (ClutterFrameClock *frame_clock)
max_dispatch_to_swap_us + max_dispatch_to_swap_us +
MAX (max_swap_to_rendering_done_us, max_swap_to_flip_us) + MAX (max_swap_to_rendering_done_us, max_swap_to_flip_us) +
frame_clock->vblank_duration_us + frame_clock->vblank_duration_us +
MAX_RENDER_TIME_CONSTANT_US; clutter_max_render_time_constant_us;
max_render_time_us = CLAMP (max_render_time_us, 0, refresh_interval_us); max_render_time_us = CLAMP (max_render_time_us, 0, refresh_interval_us);

View File

@ -95,6 +95,11 @@ guint clutter_debug_flags = 0;
guint clutter_paint_debug_flags = 0; guint clutter_paint_debug_flags = 0;
guint clutter_pick_debug_flags = 0; guint clutter_pick_debug_flags = 0;
/* A constant added to heuristic max render time to account for variations
* in the estimates.
*/
int clutter_max_render_time_constant_us = 2000;
#ifdef CLUTTER_ENABLE_DEBUG #ifdef CLUTTER_ENABLE_DEBUG
static const GDebugKey clutter_debug_keys[] = { static const GDebugKey clutter_debug_keys[] = {
{ "misc", CLUTTER_DEBUG_MISC }, { "misc", CLUTTER_DEBUG_MISC },
@ -2275,6 +2280,12 @@ clutter_remove_debug_flags (ClutterDebugFlag debug_flags,
clutter_pick_debug_flags &= ~pick_flags; clutter_pick_debug_flags &= ~pick_flags;
} }
void
clutter_debug_set_max_render_time_constant (int max_render_time_constant_us)
{
clutter_max_render_time_constant_us = max_render_time_constant_us;
}
void void
_clutter_set_sync_to_vblank (gboolean sync_to_vblank) _clutter_set_sync_to_vblank (gboolean sync_to_vblank)
{ {

View File

@ -198,6 +198,9 @@ void clutter_remove_debug_flags (ClutterDebugFla
ClutterDrawDebugFlag draw_flags, ClutterDrawDebugFlag draw_flags,
ClutterPickDebugFlag pick_flags); ClutterPickDebugFlag pick_flags);
CLUTTER_EXPORT
void clutter_debug_set_max_render_time_constant (int max_render_time_constant_us);
G_END_DECLS G_END_DECLS
#endif /* _CLUTTER_MAIN_H__ */ #endif /* _CLUTTER_MAIN_H__ */