[Mesa-dev] [PATCH] mesa: fold _glapi_check_multithread() back into _mesa_make_current

Brian Paul brianp at vmware.com
Thu Sep 6 14:44:17 UTC 2018


Reviewed-by: Brian Paul <brianp at vmware.com>

On 09/05/2018 10:09 AM, Emil Velikov wrote:
> From: Emil Velikov <emil.velikov at collabora.com>
> 
> With commit c6c0f947142, back in 2006 Brian removed the
> _glapi_check_multithread() call from core mesa - _mesa_make_current.
> 
> It was done to remove fairly awkward #ifdef guard which caused subtle
> differences in core mesa.
> 
> Since that guard is long gone, we can drop the duplication and
> reintroduce the call in core.
> 
> Note that the function is was missing when using EGL + classic dri HW
> drivers. Yet on TLS builds it's a no-op, so we're safe.
> 
> Any non TLS users - more or less anything !Linux (or even musl on Linux
> up-to semi-recently) may have experienced problems.
> 
> v2: don't remove the call from swrast - move it to core (Eric)
> 
> Cc: Eric Anholt <eric at anholt.net>
> Cc: Brian Paul <brianp at vmware.com>
> Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
> ---
>   src/mesa/drivers/dri/swrast/swrast.c | 2 --
>   src/mesa/drivers/osmesa/osmesa.c     | 6 ------
>   src/mesa/drivers/x11/xm_api.c        | 5 -----
>   src/mesa/main/context.c              | 5 ++++-
>   src/mesa/state_tracker/st_manager.c  | 2 --
>   5 files changed, 4 insertions(+), 16 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c
> index 524f9b17c6d..94758e60862 100644
> --- a/src/mesa/drivers/dri/swrast/swrast.c
> +++ b/src/mesa/drivers/dri/swrast/swrast.c
> @@ -885,8 +885,6 @@ dri_make_current(__DRIcontext * cPriv,
>               return GL_TRUE;
>           }
>   
> -	_glapi_check_multithread();
> -
>   	swrast_check_and_update_window_size(mesaCtx, mesaDraw);
>   	if (mesaRead != mesaDraw)
>   	    swrast_check_and_update_window_size(mesaCtx, mesaRead);
> diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c
> index be683d4583e..44374a2e917 100644
> --- a/src/mesa/drivers/osmesa/osmesa.c
> +++ b/src/mesa/drivers/osmesa/osmesa.c
> @@ -1019,12 +1019,6 @@ OSMesaMakeCurrent( OSMesaContext osmesa, void *buffer, GLenum type,
>   
>      osmesa_update_state( &osmesa->mesa, 0 );
>   
> -   /* Call this periodically to detect when the user has begun using
> -    * GL rendering from multiple threads.
> -    */
> -   _glapi_check_multithread();
> -
> -
>      /* Create a front/left color buffer which wraps the user-provided buffer.
>       * There is no back color buffer.
>       * If the user tries to use a 8, 16 or 32-bit/channel buffer that
> diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c
> index 3d54193580e..2b5e5be3cba 100644
> --- a/src/mesa/drivers/x11/xm_api.c
> +++ b/src/mesa/drivers/x11/xm_api.c
> @@ -1221,11 +1221,6 @@ GLboolean XMesaMakeCurrent2( XMesaContext c, XMesaBuffer drawBuffer,
>   
>         c->xm_buffer = drawBuffer;
>   
> -      /* Call this periodically to detect when the user has begun using
> -       * GL rendering from multiple threads.
> -       */
> -      _glapi_check_multithread();
> -
>         xmesa_check_and_update_buffer_size(c, drawBuffer);
>         if (readBuffer != drawBuffer)
>            xmesa_check_and_update_buffer_size(c, readBuffer);
> diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
> index d82015dc936..492f01de957 100644
> --- a/src/mesa/main/context.c
> +++ b/src/mesa/main/context.c
> @@ -1698,7 +1698,10 @@ _mesa_make_current( struct gl_context *newCtx,
>         _mesa_flush(curCtx);
>      }
>   
> -   /* We used to call _glapi_check_multithread() here.  Now do it in drivers */
> +   /* Call this periodically to detect when the user has begun using
> +    * GL rendering from multiple threads.
> +    */
> +   _glapi_check_multithread();
>   
>      if (!newCtx) {
>         _glapi_set_dispatch(NULL);  /* none current */
> diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c
> index 69286b57916..e7412212d48 100644
> --- a/src/mesa/state_tracker/st_manager.c
> +++ b/src/mesa/state_tracker/st_manager.c
> @@ -1022,8 +1022,6 @@ st_api_make_current(struct st_api *stapi, struct st_context_iface *stctxi,
>      struct st_framebuffer *stdraw, *stread;
>      boolean ret;
>   
> -   _glapi_check_multithread();
> -
>      if (st) {
>         /* reuse or create the draw fb */
>         stdraw = st_framebuffer_reuse_or_create(st,
> 



More information about the mesa-dev mailing list