mirror of
https://github.com/brl/mutter.git
synced 2025-07-03 09:43:18 +00:00
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:

committed by
Giovanni Campagna

parent
20cd02f086
commit
00a73c5bdc
@ -1516,19 +1516,26 @@ meta_display_get_current_time_roundtrip (MetaDisplay *display)
|
|||||||
{
|
{
|
||||||
guint32 timestamp;
|
guint32 timestamp;
|
||||||
|
|
||||||
timestamp = meta_display_get_current_time (display);
|
if (meta_is_wayland_compositor ())
|
||||||
if (timestamp == CurrentTime)
|
|
||||||
{
|
{
|
||||||
XEvent property_event;
|
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,
|
XChangeProperty (display->xdisplay, display->timestamp_pinging_window,
|
||||||
display->atom__MUTTER_TIMESTAMP_PING,
|
display->atom__MUTTER_TIMESTAMP_PING,
|
||||||
XA_STRING, 8, PropModeAppend, NULL, 0);
|
XA_STRING, 8, PropModeAppend, NULL, 0);
|
||||||
XIfEvent (display->xdisplay,
|
XIfEvent (display->xdisplay,
|
||||||
&property_event,
|
&property_event,
|
||||||
find_timestamp_predicate,
|
find_timestamp_predicate,
|
||||||
(XPointer) display);
|
(XPointer) display);
|
||||||
timestamp = property_event.xproperty.time;
|
timestamp = property_event.xproperty.time;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sanity_check_timestamps (display, timestamp);
|
sanity_check_timestamps (display, timestamp);
|
||||||
|
Reference in New Issue
Block a user