Distinguish "no delay" frames from spontaneous drawing

When a client is drawing as hard as possible (without sleeping
between frames) we need to draw as soon possible, since sleeping
will decrease the effective frame rate shown to the user, and
can also result in the system never kicking out of power-saving
mode because it doesn't look fully utilized.

Use the amount the client increments the counter value by when
ending the frame to distinguish these cases:

 - Increment by 1: a no-delay frame
 - Increment by more than 1: a non-urgent frame, handle normally

https://bugzilla.gnome.org/show_bug.cgi?id=685463
This commit is contained in:
Owen W. Taylor 2012-11-15 17:49:57 -05:00
parent 2d9b8bb2d0
commit 87fe9685b5
3 changed files with 17 additions and 2 deletions

View File

@ -2355,6 +2355,12 @@ meta_window_actor_handle_updates (MetaWindowActor *self)
priv->frames = g_list_prepend (priv->frames, frame); priv->frames = g_list_prepend (priv->frames, frame);
priv->window->needs_frame_drawn = FALSE; priv->window->needs_frame_drawn = FALSE;
if (priv->window->no_delay_frame)
{
ClutterActor *stage = clutter_actor_get_stage (CLUTTER_ACTOR (self));
clutter_stage_skip_sync_delay (CLUTTER_STAGE (stage));
}
} }
} }

View File

@ -360,6 +360,11 @@ struct _MetaWindow
* last update the sync request counter */ * last update the sync request counter */
guint needs_frame_drawn : 1; guint needs_frame_drawn : 1;
/* if TRUE, the frame that was just drawn was drawn without any delay
* on the client's part and thus is high-priority - if we add delay
* we might cause the client to miss it's target frame rate */
guint no_delay_frame : 1;
/* Note: can be NULL */ /* Note: can be NULL */
GSList *struts; GSList *struts;

View File

@ -9509,8 +9509,12 @@ void
meta_window_update_sync_request_counter (MetaWindow *window, meta_window_update_sync_request_counter (MetaWindow *window,
gint64 new_counter_value) gint64 new_counter_value)
{ {
if (window->extended_sync_request_counter) if (window->extended_sync_request_counter &&
window->needs_frame_drawn = TRUE; new_counter_value % 2 == 0)
{
window->needs_frame_drawn = TRUE;
window->no_delay_frame = new_counter_value == window->sync_request_serial + 1;
}
window->sync_request_serial = new_counter_value; window->sync_request_serial = new_counter_value;
meta_compositor_set_updates_frozen (window->display->compositor, window, meta_compositor_set_updates_frozen (window->display->compositor, window,