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.
This commit is contained in:
parent
781515bb63
commit
600028305c
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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_ */
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue
Block a user