Hi,
On 24 October 2014 11:03, Kalyan Kondapally <
[email protected]> wrote:
> driUnbindContext() checks for valid drawables before calling the driver
> unbind function. In case of Surfaceless contexts, the drawables are always
> Null and we end up not releasing the underlying DRI context. Moving the
> call to the driver function before the drawable validity checks fixes
> things.
>
Yep, that looks good to me; seems like you've found the only possible case
that would trigger this breakage. Calling DestroyContext will always unbind
if it's current in that thread (see the end _mesa_free_context_data); it's
only when you follow that exact pattern of:
- create surfaceless context
- make ctx current
- make something else current
- {another thread} destroy ctx
- make ctx current again
that you hit the crash.
The only effect of calling UnbindContext() is that _mesa_make_current(NULL,
NULL, NULL) gets called, which is what we want.
Could you please document some part of that in the commit message for
future archaeology?
Reviewed-by: Daniel Stone <[email protected]>
Cheers,
Daniel
> Signed-off-by: Alexandros Frantzis <[email protected]>
> Signed-off-by: Kalyan Kondapally <[email protected]>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74563
> ---
> src/mesa/drivers/dri/common/dri_util.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/common/dri_util.c
> b/src/mesa/drivers/dri/common/dri_util.c
> index 6c78928..02499f2 100644
> --- a/src/mesa/drivers/dri/common/dri_util.c
> +++ b/src/mesa/drivers/dri/common/dri_util.c
> @@ -569,6 +569,12 @@ static int driUnbindContext(__DRIcontext *pcp)
> if (pcp == NULL)
> return GL_FALSE;
>
> + /*
> + ** Call driUnbindContext before checking for valid drawables
> + ** to handle surfaceless contexts properly.
> + */
> + pcp->driScreenPriv->driver->UnbindContext(pcp);
> +
> pdp = pcp->driDrawablePriv;
> prp = pcp->driReadablePriv;
>
> @@ -576,8 +582,6 @@ static int driUnbindContext(__DRIcontext *pcp)
> if (!pdp && !prp)
> return GL_TRUE;
>
> - pcp->driScreenPriv->driver->UnbindContext(pcp);
> -
> assert(pdp);
> if (pdp->refcount == 0) {
> /* ERROR!!! */
> --
> 1.9.1
>
> _______________________________________________
> mesa-dev mailing list
> [email protected]
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev