[PATCH xserver] present: cap the version returned to the client

Walter Harms wharms at bfs.de
Mon Mar 19 16:57:46 UTC 2018



> Emil Velikov <emil.l.velikov at gmail.com> hat am 19. März 2018 um 17:04
> geschrieben:
> 
> 
> From: Emil Velikov <emil.velikov at collabora.com>
> 
> As per the protocol, the server should not return version greater than
> the one supported by the client.
> 
> Add a spec quote and tweak the numbers accordingly.
> 
> Fixes: 5c5c1b77982 ("present: Add Present extension")
> Cc: Thierry Reding <treding at nvidia.com>
> Cc: Daniel Stone <daniels at collabora.com>
> Cc: Keith Packard <keithp at keithp.com>
> Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
> ---
> Analogous to the DRI3 patch here
> https://patchwork.freedesktop.org/patch/210343/
> ---
>  present/present_request.c | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/present/present_request.c b/present/present_request.c
> index c6afe5fa7..f52efa52b 100644
> --- a/present/present_request.c
> +++ b/present/present_request.c
> @@ -41,7 +41,19 @@ proc_present_query_version(ClientPtr client)
>      };
>  
>      REQUEST_SIZE_MATCH(xPresentQueryVersionReq);
> -    (void) stuff;
> +    /* From presentproto:
> +     *
> +     * The client sends the highest supported version to the server
> +     * and the server sends the highest version it supports, but no
> +     * higher than the requested version.
> +     */

Alternativ wording:
    /*
     * The client sends the highest supported version to the server
     * and the server replies with less or equal the requested version    
     * what ever is supported.
     */

I would suggest to avoid "no" as people tend to skip these tiny word.
Simply saying "less or equal the requested version" make thinks clear.
Maybe some native has a better wording (if that is good it should go to
presentproto also).

re,
 wh

> +
> +    if (rep.majorVersion > stuff->majorVersion ||
> +        rep.minorVersion > stuff->minorVersion) {
> +        rep.majorVersion = stuff->majorVersion;
> +        rep.minorVersion = stuff->minorVersion;
> +    }
> +
>      if (client->swapped) {
>          swaps(&rep.sequenceNumber);
>          swapl(&rep.length);
> -- 
> 2.16.0
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: https://lists.x.org/mailman/listinfo/xorg-devel


More information about the xorg-devel mailing list