770230aab1
When the server doesn't support indirect contexts it will generate a BadValue error, since the CreateContext request's isDirect field will have specified an unsupported value of False. We attempt to verify that context creation succeeded by asking whether the context's XID is direct or not after we create it. Due to the details of XCB error handling, if the context wasn't successfully created, the GLXBadContext error from the GLXIsDirect request will get raised first, hiding the BadValue from the application. To fix this, we change the behavior of __glXIsDirect based on the `error` outparameter. If it is NULL we still raise the error generated from the GLXIsDirect request, but if it is non-NULL we now just inform the caller that the request failed and silently eat the error. By doing this the BadValue (or whatever else) from the CreateContext request will bubble up to the application as expected. This is admittedly a bit subtle but it's the simplest way to get to the fix here. A better solution would be to convert all of CreateContext to XCB, but XCB doesn't have protocol for GLX_SGIX_fbconfig yet so we'd lose glXCreateContextWithConfigSGIX. Fixes: mesa/mesa#3907 Acked-by: Michel Dänzer <mdaenzer@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7859>