From: Emil Velikov <emil.veli...@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: 563138298868 ("dri3: Add DRI3 extension")
Cc: Daniel Stone <dani...@collabora.com>
Cc: Keith Packard <kei...@keithp.com>
Signed-off-by: Emil Velikov <emil.veli...@collabora.com>
---
Note: we might want this in the stable releases?

Related: The DRI2 implementation has identical bug.
Although fixing that (unlike DRI3) might cause some ill written apps to
rightfully fall on their face.

Should we bother - yay, nay are appreciated.
---
 dri3/dri3_request.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/dri3/dri3_request.c b/dri3/dri3_request.c
index 7f3f0d08c..fc258711b 100644
--- a/dri3/dri3_request.c
+++ b/dri3/dri3_request.c
@@ -45,7 +45,19 @@ proc_dri3_query_version(ClientPtr client)
     };
 
     REQUEST_SIZE_MATCH(xDRI3QueryVersionReq);
-    (void) stuff;
+    /* From DRI3 proto:
+     *
+     * 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;
+    }
+
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
-- 
2.16.0

_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to