[Mesa-dev] Mesa (master): glx: Propagate failures from SendMakeCurrentRequest where possible

Ian Romanick idr at freedesktop.org
Fri Oct 25 20:28:30 CEST 2013


On 10/08/2013 10:24 AM, Adam Jackson wrote:
> Module: Mesa
> Branch: master
> Commit: d101204c23ba2f593881edeffff357309f3924cd
> URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d101204c23ba2f593881edeffff357309f3924cd
> 
> Author: Adam Jackson <ajax at redhat.com>
> Date:   Fri Oct  4 09:25:51 2013 -0400
> 
> glx: Propagate failures from SendMakeCurrentRequest where possible
> 
> Reviewed-by: Brian Paul <brianp at vmware.com>
> Signed-off-by: Adam Jackson <ajax at redhat.com>
> 
> ---
> 
>  src/glx/indirect_glx.c |    7 ++++---
>  1 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/src/glx/indirect_glx.c b/src/glx/indirect_glx.c
> index d0457fe..d27b019 100644
> --- a/src/glx/indirect_glx.c
> +++ b/src/glx/indirect_glx.c
> @@ -132,6 +132,7 @@ indirect_bind_context(struct glx_context *gc, struct glx_context *old,
>     __GLXattribute *state;
>     Display *dpy = gc->psc->dpy;
>     int opcode = __glXSetupForCommand(dpy);
> +   Bool ret;
>  
>     if (old != &dummyContext && !old->isDirect && old->psc->dpy == dpy) {
>        tag = old->currentContextTag;
> @@ -140,8 +141,8 @@ indirect_bind_context(struct glx_context *gc, struct glx_context *old,
>        tag = 0;
>     }
>  
> -   SendMakeCurrentRequest(dpy, opcode, gc->xid, tag, draw, read,
> -                          &gc->currentContextTag);
> +   ret = SendMakeCurrentRequest(dpy, opcode, gc->xid, tag, draw, read,
> +                                &gc->currentContextTag);
>  
>     if (!IndirectAPI)
>        IndirectAPI = __glXNewIndirectAPI();
> @@ -154,7 +155,7 @@ indirect_bind_context(struct glx_context *gc, struct glx_context *old,
>        __glXInitVertexArrayState(gc);
>     }
>  
> -   return Success;
> +   return ret;

This is completely wrong.  SendMakeCurrentRequest returns the value from
_XReply.  _XReply returns True on success, and False on failure.
However, Success is 0.  So now indirect_bind_context returns 1 (True)
every time it is successful, and the caller interprets that to mean
failure (non-Success).

This is the source of https://bugs.freedesktop.org/show_bug.cgi?id=70486

>  }
>  
>  static void
> 
> _______________________________________________
> mesa-commit mailing list
> mesa-commit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-commit



More information about the mesa-dev mailing list