[Mesa-dev] [RFC 2/2] glthread/gallium: require safe_glthread to start glthread

Nicolai Hähnle nhaehnle at gmail.com
Wed May 3 15:22:55 UTC 2017


On 28.04.2017 23:11, Gregory Hainaut wrote:
> Otherwise print a warning
>
> Signed-off-by: Gregory Hainaut <gregory.hainaut at gmail.com>
> ---
>  src/gallium/state_trackers/dri/dri_context.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/src/gallium/state_trackers/dri/dri_context.c b/src/gallium/state_trackers/dri/dri_context.c
> index 92d79849c4..35b0c454be 100644
> --- a/src/gallium/state_trackers/dri/dri_context.c
> +++ b/src/gallium/state_trackers/dri/dri_context.c
> @@ -153,22 +153,28 @@ dri_create_context(gl_api api, const struct gl_config * visual,
>
>     if (ctx->st->cso_context) {
>        ctx->pp = pp_init(ctx->st->pipe, screen->pp_enabled, ctx->st->cso_context);
>        ctx->hud = hud_create(ctx->st->pipe, ctx->st->cso_context);
>     }
>
>     /* Do this last. */
>     if (ctx->st->start_thread &&
>         /* the driver loader must implement this */
>         screen->sPriv->dri2.backgroundCallable &&
> -       driQueryOptionb(&screen->optionCache, "mesa_glthread"))
> -      ctx->st->start_thread(ctx->st);
> +       driQueryOptionb(&screen->optionCache, "mesa_glthread")) {
> +
> +      if (ctx->sPriv->dri2.backgroundCallable->isGlThreadSafe(cPriv->loaderPrivate))

Check the extension version.

Cheers,
Nicolai


> +         ctx->st->start_thread(ctx->st);
> +      else
> +         fprintf(stderr, "MESA warning: glthread can't be enabled because "
> +               "the application didn't call XInitThreads\n");
> +   }
>
>     *error = __DRI_CTX_ERROR_SUCCESS;
>     return GL_TRUE;
>
>   fail:
>     if (ctx && ctx->st)
>        ctx->st->destroy(ctx->st);
>
>     free(ctx);
>     return GL_FALSE;
>


-- 
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.


More information about the mesa-dev mailing list