diff options
author | Kristian Høgsberg <krh@redhat.com> | 2007-05-31 22:55:47 -0400 |
---|---|---|
committer | Kristian Høgsberg <krh@redhat.com> | 2007-10-12 16:18:23 -0400 |
commit | 600028305cc047e824b18369a026f89c9eb7e437 (patch) | |
tree | 2b4862eaac6ca98f5f72b1792c3e0802e8338c91 /GL | |
parent | 781515bb637de4fd79e3c83817cb6ffa8f2d8a4f (diff) |
Move hyperpipe and swapbarrier extension funcs to screen private struct.
This gets rid of a couple more global arrays and gets the two extensions
more in line with the general extension mechanism.
Diffstat (limited to 'GL')
-rw-r--r-- | GL/glx/glxcmds.c | 43 | ||||
-rw-r--r-- | GL/glx/glxext.c | 7 | ||||
-rw-r--r-- | GL/glx/glxext.h | 20 | ||||
-rw-r--r-- | GL/glx/glxscreens.c | 32 | ||||
-rw-r--r-- | GL/glx/glxscreens.h | 18 |
5 files changed, 50 insertions, 70 deletions
diff --git a/GL/glx/glxcmds.c b/GL/glx/glxcmds.c index e09290e08..732b135d4 100644 --- a/GL/glx/glxcmds.c +++ b/GL/glx/glxcmds.c @@ -2088,13 +2088,14 @@ int __glXDisp_BindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc) int barrier = req->barrier; DrawablePtr pDraw; int screen, rc; + __GLXscreen *pGlxScreen; rc = dixLookupDrawable(&pDraw, drawable, client, 0, DixUnknownAccess); + pGlxScreen = glxGetScreen(pDraw->pScreen); if (rc == Success && (pDraw->type == DRAWABLE_WINDOW)) { screen = pDraw->pScreen->myNum; - if (__glXSwapBarrierFuncs && - __glXSwapBarrierFuncs[screen].bindSwapBarrierFunc) { - int ret = __glXSwapBarrierFuncs[screen].bindSwapBarrierFunc(screen, drawable, barrier); + if (pGlxScreen->swapBarrierFuncs) { + int ret = pGlxScreen->swapBarrierFuncs->bindSwapBarrierFunc(screen, drawable, barrier); if (ret == Success) { if (barrier) /* add source for cleanup when drawable is gone */ @@ -2118,10 +2119,11 @@ int __glXDisp_QueryMaxSwapBarriersSGIX(__GLXclientState *cl, GLbyte *pc) (xGLXQueryMaxSwapBarriersSGIXReq *) pc; xGLXQueryMaxSwapBarriersSGIXReply reply; int screen = req->screen; + __GLXscreen *pGlxScreen; - if (__glXSwapBarrierFuncs && - __glXSwapBarrierFuncs[screen].queryMaxSwapBarriersFunc) - reply.max = __glXSwapBarrierFuncs[screen].queryMaxSwapBarriersFunc(screen); + pGlxScreen = glxGetScreen(screenInfo.screens[screen]); + if (pGlxScreen->swapBarrierFuncs) + reply.max = pGlxScreen->swapBarrierFuncs->queryMaxSwapBarriersFunc(screen); else reply.max = 0; @@ -2154,11 +2156,12 @@ int __glXDisp_QueryHyperpipeNetworkSGIX(__GLXclientState *cl, GLbyte *pc) int npipes=0; int n= 0; + __GLXscreen *pGlxScreen; - if (__glXHyperpipeFuncs && - __glXHyperpipeFuncs[screen].queryHyperpipeNetworkFunc != NULL) { + pGlxScreen = glxGetScreen(screenInfo.screens[screen]); + if (pGlxScreen->hyperpipeFuncs) { rdata = - (__glXHyperpipeFuncs[screen].queryHyperpipeNetworkFunc(screen, &npipes, &n)); + (pGlxScreen->hyperpipeFuncs->queryHyperpipeNetworkFunc(screen, &npipes, &n)); } length = __GLX_PAD(n) >> 2; reply.type = X_Reply; @@ -2191,13 +2194,13 @@ int __glXDisp_DestroyHyperpipeConfigSGIX (__GLXclientState *cl, GLbyte *pc) int screen = req->screen; int success = GLX_BAD_HYPERPIPE_SGIX; int hpId ; + __GLXscreen *pGlxScreen; hpId = req->hpId; - - if (__glXHyperpipeFuncs && - __glXHyperpipeFuncs[screen].destroyHyperpipeConfigFunc != NULL) { - success = __glXHyperpipeFuncs[screen].destroyHyperpipeConfigFunc(screen, hpId); + pGlxScreen = glxGetScreen(screenInfo.screens[screen]); + if (pGlxScreen->hyperpipeFuncs) { + success = pGlxScreen->hyperpipeFuncs->destroyHyperpipeConfigFunc(screen, hpId); } reply.type = X_Reply; @@ -2229,12 +2232,13 @@ int __glXDisp_QueryHyperpipeConfigSGIX(__GLXclientState *cl, GLbyte *pc) int npipes=0; int n= 0; int hpId; + __GLXscreen *pGlxScreen; hpId = req->hpId; - if (__glXHyperpipeFuncs && - __glXHyperpipeFuncs[screen].queryHyperpipeConfigFunc != NULL) { - rdata = __glXHyperpipeFuncs[screen].queryHyperpipeConfigFunc(screen, hpId,&npipes, &n); + pGlxScreen = glxGetScreen(screenInfo.screens[screen]); + if (pGlxScreen->hyperpipeFuncs) { + rdata = pGlxScreen->hyperpipeFuncs->queryHyperpipeConfigFunc(screen, hpId,&npipes, &n); } length = __GLX_PAD(n) >> 2; @@ -2272,14 +2276,15 @@ int __glXDisp_HyperpipeConfigSGIX(__GLXclientState *cl, GLbyte *pc) int npipes=0, networkId; int hpId=-1; + __GLXscreen *pGlxScreen; + pGlxScreen = glxGetScreen(screenInfo.screens[screen]); networkId = (int)req->networkId; npipes = (int)req->npipes; rdata = (void *)(req +1); - if (__glXHyperpipeFuncs && - __glXHyperpipeFuncs[screen].hyperpipeConfigFunc != NULL) { - __glXHyperpipeFuncs[screen].hyperpipeConfigFunc(screen,networkId, + if (pGlxScreen->hyperpipeFuncs) { + pGlxScreen->hyperpipeFuncs->hyperpipeConfigFunc(screen,networkId, &hpId, &npipes, (void *) rdata); } diff --git a/GL/glx/glxext.c b/GL/glx/glxext.c index ad02a89e1..b5de8c3e9 100644 --- a/GL/glx/glxext.c +++ b/GL/glx/glxext.c @@ -198,9 +198,10 @@ extern RESTYPE __glXSwapBarrierRes; static int SwapBarrierGone(int screen, XID drawable) { - if (__glXSwapBarrierFuncs && - __glXSwapBarrierFuncs[screen].bindSwapBarrierFunc != NULL) { - __glXSwapBarrierFuncs[screen].bindSwapBarrierFunc(screen, drawable, 0); + __GLXscreen *pGlxScreen = glxGetScreen(screenInfo.screens[screen]); + + if (pGlxScreen->swapBarrierFuncs) { + pGlxScreen->swapBarrierFuncs->bindSwapBarrierFunc(screen, drawable, 0); } FreeResourceByType(drawable, __glXSwapBarrierRes, FALSE); return True; diff --git a/GL/glx/glxext.h b/GL/glx/glxext.h index 6774e4d4c..8de643495 100644 --- a/GL/glx/glxext.h +++ b/GL/glx/glxext.h @@ -106,25 +106,5 @@ extern int GlxInitVisuals( int preferredVis ); -typedef struct { - void * (* queryHyperpipeNetworkFunc)(int, int *, int *); - void * (* queryHyperpipeConfigFunc)(int, int, int *, int *); - int (* destroyHyperpipeConfigFunc)(int, int); - void * (* hyperpipeConfigFunc)(int, int, int *, int *, void *); -} __GLXHyperpipeExtensionFuncs; - -extern void __glXHyperpipeInit(int screen, __GLXHyperpipeExtensionFuncs *funcs); - -extern __GLXHyperpipeExtensionFuncs *__glXHyperpipeFuncs; - -typedef struct { - int (* bindSwapBarrierFunc)(int, XID, int); - int (* queryMaxSwapBarriersFunc)(int); -} __GLXSwapBarrierExtensionFuncs; - -extern void __glXSwapBarrierInit(int screen, __GLXSwapBarrierExtensionFuncs *funcs); - -extern __GLXSwapBarrierExtensionFuncs *__glXSwapBarrierFuncs; - #endif /* _glxext_h_ */ diff --git a/GL/glx/glxscreens.c b/GL/glx/glxscreens.c index 75cb8717b..c6f060b3d 100644 --- a/GL/glx/glxscreens.c +++ b/GL/glx/glxscreens.c @@ -181,12 +181,6 @@ static char GLXServerExtensions[] = "GLX_MESA_copy_sub_buffer " ; -__GLXSwapBarrierExtensionFuncs *__glXSwapBarrierFuncs = NULL; -static int __glXNumSwapBarrierFuncs = 0; -__GLXHyperpipeExtensionFuncs *__glXHyperpipeFuncs = NULL; -static int __glXNumHyperpipeFuncs = 0; - - /* ** This hook gets called when a window moves or changes size. */ @@ -256,34 +250,16 @@ static Bool glxPositionWindow(WindowPtr pWin, int x, int y) void __glXHyperpipeInit(int screen, __GLXHyperpipeExtensionFuncs *funcs) { - if (__glXNumHyperpipeFuncs < screen + 1) { - __glXHyperpipeFuncs = xrealloc(__glXHyperpipeFuncs, - (screen+1) * sizeof(__GLXHyperpipeExtensionFuncs)); - __glXNumHyperpipeFuncs = screen + 1; - } + __GLXscreen *pGlxScreen = glxGetScreen(screenInfo.screens[screen]); - __glXHyperpipeFuncs[screen].queryHyperpipeNetworkFunc = - *funcs->queryHyperpipeNetworkFunc; - __glXHyperpipeFuncs[screen].queryHyperpipeConfigFunc = - *funcs->queryHyperpipeConfigFunc; - __glXHyperpipeFuncs[screen].destroyHyperpipeConfigFunc = - *funcs->destroyHyperpipeConfigFunc; - __glXHyperpipeFuncs[screen].hyperpipeConfigFunc = - *funcs->hyperpipeConfigFunc; + pGlxScreen->hyperpipeFuncs = funcs; } void __glXSwapBarrierInit(int screen, __GLXSwapBarrierExtensionFuncs *funcs) { - if (__glXNumSwapBarrierFuncs < screen + 1) { - __glXSwapBarrierFuncs = xrealloc(__glXSwapBarrierFuncs, - (screen+1) * sizeof(__GLXSwapBarrierExtensionFuncs)); - __glXNumSwapBarrierFuncs = screen + 1; - } + __GLXscreen *pGlxScreen = glxGetScreen(screenInfo.screens[screen]); - __glXSwapBarrierFuncs[screen].bindSwapBarrierFunc = - funcs->bindSwapBarrierFunc; - __glXSwapBarrierFuncs[screen].queryMaxSwapBarriersFunc = - funcs->queryMaxSwapBarriersFunc; + pGlxScreen->swapBarrierFuncs = funcs; } static Bool diff --git a/GL/glx/glxscreens.h b/GL/glx/glxscreens.h index d92a795c3..d887beb2a 100644 --- a/GL/glx/glxscreens.h +++ b/GL/glx/glxscreens.h @@ -42,6 +42,21 @@ #include "GL/internal/glcore.h" +typedef struct { + void * (* queryHyperpipeNetworkFunc)(int, int *, int *); + void * (* queryHyperpipeConfigFunc)(int, int, int *, int *); + int (* destroyHyperpipeConfigFunc)(int, int); + void * (* hyperpipeConfigFunc)(int, int, int *, int *, void *); +} __GLXHyperpipeExtensionFuncs; + +typedef struct { + int (* bindSwapBarrierFunc)(int, XID, int); + int (* queryMaxSwapBarriersFunc)(int); +} __GLXSwapBarrierExtensionFuncs; + +void __glXHyperpipeInit(int screen, __GLXHyperpipeExtensionFuncs *funcs); +void __glXSwapBarrierInit(int screen, __GLXSwapBarrierExtensionFuncs *funcs); + /* ** Screen dependent data. These methods are the interface between the DIX ** and DDX layers of the GLX server extension. The methods provide an @@ -62,6 +77,9 @@ struct __GLXscreen { int (*swapInterval) (__GLXdrawable *drawable, int interval); + __GLXHyperpipeExtensionFuncs *hyperpipeFuncs; + __GLXSwapBarrierExtensionFuncs *swapBarrierFuncs; + ScreenPtr pScreen; /** |