From fe4aae0e6ad395ef48c2f710c3deb51a0b769000 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Wed, 9 Aug 2017 11:00:16 +0200 Subject: [PATCH] glx: Work around X servers reporting bogus values of GLX_SWAP_METHOD_OML MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Due to the recently fixed bug where dri drivers didn't report a correct __DRI_ATTRIB_SWAP_METHOD value, and the fact that X servers just forward this incorrect value (from the AIGLX dri driver) untranslated as GLX_SWAP_METHOD_OML, the latter value might be undefined when old dri AIGLX drivers are used, which breaks client fbconfig matching with server fbconfigs. So work around this by assuming GLX_SWAP_METHOD_UNDEFINED when a bogus value is read. Signed-off-by: Thomas Hellstrom Reviewed-by: Brian Paul Reviewed-by: Michel Dänzer --- src/glx/glxext.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/glx/glxext.c b/src/glx/glxext.c index 9ef7ff5f694..9cbe3347723 100644 --- a/src/glx/glxext.c +++ b/src/glx/glxext.c @@ -524,7 +524,17 @@ __glXInitializeVisualConfigFromTags(struct glx_config * config, int count, config->visualSelectGroup = *bp++; break; case GLX_SWAP_METHOD_OML: - config->swapMethod = *bp++; + if (*bp == GLX_SWAP_UNDEFINED_OML || + *bp == GLX_SWAP_COPY_OML || + *bp == GLX_SWAP_EXCHANGE_OML) { + config->swapMethod = *bp++; + } else { + /* X servers with old HW drivers may return any value here, so + * assume GLX_SWAP_METHOD_UNDEFINED. + */ + config->swapMethod = GLX_SWAP_UNDEFINED_OML; + bp++; + } break; #endif case GLX_SAMPLE_BUFFERS_SGIS: -- 2.30.2