On 21 March 2018 at 08:02, Julien Cristau <[email protected]> wrote:
> On Mon, Mar 19, 2018 at 16:04:43 +0000, Emil Velikov wrote:
>
>> From: Emil Velikov <[email protected]>
>>
>> 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 <[email protected]>
>> Cc: Daniel Stone <[email protected]>
>> Cc: Keith Packard <[email protected]>
>> Signed-off-by: Emil Velikov <[email protected]>
>> ---
>> 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.
>> +     */
>> +
>> +    if (rep.majorVersion > stuff->majorVersion ||
>> +        rep.minorVersion > stuff->minorVersion) {
>> +        rep.majorVersion = stuff->majorVersion;
>> +        rep.minorVersion = stuff->minorVersion;
>> +    }
>
> Doesn't this break when e.g. client supports 2.2 and server supports
> 1.4, where we'll return 2.2 instead of 1.4?

Present has never bumped major, so things should be fine.
in fact only two extensions have done so - DRI2 and XFIXES - more
details on those below.

That said, I'll tweak the checks (this + dri3) to handle more corner
cases. The original issue was that server was returning greater
version than the one requested.

-Emil

DRI3 never saw a v1 release, while the history behind XFIXES is very
messy - here's a brief.

804a9fda12f70e66feac5e45bc8293a7e436689b
1.0 -> 2.0: introduced new events/requests, broke one existing event

f92db7128c857b3925846a9c8519e9554a1c67e2
no version change: _lots_ of breakage

2e9a7b2004d943eaf1be1778c94790528c573cb1
2.0 -> 4.0: introduced new events/requests, changed version meaning
major: incompatible -> new requests
minor: only BC changes -> only minor adjustments or BC changes

9760b4bdd1f9fdd6a33b9f876c4a835ed969aa84
4.0 -> 5.0: introduced new events/requests
_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to