[mutter/wip/frame-synchronization: 120/121] Distinguish "no delay" frames from spontaneous drawing
- From: Owen Taylor <otaylor src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/frame-synchronization: 120/121] Distinguish "no delay" frames from spontaneous drawing
- Date: Wed, 30 Jan 2013 20:50:19 +0000 (UTC)
commit cf725896354bfb2690d448b1cf3054927f6572ca
Author: Owen W. Taylor <otaylor fishsoup net>
Date: Thu Nov 15 17:49:57 2012 -0500
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
src/compositor/meta-window-actor.c | 6 ++++++
src/core/window-private.h | 5 +++++
src/core/window.c | 8 ++++++--
3 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index 93c9c67..4147784 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -2356,6 +2356,12 @@ meta_window_actor_handle_updates (MetaWindowActor *self)
priv->frames = g_list_prepend (priv->frames, frame);
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));
+ }
}
}
diff --git a/src/core/window-private.h b/src/core/window-private.h
index 06afdcf..c972e98 100644
--- a/src/core/window-private.h
+++ b/src/core/window-private.h
@@ -347,6 +347,11 @@ struct _MetaWindow
* last update the sync request counter */
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 */
GSList *struts;
diff --git a/src/core/window.c b/src/core/window.c
index 60bfa91..73aa0a9 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -9445,8 +9445,12 @@ void
meta_window_update_sync_request_counter (MetaWindow *window,
gint64 new_counter_value)
{
- if (window->extended_sync_request_counter)
- window->needs_frame_drawn = TRUE;
+ if (window->extended_sync_request_counter &&
+ 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;
meta_compositor_set_updates_frozen (window->display->compositor, window,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]