[PATCH 2/5] glx: Remove ->forceCurrent from the context vtable

Adam Jackson ajax at redhat.com
Mon Mar 21 13:02:14 PDT 2011


All the implementations of makeCurrent and forceCurrent are identical,
so just use makeCurrent everywhere.

Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 glx/glxcontext.h         |    2 --
 glx/glxdri.c             |   14 --------------
 glx/glxdri2.c            |   14 --------------
 glx/glxdriswrast.c       |   14 --------------
 glx/glxext.c             |    2 +-
 hw/xquartz/GL/indirect.c |   15 ---------------
 hw/xwin/glx/indirect.c   |    8 --------
 7 files changed, 1 insertions(+), 68 deletions(-)

diff --git a/glx/glxcontext.h b/glx/glxcontext.h
index 79bc083..65d51f5 100644
--- a/glx/glxcontext.h
+++ b/glx/glxcontext.h
@@ -53,8 +53,6 @@ struct __GLXcontext {
     int            (*copy)          (__GLXcontext *dst,
 				     __GLXcontext *src,
 				     unsigned long mask);
-    int            (*forceCurrent)  (__GLXcontext *context);
-
     Bool           (*wait)          (__GLXcontext *context,
 				     __GLXclientState *cl,
 				     int *error);
diff --git a/glx/glxdri.c b/glx/glxdri.c
index 3a57337..c87ac9a 100644
--- a/glx/glxdri.c
+++ b/glx/glxdri.c
@@ -335,19 +335,6 @@ __glXDRIcontextCopy(__GLXcontext *baseDst, __GLXcontext *baseSrc,
 					src->driContext, mask);
 }
 
-static int
-__glXDRIcontextForceCurrent(__GLXcontext *baseContext)
-{
-    __GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
-    __GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseContext->drawPriv;
-    __GLXDRIdrawable *read = (__GLXDRIdrawable *) baseContext->readPriv;
-    __GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
-
-    return (*screen->core->bindContext)(context->driContext,
-					draw->driDrawable,
-					read->driDrawable);
-}
-
 static void
 glxFillAlphaChannel (CARD32 *pixels, CARD32 rowstride, int width, int height)
 {
@@ -641,7 +628,6 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
     context->base.makeCurrent       = __glXDRIcontextMakeCurrent;
     context->base.loseCurrent       = __glXDRIcontextLoseCurrent;
     context->base.copy              = __glXDRIcontextCopy;
-    context->base.forceCurrent      = __glXDRIcontextForceCurrent;
 
     context->base.textureFromPixmap = &__glXDRItextureFromPixmap;
     /* Find the requested X visual */
diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index 18927d7..e8961e2 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -283,19 +283,6 @@ __glXDRIcontextCopy(__GLXcontext *baseDst, __GLXcontext *baseSrc,
 					src->driContext, mask);
 }
 
-static int
-__glXDRIcontextForceCurrent(__GLXcontext *baseContext)
-{
-    __GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
-    __GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseContext->drawPriv;
-    __GLXDRIdrawable *read = (__GLXDRIdrawable *) baseContext->readPriv;
-    __GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
-
-    return (*screen->core->bindContext)(context->driContext,
-					draw->driDrawable,
-					read->driDrawable);
-}
-
 static Bool
 __glXDRIcontextWait(__GLXcontext *baseContext,
 		    __GLXclientState *cl, int *error)
@@ -411,7 +398,6 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
     context->base.makeCurrent       = __glXDRIcontextMakeCurrent;
     context->base.loseCurrent       = __glXDRIcontextLoseCurrent;
     context->base.copy              = __glXDRIcontextCopy;
-    context->base.forceCurrent      = __glXDRIcontextForceCurrent;
     context->base.textureFromPixmap = &__glXDRItextureFromPixmap;
     context->base.wait              = __glXDRIcontextWait;
 
diff --git a/glx/glxdriswrast.c b/glx/glxdriswrast.c
index 78b24ff..ed142c1 100644
--- a/glx/glxdriswrast.c
+++ b/glx/glxdriswrast.c
@@ -174,19 +174,6 @@ __glXDRIcontextCopy(__GLXcontext *baseDst, __GLXcontext *baseSrc,
 					src->driContext, mask);
 }
 
-static int
-__glXDRIcontextForceCurrent(__GLXcontext *baseContext)
-{
-    __GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
-    __GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseContext->drawPriv;
-    __GLXDRIdrawable *read = (__GLXDRIdrawable *) baseContext->readPriv;
-    __GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
-
-    return (*screen->core->bindContext)(context->driContext,
-					draw->driDrawable,
-					read->driDrawable);
-}
-
 #ifdef __DRI_TEX_BUFFER
 
 static int
