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

Michel Dänzer michel at daenzer.net
Wed Feb 28 17:43:13 UTC 2018


On 2018-02-28 05:37 PM, Roman Gilg wrote:
> 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.

I'm unable to reproduce the issue you described with Steam (without this
patch series applied). I'd really like to know where the bogus target
MSC values you're seeing are coming from. What are the values of the
window_msc parameter and window_priv->msc_offset in
present_window_to_crtc_msc?


> 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 we're going this route, let's not use an arbitrary threshold like
100, but the actual one corresponding to the fake vblank code dropping
the most significant bits.


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer


More information about the xorg-devel mailing list