[Mesa-dev] [PATCH v4 4/4] glthread/gallium: require safe_glthread to start glthread
Emil Velikov
emil.l.velikov at gmail.com
Mon May 22 09:07:25 UTC 2017
Hi Gregory,
A minor nit below and this that the series is
Reviewed-by: Emil Velikov <emil.velikov at collabora.com>
On 21 May 2017 at 15:59, Gregory Hainaut <gregory.hainaut at gmail.com> wrote:
> Print an error message for the user if the requirement isn't met, or
> we're not thread safe.
>
> v2: based on Nicolai feedbacks
> Check the DRI extension version
> v3: based on Emil feedbacks
> improve commit and error messages.
> use backgroundCallable variable to improve readability
>
> Signed-off-by: Gregory Hainaut <gregory.hainaut at gmail.com>
> ---
> src/gallium/state_trackers/dri/dri_context.c | 21 +++++++++++++++++----
> 1 file changed, 17 insertions(+), 4 deletions(-)
>
> diff --git a/src/gallium/state_trackers/dri/dri_context.c b/src/gallium/state_trackers/dri/dri_context.c
> index 92d79849c4..8cbab5359f 100644
> --- a/src/gallium/state_trackers/dri/dri_context.c
> +++ b/src/gallium/state_trackers/dri/dri_context.c
> @@ -51,20 +51,22 @@ dri_create_context(gl_api api, const struct gl_config * visual,
> {
> __DRIscreen *sPriv = cPriv->driScreenPriv;
> struct dri_screen *screen = dri_screen(sPriv);
> struct st_api *stapi = screen->st_api;
> struct dri_context *ctx = NULL;
> struct st_context_iface *st_share = NULL;
> struct st_context_attribs attribs;
> enum st_context_error ctx_err = 0;
> unsigned allowed_flags = __DRI_CTX_FLAG_DEBUG |
> __DRI_CTX_FLAG_FORWARD_COMPATIBLE;
> + const __DRIbackgroundCallableExtension *backgroundCallable =
> + screen->sPriv->dri2.backgroundCallable;
>
> if (screen->has_reset_status_query)
> allowed_flags |= __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS;
>
> if (flags & ~allowed_flags) {
> *error = __DRI_CTX_ERROR_UNKNOWN_FLAG;
> goto fail;
> }
>
> if (!screen->has_reset_status_query && notify_reset) {
> @@ -151,24 +153,35 @@ dri_create_context(gl_api api, const struct gl_config * visual,
> ctx->st->st_manager_private = (void *) ctx;
> ctx->stapi = stapi;
>
> 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 (backgroundCallable && backgroundCallable->base.version >= 2 &&
> + driQueryOptionb(&screen->optionCache, "mesa_glthread")) {
You already query the option above. What you meant to add here is a
check that the function pointer is non-NULL.
Barring any objections, I will address the above and the 3/4 nit from
Dan and push these mid/later this week.
Thanks
Emil
More information about the mesa-dev
mailing list