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
This commit is contained in:
Giovanni Campagna 2013-09-04 15:28:27 +02:00 committed by Giovanni Campagna
parent 20cd02f086
commit 00a73c5bdc

View File

@ -1516,6 +1516,12 @@ meta_display_get_current_time_roundtrip (MetaDisplay *display)
{
guint32 timestamp;
if (meta_is_wayland_compositor ())
{
timestamp = g_get_monotonic_time () / 1000;
}
else
{
timestamp = meta_display_get_current_time (display);
if (timestamp == CurrentTime)
{
@ -1530,6 +1536,7 @@ meta_display_get_current_time_roundtrip (MetaDisplay *display)
(XPointer) display);
timestamp = property_event.xproperty.time;
}
}
sanity_check_timestamps (display, timestamp);