On 3 May 2017 at 17:34, Gregory Hainaut <gregory.hain...@gmail.com> wrote: > Otherwise print a warning > s/print a warning/$something_bad_that_can_happen/
Print an error message for the user if the requirement is not met, or we're not thread safe. > v2: based on Nicolai feedback > Check the DRI extension version > > Signed-off-by: Gregory Hainaut <gregory.hain...@gmail.com> > --- > src/gallium/state_trackers/dri/dri_context.c | 12 ++++++++++-- > 1 file changed, 10 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..7c074be63f 100644 > --- a/src/gallium/state_trackers/dri/dri_context.c > +++ b/src/gallium/state_trackers/dri/dri_context.c > @@ -153,22 +153,30 @@ 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); > + /* v2 gives us isGlThreadSafe to ensure thread safety */ > + screen->sPriv->dri2.backgroundCallable->base.version >= 2 && > + driQueryOptionb(&screen->optionCache, "mesa_glthread")) { > + > + if > (ctx->sPriv->dri2.backgroundCallable->isGlThreadSafe(cPriv->loaderPrivate)) Checking screen->sPriv above to use ctx->sPriv here? Something looks a bit off. > + ctx->st->start_thread(ctx->st); > + else > + fprintf(stderr, "MESA warning: glthread can't be enabled because " > + "the application didn't call XInitThreads\n"); > + } > if (ctx->st->start_thread && driQueryOptionb(&screen->optionCache, "mesa_glthread")) { if (screen->sPriv->dri2.backgroundCallable && screen->sPriv->dri2.backgroundCallable->base.version >= 2 && screen->sPriv->dri2.backgroundCallable->isGlThreadSafe) { if (screen->sPriv->dri2.backgroundCallable->isGlThreadSafe(cPriv->loaderPrivate)) ctx->st->start_thread(ctx->st); else fprintf("foo not safe - missing call bar"); } else { fprintf("requested X but driver is missing bar"); } } Regards, Emil _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev