[mutter/wip/wayland-work: 16/22] display: shortcut get_time_roundtrip() when running as a wayland compositor
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/wayland-work: 16/22] display: shortcut get_time_roundtrip() when running as a wayland compositor
- Date: Mon, 9 Sep 2013 13:41:57 +0000 (UTC)
commit 1925c73640214ed6c505065b152343eb7475244f
Author: Giovanni Campagna <gcampagn redhat com>
Date: Wed Sep 4 15:28:27 2013 +0200
display: shortcut get_time_roundtrip() when running as a wayland compositor
In wayland, we can make some assumptions about the behavior and
configuration of the X server (which is Xwayland), including on
the time it uses, and that way avoiding a roundtrip (potentially deadly, if
by chance the X server is also blocking on us or needs us to flush
the wayland socket buffer).
Note that we bypass get_current_time() entirely, as it is assumed
the function is called always to translated CurrentTime into a real
value.
https://bugzilla.gnome.org/show_bug.cgi?id=707466
src/core/display.c | 33 ++++++++++++++++++++-------------
1 files changed, 20 insertions(+), 13 deletions(-)
---
diff --git a/src/core/display.c b/src/core/display.c
index 6636932..e5f8009 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -1507,20 +1507,27 @@ guint32
meta_display_get_current_time_roundtrip (MetaDisplay *display)
{
guint32 timestamp;
-
- timestamp = meta_display_get_current_time (display);
- if (timestamp == CurrentTime)
+
+ if (meta_is_wayland_compositor ())
{
- XEvent property_event;
-
- XChangeProperty (display->xdisplay, display->timestamp_pinging_window,
- display->atom__MUTTER_TIMESTAMP_PING,
- XA_STRING, 8, PropModeAppend, NULL, 0);
- XIfEvent (display->xdisplay,
- &property_event,
- find_timestamp_predicate,
- (XPointer) display);
- timestamp = property_event.xproperty.time;
+ timestamp = g_get_monotonic_time () / 1000;
+ }
+ else
+ {
+ timestamp = meta_display_get_current_time (display);
+ if (timestamp == CurrentTime)
+ {
+ XEvent property_event;
+
+ XChangeProperty (display->xdisplay, display->timestamp_pinging_window,
+ display->atom__MUTTER_TIMESTAMP_PING,
+ XA_STRING, 8, PropModeAppend, NULL, 0);
+ XIfEvent (display->xdisplay,
+ &property_event,
+ find_timestamp_predicate,
+ (XPointer) display);
+ timestamp = property_event.xproperty.time;
+ }
}
sanity_check_timestamps (display, timestamp);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]