[Mesa-dev] [PATCH 2/6] glx: Use __glXSendError instead of open-coding it

Ian Romanick idr at freedesktop.org
Tue Nov 14 21:10:32 UTC 2017


This patch is

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

On 11/14/2017 12:13 PM, Adam Jackson wrote:
> This also fixes a bug, the error path through MakeCurrent didn't
> translate the error code by the extension's error base.
> 
> Signed-off-by: Adam Jackson <ajax at redhat.com>
> ---
>  src/glx/glxcmds.c    | 10 +---------
>  src/glx/glxcurrent.c | 20 +++-----------------
>  2 files changed, 4 insertions(+), 26 deletions(-)
> 
> diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
> index bc93d62510..eee45d962d 100644
> --- a/src/glx/glxcmds.c
> +++ b/src/glx/glxcmds.c
> @@ -392,15 +392,7 @@ glXCreateContext(Display * dpy, XVisualInfo * vis,
>        config = glx_config_find_visual(psc->visuals, vis->visualid);
>  
>     if (config == NULL) {
> -      xError error;
> -
> -      error.errorCode = BadValue;
> -      error.resourceID = vis->visualid;
> -      error.sequenceNumber = dpy->request;
> -      error.type = X_Error;
> -      error.majorCode = __glXSetupForCommand(dpy);
> -      error.minorCode = X_GLXCreateContext;
> -      _XError(dpy, &error);
> +      __glXSendError(dpy, BadValue, vis->visualid, X_GLXCreateContext, True);
>        return None;
>     }
>  
> diff --git a/src/glx/glxcurrent.c b/src/glx/glxcurrent.c
> index d1193265f9..fd04929b89 100644
> --- a/src/glx/glxcurrent.c
> +++ b/src/glx/glxcurrent.c
> @@ -36,8 +36,8 @@
>  #include <pthread.h>
>  
>  #include "glxclient.h"
> -
>  #include "glapi.h"
> +#include "glx_error.h"
>  
>  /*
>  ** We setup some dummy structures here so that the API can be used
> @@ -165,21 +165,6 @@ glXGetCurrentDrawable(void)
>     return gc->currentDrawable;
>  }
>  
> -static void
> -__glXGenerateError(Display * dpy, XID resource,
> -                   BYTE errorCode, CARD16 minorCode)
> -{
> -   xError error;
> -
> -   error.errorCode = errorCode;
> -   error.resourceID = resource;
> -   error.sequenceNumber = dpy->request;
> -   error.type = X_Error;
> -   error.majorCode = __glXSetupForCommand(dpy);
> -   error.minorCode = minorCode;
> -   _XError(dpy, &error);
> -}
> -
>  /**
>   * Make a particular context current.
>   *
> @@ -228,7 +213,8 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
>        if (gc->vtable->bind(gc, oldGC, draw, read) != Success) {
>           __glXSetCurrentContextNull();
>           __glXUnlock();
> -         __glXGenerateError(dpy, None, GLXBadContext, X_GLXMakeContextCurrent);
> +         __glXSendError(dpy, GLXBadContext, None, X_GLXMakeContextCurrent,
> +                        False);
>           return GL_FALSE;
>        }
>  
> 



More information about the mesa-dev mailing list