glx/dri: Fix DRI drawable release at MakeCurrent time

We want to release the drawables of the context we're coming from, but
we were releasing them from the context we're switching to. This is
probably not a big deal normally because both contexts are likely to be
on the same display, which is all that driReleaseDrawables is really
sensitive to. But if the contexts are on different Displays this would
go quite wrong.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17176>
This commit is contained in:
Adam Jackson 2022-06-21 16:07:19 -04:00 committed by Marge Bot
parent 59944831a7
commit 31b04e420b
5 changed files with 5 additions and 5 deletions

View file

@ -135,7 +135,7 @@ dri2_bind_context(struct glx_context *context, struct glx_context *old,
pdraw = (struct dri2_drawable *) driFetchDrawable(context, draw);
pread = (struct dri2_drawable *) driFetchDrawable(context, read);
driReleaseDrawables(&pcp->base);
driReleaseDrawables(old);
if (pdraw)
dri_draw = pdraw->driDrawable;

View file

@ -195,7 +195,7 @@ dri3_bind_context(struct glx_context *context, struct glx_context *old,
pdraw = (struct dri3_drawable *) driFetchDrawable(context, draw);
pread = (struct dri3_drawable *) driFetchDrawable(context, read);
driReleaseDrawables(&pcp->base);
driReleaseDrawables(old);
if (pdraw)
dri_draw = pdraw->loader_drawable.dri_drawable;

View file

@ -491,7 +491,7 @@ releaseDrawable(const struct glx_display *priv, GLXDrawable drawable)
_X_HIDDEN void
driReleaseDrawables(struct glx_context *gc)
{
const struct glx_display *priv = gc->psc->display;
const struct glx_display *priv = (gc && gc->psc) ? gc->psc->display : NULL;
if (priv == NULL)
return;

View file

@ -437,7 +437,7 @@ drisw_bind_context(struct glx_context *context, struct glx_context *old,
pdraw = (struct drisw_drawable *) driFetchDrawable(context, draw);
pread = (struct drisw_drawable *) driFetchDrawable(context, read);
driReleaseDrawables(&pcp->base);
driReleaseDrawables(old);
if (!(*psc->core->bindContext) (pcp->driContext,
pdraw ? pdraw->driDrawable : NULL,

View file

@ -88,7 +88,7 @@ driwindows_bind_context(struct glx_context *context, struct glx_context *old,
pdraw = (struct driwindows_drawable *) driFetchDrawable(context, draw);
pread = (struct driwindows_drawable *) driFetchDrawable(context, read);
driReleaseDrawables(&pcp->base);
driReleaseDrawables(old);
if (pdraw == NULL || pread == NULL)
return GLXBadDrawable;