[PATCH xserver v2 22/22] xwayland: Guard against very late vblanks

Roman Gilg subdiff at gmail.com
Wed Feb 28 16:37:04 UTC 2018

Do not allow queuing events too far into the the future. The result can be a
presentation freeze until the msc time is reached.

At the moment clients might do this per accident, because the fake vblank code
in Present and the xfree86 driver tolerate high 64bit msc values without
freeze due to an erroneous 64 to 32bit conversion.

The sample client, that triggers this behavior, is the Steam client.

Signed-off-by: Roman Gilg <subdiff at gmail.com>
 hw/xwayland/xwayland-present.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/hw/xwayland/xwayland-present.c b/hw/xwayland/xwayland-present.c
index 27bc569..c0bc1f0 100644
--- a/hw/xwayland/xwayland-present.c
+++ b/hw/xwayland/xwayland-present.c
@@ -303,6 +303,11 @@ xwl_present_queue_vblank(WindowPtr present_window,
     if (!xwl_window)
         return BadMatch;
+    if (msc > xwl_window->present_msc + 100) {
+        ErrorF("Client queued frame too far in the future: %lu -> %lu\n", xwl_window->present_msc, msc);
+        return BadRequest;
+    }
     if (xwl_window->present_crtc_fake != crtc)
         return BadRequest;

More information about the xorg-devel mailing list