mirror of
https://github.com/brl/mutter.git
synced 2024-12-26 21:02:14 +00:00
clutter/frame-clock: Avoid rapidly toggling dynamic max render time
This could happen when moving the cursor over GUIs that only redraw in response to cursor movement. Mutter would experience alternating cursor-only updates and page flips, and so the `max_render_time_allowed_us` would jump between pessimised and optimised resulting in inconsistent frame pacing. Aside from fixing the smoothness problem this should also provide lower latency cursor movement. Fixes: https://launchpad.net/bugs/2023766 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3074>
This commit is contained in:
parent
5e5065c2b5
commit
be0aa2976e
@ -105,6 +105,7 @@ struct _ClutterFrameClock
|
|||||||
|
|
||||||
/* If we got new measurements last frame. */
|
/* If we got new measurements last frame. */
|
||||||
gboolean got_measurements_last_frame;
|
gboolean got_measurements_last_frame;
|
||||||
|
gboolean ever_got_measurements;
|
||||||
|
|
||||||
gboolean pending_reschedule;
|
gboolean pending_reschedule;
|
||||||
gboolean pending_reschedule_now;
|
gboolean pending_reschedule_now;
|
||||||
@ -349,6 +350,7 @@ clutter_frame_clock_notify_presented (ClutterFrameClock *frame_clock,
|
|||||||
MAX (frame_clock->shortterm.max_swap_to_flip_us, swap_to_flip_us);
|
MAX (frame_clock->shortterm.max_swap_to_flip_us, swap_to_flip_us);
|
||||||
|
|
||||||
frame_clock->got_measurements_last_frame = TRUE;
|
frame_clock->got_measurements_last_frame = TRUE;
|
||||||
|
frame_clock->ever_got_measurements = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -423,7 +425,7 @@ clutter_frame_clock_compute_max_render_time_us (ClutterFrameClock *frame_clock)
|
|||||||
|
|
||||||
refresh_interval_us = frame_clock->refresh_interval_us;
|
refresh_interval_us = frame_clock->refresh_interval_us;
|
||||||
|
|
||||||
if (!frame_clock->got_measurements_last_frame ||
|
if (!frame_clock->ever_got_measurements ||
|
||||||
G_UNLIKELY (clutter_paint_debug_flags &
|
G_UNLIKELY (clutter_paint_debug_flags &
|
||||||
CLUTTER_DEBUG_DISABLE_DYNAMIC_MAX_RENDER_TIME))
|
CLUTTER_DEBUG_DISABLE_DYNAMIC_MAX_RENDER_TIME))
|
||||||
return refresh_interval_us * SYNC_DELAY_FALLBACK_FRACTION;
|
return refresh_interval_us * SYNC_DELAY_FALLBACK_FRACTION;
|
||||||
|
Loading…
Reference in New Issue
Block a user