st/egl: Fixes for recent GLX cleanup.

Mainly, the type of __GLXdisplayPrivateRec::screenConfigs has changed
from "__GLXscreenConfigs *" to "__GLXscreenConfigs **".
This commit is contained in:
Chia-I Wu
2010-07-20 11:49:59 +08:00
parent c7ad2a4e79
commit 87290a383b
2 changed files with 45 additions and 19 deletions
+43 -17
View File
@@ -185,9 +185,11 @@ FreeScreenConfigs(__GLXdisplayPrivate * priv)
GLint i, screens;
/* Free screen configuration information */
psc = priv->screenConfigs;
screens = ScreenCount(priv->dpy);
for (i = 0; i < screens; i++, psc++) {
for (i = 0; i < screens; i++) {
psc = priv->screenConfigs[i];
if (!psc)
continue;
if (psc->configs) {
_gl_context_modes_destroy(psc->configs);
psc->configs = NULL; /* NOTE: just for paranoia */
@@ -504,15 +506,15 @@ createConfigsFromProperties(Display * dpy, int nvisuals, int nprops,
}
static GLboolean
getVisualConfigs(Display * dpy, __GLXdisplayPrivate * priv, int screen)
getVisualConfigs(__GLXscreenConfigs *psc,
__GLXdisplayPrivate *priv, int screen)
{
xGLXGetVisualConfigsReq *req;
__GLXscreenConfigs *psc;
xGLXGetVisualConfigsReply reply;
Display *dpy = priv->dpy;
LockDisplay(dpy);
psc = priv->screenConfigs + screen;
psc->visuals = NULL;
GetReq(GLXGetVisualConfigs, req);
req->reqType = priv->majorOpcode;
@@ -533,15 +535,14 @@ getVisualConfigs(Display * dpy, __GLXdisplayPrivate * priv, int screen)
}
static GLboolean
getFBConfigs(Display * dpy, __GLXdisplayPrivate * priv, int screen)
getFBConfigs(__GLXscreenConfigs *psc, __GLXdisplayPrivate *priv, int screen)
{
xGLXGetFBConfigsReq *fb_req;
xGLXGetFBConfigsSGIXReq *sgi_req;
xGLXVendorPrivateWithReplyReq *vpreq;
xGLXGetFBConfigsReply reply;
__GLXscreenConfigs *psc;
Display *dpy = priv->dpy;
psc = priv->screenConfigs + screen;
psc->serverGLXexts =
__glXQueryServerString(dpy, priv->majorOpcode, screen, GLX_EXTENSIONS);
@@ -580,6 +581,32 @@ getFBConfigs(Display * dpy, __GLXdisplayPrivate * priv, int screen)
return psc->configs != NULL;
}
_X_HIDDEN Bool
glx_screen_init(__GLXscreenConfigs *psc,
int screen, __GLXdisplayPrivate * priv)
{
/* Initialize per screen dynamic client GLX extensions */
psc->ext_list_first_time = GL_TRUE;
psc->scr = screen;
psc->dpy = priv->dpy;
getVisualConfigs(psc, priv, screen);
getFBConfigs(psc, priv, screen);
return GL_TRUE;
}
static __GLXscreenConfigs *
createIndirectScreen()
{
__GLXscreenConfigs *psc;
psc = Xmalloc(sizeof *psc);
memset(psc, 0, sizeof *psc);
return psc;
}
static GLboolean
AllocAndFetchScreenConfigs(Display * dpy, __GLXdisplayPrivate * priv)
{
@@ -590,12 +617,10 @@ AllocAndFetchScreenConfigs(Display * dpy, __GLXdisplayPrivate * priv)
** First allocate memory for the array of per screen configs.
*/
screens = ScreenCount(dpy);
psc = (__GLXscreenConfigs *) Xmalloc(screens * sizeof(__GLXscreenConfigs));
if (!psc) {
priv->screenConfigs = Xmalloc(screens * sizeof *priv->screenConfigs);
if (!priv->screenConfigs) {
return GL_FALSE;
}
memset(psc, 0, screens * sizeof(__GLXscreenConfigs));
priv->screenConfigs = psc;
priv->serverGLXversion =
__glXQueryServerString(dpy, priv->majorOpcode, 0, GLX_VERSION);
@@ -604,11 +629,12 @@ AllocAndFetchScreenConfigs(Display * dpy, __GLXdisplayPrivate * priv)
return GL_FALSE;
}
for (i = 0; i < screens; i++, psc++) {
getFBConfigs(dpy, priv, i);
getVisualConfigs(dpy, priv, i);
psc->scr = i;
psc->dpy = dpy;
for (i = 0; i < screens; i++) {
psc = createIndirectScreen();
if (!psc)
return GL_FALSE;
glx_screen_init(psc, i, priv);
priv->screenConfigs[i] = psc;
}
SyncHandle();
@@ -226,7 +226,7 @@ const __GLcontextModes *
x11_screen_get_glx_configs(struct x11_screen *xscr)
{
return (x11_screen_init_glx(xscr))
? xscr->glx_dpy->screenConfigs[xscr->number].configs
? xscr->glx_dpy->screenConfigs[xscr->number]->configs
: NULL;
}
@@ -237,7 +237,7 @@ const __GLcontextModes *
x11_screen_get_glx_visuals(struct x11_screen *xscr)
{
return (x11_screen_init_glx(xscr))
? xscr->glx_dpy->screenConfigs[xscr->number].visuals
? xscr->glx_dpy->screenConfigs[xscr->number]->visuals
: NULL;
}