mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-05-08 10:18:04 +02:00
Fix GLX drawable destruction
This commit is contained in:
parent
71d77861c2
commit
844147f263
5 changed files with 43 additions and 10 deletions
|
|
@ -181,6 +181,9 @@ static Bool DrawableGone(__GLXdrawable *glxPriv, XID xid)
|
|||
}
|
||||
}
|
||||
|
||||
/* remove the drawable from the drawable list */
|
||||
FreeResourceByType(glxPriv->drawId, __glXDrawableRes, FALSE);
|
||||
|
||||
__glXUnrefDrawable(glxPriv);
|
||||
|
||||
return True;
|
||||
|
|
|
|||
|
|
@ -199,12 +199,15 @@ static Bool PositionWindow(WindowPtr pWin, int x, int y)
|
|||
}
|
||||
|
||||
/* mark contexts as needing resize */
|
||||
__glXFlushContextCache ();
|
||||
|
||||
for (glxc = glxPriv->drawGlxc; glxc; glxc = glxc->nextDrawPriv) {
|
||||
(*glxc->loseCurrent)(glxc);
|
||||
glxc->pendingState |= __GLX_PENDING_RESIZE;
|
||||
}
|
||||
|
||||
for (glxc = glxPriv->readGlxc; glxc; glxc = glxc->nextReadPriv) {
|
||||
(*glxc->loseCurrent)(glxc);
|
||||
glxc->pendingState |= __GLX_PENDING_RESIZE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -131,11 +131,8 @@ void
|
|||
__glXUnrefDrawable(__GLXdrawable *glxPriv)
|
||||
{
|
||||
glxPriv->refCount--;
|
||||
if (glxPriv->refCount == 0) {
|
||||
/* remove the drawable from the drawable list */
|
||||
FreeResourceByType(glxPriv->drawId, __glXDrawableRes, FALSE);
|
||||
if (glxPriv->refCount == 0)
|
||||
glxPriv->destroy(glxPriv);
|
||||
}
|
||||
}
|
||||
|
||||
GLboolean
|
||||
|
|
|
|||
|
|
@ -86,6 +86,9 @@ struct __GLXMESAscreen {
|
|||
struct __GLXMESAcontext {
|
||||
__GLXcontext base;
|
||||
XMesaContext xmesa;
|
||||
|
||||
__GLXMESAdrawable *drawPriv;
|
||||
__GLXMESAdrawable *readPriv;
|
||||
};
|
||||
|
||||
struct __GLXMESAdrawable {
|
||||
|
|
@ -102,7 +105,10 @@ __glXMesaDrawableDestroy(__GLXdrawable *base)
|
|||
__GLXMESAdrawable *glxPriv = (__GLXMESAdrawable *) base;
|
||||
|
||||
if (glxPriv->xm_buf)
|
||||
{
|
||||
glxPriv->xm_buf->frontxrb->drawable = 0;
|
||||
XMesaDestroyBuffer(glxPriv->xm_buf);
|
||||
}
|
||||
xfree(glxPriv);
|
||||
}
|
||||
|
||||
|
|
@ -111,7 +117,8 @@ __glXMesaDrawableResize(__GLXdrawable *base)
|
|||
{
|
||||
__GLXMESAdrawable *glxPriv = (__GLXMESAdrawable *) base;
|
||||
|
||||
XMesaResizeBuffers(glxPriv->xm_buf);
|
||||
if (XMesaGetCurrentBuffer () == glxPriv->xm_buf)
|
||||
XMesaResizeBuffers(glxPriv->xm_buf);
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
|
@ -214,6 +221,11 @@ __glXMesaContextDestroy(__GLXcontext *baseContext)
|
|||
{
|
||||
__GLXMESAcontext *context = (__GLXMESAcontext *) baseContext;
|
||||
|
||||
if (context->drawPriv)
|
||||
__glXUnrefDrawable (&context->drawPriv->base);
|
||||
if (context->readPriv)
|
||||
__glXUnrefDrawable (&context->readPriv->base);
|
||||
|
||||
XMesaDestroyContext(context->xmesa);
|
||||
__glXContextDestroy(context);
|
||||
xfree(context);
|
||||
|
|
@ -226,10 +238,24 @@ __glXMesaContextMakeCurrent(__GLXcontext *baseContext)
|
|||
__GLXMESAcontext *context = (__GLXMESAcontext *) baseContext;
|
||||
__GLXMESAdrawable *drawPriv = (__GLXMESAdrawable *) context->base.drawPriv;
|
||||
__GLXMESAdrawable *readPriv = (__GLXMESAdrawable *) context->base.readPriv;
|
||||
int status;
|
||||
|
||||
return XMesaMakeCurrent2(context->xmesa,
|
||||
drawPriv->xm_buf,
|
||||
readPriv->xm_buf);
|
||||
__glXRefDrawable (&drawPriv->base);
|
||||
__glXRefDrawable (&readPriv->base);
|
||||
|
||||
status = XMesaMakeCurrent2(context->xmesa,
|
||||
drawPriv->xm_buf,
|
||||
readPriv->xm_buf);
|
||||
|
||||
if (context->drawPriv)
|
||||
__glXUnrefDrawable (&context->drawPriv->base);
|
||||
if (context->readPriv)
|
||||
__glXUnrefDrawable (&context->readPriv->base);
|
||||
|
||||
context->drawPriv = drawPriv;
|
||||
context->readPriv = readPriv;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
|||
|
|
@ -5583,7 +5583,11 @@ xglDestroyDrawable (__GLXdrawable *drawable)
|
|||
__GLXdrawable *mesaDrawable = pBufferPriv->mesaDrawable;
|
||||
|
||||
if (mesaDrawable)
|
||||
(*mesaDrawable->destroy) (mesaDrawable);
|
||||
{
|
||||
mesaDrawable->refCount--;
|
||||
if (!mesaDrawable->refCount)
|
||||
(*mesaDrawable->destroy) (mesaDrawable);
|
||||
}
|
||||
|
||||
if (pBufferPriv->pGC)
|
||||
FreeGC (pBufferPriv->pGC, (GContext) 0);
|
||||
|
|
@ -6351,7 +6355,7 @@ xglScreenDestroy (__GLXscreen *screen)
|
|||
__GLXscreen *mesaScreen = pScreen->mesaScreen;
|
||||
|
||||
if (mesaScreen)
|
||||
GlxScreenDestroy (mesaScreen);
|
||||
(*mesaScreen->destroy) (mesaScreen);
|
||||
|
||||
if (pScreen->GLXextensions)
|
||||
xfree (pScreen->GLXextensions);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue