Drop unnecessary linked list of contexts from GLXDrawable.

This commit is contained in:
Kristian Høgsberg 2008-07-21 18:16:38 -04:00
parent 5c1e254cc8
commit 24dddcd0ef
3 changed files with 10 additions and 83 deletions

View File

@ -147,8 +147,10 @@ validGlxFBConfigForWindow(ClientPtr client, __GLXconfig *config,
void void
__glXContextDestroy(__GLXcontext *context) __glXContextDestroy(__GLXcontext *context)
{ {
if (!context->isDirect) if (!context->isDirect) {
__glXDeassociateContext(context); __glXUnrefDrawable(context->drawPriv);
__glXUnrefDrawable(context->readPriv);
}
__glXFlushContextCache(); __glXFlushContextCache();
} }
@ -618,7 +620,10 @@ DoMakeCurrent(__GLXclientState *cl,
return __glXError(GLXBadContext); return __glXError(GLXBadContext);
} }
__glXFlushContextCache(); __glXFlushContextCache();
__glXDeassociateContext(prevglxc); if (!glxc->isDirect) {
__glXUnrefDrawable(glxc->drawPriv);
__glXUnrefDrawable(glxc->readPriv);
}
} }
@ -644,9 +649,8 @@ DoMakeCurrent(__GLXclientState *cl,
} }
glxc->isCurrent = GL_TRUE; glxc->isCurrent = GL_TRUE;
__glXAssociateContext(glxc); __glXRefDrawable(glxc->drawPriv);
assert(drawPriv->drawGlxc == glxc); __glXRefDrawable(glxc->readPriv);
assert(readPriv->readGlxc == glxc);
} }
if (prevglxc) { if (prevglxc) {

View File

@ -76,15 +76,6 @@ struct __GLXdrawable {
*/ */
__GLXconfig *config; __GLXconfig *config;
/*
** Lists of contexts bound to this drawable. There are two lists here.
** One list is of the contexts that have this drawable bound for drawing,
** and the other is the list of contexts that have this drawable bound
** for reading.
*/
__GLXcontext *drawGlxc;
__GLXcontext *readGlxc;
/* /*
** reference count ** reference count
*/ */

View File

@ -44,74 +44,6 @@
#include "glxserver.h" #include "glxserver.h"
#include "glxutil.h" #include "glxutil.h"
/************************************************************************/
/* Context stuff */
/*
** associate a context with a drawable
*/
void
__glXAssociateContext(__GLXcontext *glxc)
{
glxc->nextDrawPriv = glxc->drawPriv->drawGlxc;
glxc->drawPriv->drawGlxc = glxc;
__glXRefDrawable(glxc->drawPriv);
glxc->nextReadPriv = glxc->readPriv->readGlxc;
glxc->readPriv->readGlxc = glxc;
__glXRefDrawable(glxc->readPriv);
}
/*
** Deassociate a context from a drawable
*/
void
__glXDeassociateContext(__GLXcontext *glxc)
{
__GLXcontext *curr, *prev;
prev = NULL;
if (glxc->drawPriv) {
for ( curr = glxc->drawPriv->drawGlxc; curr != NULL
; prev = curr, curr = curr->nextDrawPriv ) {
if (curr == glxc) {
/* found context. Deassociate. */
if (prev == NULL) {
glxc->drawPriv->drawGlxc = curr->nextDrawPriv;
} else {
prev->nextDrawPriv = curr->nextDrawPriv;
}
curr->nextDrawPriv = NULL;
__glXUnrefDrawable(glxc->drawPriv);
break;
}
}
}
prev = NULL;
if (glxc->readPriv) {
for ( curr = glxc->readPriv->readGlxc
; curr != NULL
; prev = curr, curr = curr->nextReadPriv ) {
if (curr == glxc) {
/* found context. Deassociate. */
if (prev == NULL) {
glxc->readPriv->readGlxc = curr->nextReadPriv;
} else {
prev->nextReadPriv = curr->nextReadPriv;
}
curr->nextReadPriv = NULL;
__glXUnrefDrawable(glxc->readPriv);
break;
}
}
}
}
/*****************************************************************************/ /*****************************************************************************/
/* Drawable private stuff */ /* Drawable private stuff */