summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2010-07-20 11:49:59 +0800
committerChia-I Wu <[email protected]>2010-07-20 12:39:23 +0800
commit87290a383be2eeffef4407eeb17c1070d1122b2f (patch)
treee9d0b2faad4cf7ab6632a4d8bfe2c107a48df2ff /src
parentc7ad2a4e79dcb3aadaa26a484feb4cd24c74074d (diff)
st/egl: Fixes for recent GLX cleanup.
Mainly, the type of __GLXdisplayPrivateRec::screenConfigs has changed from "__GLXscreenConfigs *" to "__GLXscreenConfigs **".
Diffstat (limited to 'src')
-rw-r--r--src/gallium/state_trackers/egl/x11/glxinit.c60
-rw-r--r--src/gallium/state_trackers/egl/x11/x11_screen.c4
2 files changed, 45 insertions, 19 deletions
diff --git a/src/gallium/state_trackers/egl/x11/glxinit.c b/src/gallium/state_trackers/egl/x11/glxinit.c
index dd351899e21..809a0987e55 100644
--- a/src/gallium/state_trackers/egl/x11/glxinit.c
+++ b/src/gallium/state_trackers/egl/x11/glxinit.c
@@ -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();
diff --git a/src/gallium/state_trackers/egl/x11/x11_screen.c b/src/gallium/state_trackers/egl/x11/x11_screen.c
index 6a22b30c4d4..bc6482ab15d 100644
--- a/src/gallium/state_trackers/egl/x11/x11_screen.c
+++ b/src/gallium/state_trackers/egl/x11/x11_screen.c
@@ -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;
}