From 24dddcd0ef845f4120f8588dc63ec754338ffac8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Mon, 21 Jul 2008 18:16:38 -0400 Subject: [PATCH] Drop unnecessary linked list of contexts from GLXDrawable. --- glx/glxcmds.c | 16 ++++++----- glx/glxdrawable.h | 9 ------- glx/glxutil.c | 68 ----------------------------------------------- 3 files changed, 10 insertions(+), 83 deletions(-) diff --git a/glx/glxcmds.c b/glx/glxcmds.c index 083113584..ea70ca478 100644 --- a/glx/glxcmds.c +++ b/glx/glxcmds.c @@ -147,8 +147,10 @@ validGlxFBConfigForWindow(ClientPtr client, __GLXconfig *config, void __glXContextDestroy(__GLXcontext *context) { - if (!context->isDirect) - __glXDeassociateContext(context); + if (!context->isDirect) { + __glXUnrefDrawable(context->drawPriv); + __glXUnrefDrawable(context->readPriv); + } __glXFlushContextCache(); } @@ -618,7 +620,10 @@ DoMakeCurrent(__GLXclientState *cl, return __glXError(GLXBadContext); } __glXFlushContextCache(); - __glXDeassociateContext(prevglxc); + if (!glxc->isDirect) { + __glXUnrefDrawable(glxc->drawPriv); + __glXUnrefDrawable(glxc->readPriv); + } } @@ -644,9 +649,8 @@ DoMakeCurrent(__GLXclientState *cl, } glxc->isCurrent = GL_TRUE; - __glXAssociateContext(glxc); - assert(drawPriv->drawGlxc == glxc); - assert(readPriv->readGlxc == glxc); + __glXRefDrawable(glxc->drawPriv); + __glXRefDrawable(glxc->readPriv); } if (prevglxc) { diff --git a/glx/glxdrawable.h b/glx/glxdrawable.h index 98e301b88..5b4338272 100644 --- a/glx/glxdrawable.h +++ b/glx/glxdrawable.h @@ -76,15 +76,6 @@ struct __GLXdrawable { */ __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 */ diff --git a/glx/glxutil.c b/glx/glxutil.c index fc73a02c9..f5b741420 100644 --- a/glx/glxutil.c +++ b/glx/glxutil.c @@ -44,74 +44,6 @@ #include "glxserver.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 */