@@ -289,7 +276,6 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
     context->base.makeCurrent       = __glXDRIcontextMakeCurrent;
     context->base.loseCurrent       = __glXDRIcontextLoseCurrent;
     context->base.copy              = __glXDRIcontextCopy;
-    context->base.forceCurrent      = __glXDRIcontextForceCurrent;
     context->base.textureFromPixmap = &__glXDRItextureFromPixmap;
 
     context->driContext =
diff --git a/glx/glxext.c b/glx/glxext.c
index 16315b8..e083c6c 100644
--- a/glx/glxext.c
+++ b/glx/glxext.c
@@ -420,7 +420,7 @@ __GLXcontext *__glXForceCurrent(__GLXclientState *cl, GLXContextTag tag,
 
     /* Make this context the current one for the GL. */
     if (!cx->isDirect) {
-	if (!(*cx->forceCurrent)(cx)) {
+	if (!(*cx->makeCurrent)(cx)) {
 	    /* Bind failed, and set the error code.  Bummer */
 	    cl->client->errorValue = cx->id;
 	    *error = __glXError(GLXBadContextState);
diff --git a/hw/xquartz/GL/indirect.c b/hw/xquartz/GL/indirect.c
index 1375bea..32fb12a 100644
--- a/hw/xquartz/GL/indirect.c
+++ b/hw/xquartz/GL/indirect.c
@@ -174,7 +174,6 @@ static __GLXdrawable * __glXAquaScreenCreateDrawable(ClientPtr client, __GLXscre
 static void __glXAquaContextDestroy(__GLXcontext *baseContext);
 static int __glXAquaContextMakeCurrent(__GLXcontext *baseContext);
 static int __glXAquaContextLoseCurrent(__GLXcontext *baseContext);
-static int __glXAquaContextForceCurrent(__GLXcontext *baseContext);
 static int __glXAquaContextCopy(__GLXcontext *baseDst, __GLXcontext *baseSrc, unsigned long mask);
 
 static CGLPixelFormatObj makeFormat(__GLXconfig *conf);
@@ -235,7 +234,6 @@ __glXAquaScreenCreateContext(__GLXscreen *screen,
     context->base.makeCurrent    = __glXAquaContextMakeCurrent;
     context->base.loseCurrent    = __glXAquaContextLoseCurrent;
     context->base.copy           = __glXAquaContextCopy;
-    context->base.forceCurrent   = __glXAquaContextForceCurrent;
     /*FIXME verify that the context->base is fully initialized. */
     
     context->pixelFormat = makeFormat(conf);
@@ -458,19 +456,6 @@ static int __glXAquaContextCopy(__GLXcontext *baseDst, __GLXcontext *baseSrc, un
     return gl_err == 0;
 }
 
-static int __glXAquaContextForceCurrent(__GLXcontext *baseContext)
-{
-    CGLError gl_err;
-    __GLXAquaContext *context = (__GLXAquaContext *) baseContext;
-    GLAQUA_DEBUG_MSG("glAquaForceCurrent (ctx %p)\n", context->ctx);
-
-    gl_err = CGLSetCurrentContext(context->ctx);
-    if (gl_err != 0)
-        ErrorF("CGLSetCurrentContext error: %s\n", CGLErrorString(gl_err));
-
-    return gl_err == 0;
-}
-
 /* Drawing surface notification callbacks */
 static GLboolean __glXAquaDrawableSwapBuffers(ClientPtr client, __GLXdrawable *base) {
     CGLError err;
diff --git a/hw/xwin/glx/indirect.c b/hw/xwin/glx/indirect.c
index c9831f3..e32ac51 100644
--- a/hw/xwin/glx/indirect.c
+++ b/hw/xwin/glx/indirect.c
@@ -1480,13 +1480,6 @@ glxWinContextCopy(__GLXcontext *dst_base, __GLXcontext *src_base, unsigned long
   return ret;
 }
 
-static int
-glxWinContextForceCurrent(__GLXcontext *base)
-{
-  /* wglMakeCurrent always flushes the previous context, so this is equivalent to glxWinContextMakeCurrent */
-  return glxWinContextMakeCurrent(base);
-}
-
 static void
 glxWinContextDestroy(__GLXcontext *base)
 {
@@ -1541,7 +1534,6 @@ glxWinCreateContext(__GLXscreen *screen,
     context->base.makeCurrent    = glxWinContextMakeCurrent;
     context->base.loseCurrent    = glxWinContextLoseCurrent;
     context->base.copy           = glxWinContextCopy;
-    context->base.forceCurrent   = glxWinContextForceCurrent;
     context->base.textureFromPixmap = &glxWinTextureFromPixmap;
     context->base.config = modes;
     context->base.pGlxScreen = screen;
-- 
1.7.4.1



More information about the xorg-devel mailing list