[Mesa-dev] [PATCH] st/dri: wait for thread to finish before unbinding context

Marek Olšák maraeo at gmail.com
Fri Mar 17 17:39:11 UTC 2017


Reviewed-by: Marek Olšák <marek.olsak at amd.com>

Marek

On Fri, Mar 17, 2017 at 1:02 AM, Timothy Arceri <tarceri at itsqueeze.com> wrote:
> Fixes a bunch of piglit crashes that hit an assert() when trying
> to delete the framebuffer. The assert() was triggered because
> WinSysDrawBuffer was set to NULL before glDeleteFramebuffers()
> was called.
> ---
>  src/gallium/state_trackers/dri/dri_context.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/src/gallium/state_trackers/dri/dri_context.c b/src/gallium/state_trackers/dri/dri_context.c
> index 91d2d1f..92d7984 100644
> --- a/src/gallium/state_trackers/dri/dri_context.c
> +++ b/src/gallium/state_trackers/dri/dri_context.c
> @@ -199,20 +199,23 @@ dri_destroy_context(__DRIcontext * cPriv)
>  GLboolean
>  dri_unbind_context(__DRIcontext * cPriv)
>  {
>     /* dri_util.c ensures cPriv is not null */
>     struct dri_screen *screen = dri_screen(cPriv->driScreenPriv);
>     struct dri_context *ctx = dri_context(cPriv);
>     struct st_api *stapi = screen->st_api;
>
>     if (--ctx->bind_count == 0) {
>        if (ctx->st == ctx->stapi->get_current(ctx->stapi)) {
> +         if (ctx->st->thread_finish)
> +            ctx->st->thread_finish(ctx->st);
> +
>           /* For conformance, unbind is supposed to flush the context.
>            * However, if we do it here we might end up flushing a partially
>            * destroyed context. Instead, we flush in dri_make_current and
>            * in dri_destroy_context which should cover all the cases.
>            */
>           stapi->make_current(stapi, NULL, NULL, NULL);
>        }
>     }
>
>     return GL_TRUE;
> --
> 2.9.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list