glx: Move driver_configs to DRI screen privates

This commit is contained in:
Kristian Høgsberg 2010-07-19 22:12:22 -04:00
parent e3e8196c02
commit bab13969d8
7 changed files with 22 additions and 12 deletions

View File

@ -86,6 +86,7 @@ struct dri2_screen {
const __DRI2flushExtension *f;
const __DRI2configQueryExtension *config;
const __DRItexBufferExtension *texBuffer;
const __DRIconfig **driver_configs;
void *driver;
int fd;
@ -428,6 +429,7 @@ dri2DestroyScreen(__GLXscreenConfigs *base)
/* Free the direct rendering per screen data */
(*psc->core->destroyScreen) (psc->driScreen);
driDestroyConfigs(psc->driver_configs);
close(psc->fd);
Xfree(psc);
}
@ -785,7 +787,7 @@ dri2CreateScreen(int screen, __GLXdisplayPrivate * priv)
psc->base.visuals =
driConvertConfigs(psc->core, psc->base.visuals, driver_configs);
psc->base.driver_configs = driver_configs;
psc->driver_configs = driver_configs;
psp = &psc->vtable;
psc->base.driScreen = psp;

View File

@ -336,6 +336,16 @@ driConvertConfigs(const __DRIcoreExtension * core,
return head.next;
}
_X_HIDDEN void
driDestroyConfigs(const __DRIconfig **configs)
{
int i;
for (i = 0; configs[i]; i++)
free((__DRIconfig *) configs[i]);
free(configs);
}
/* Bind extensions common to DRI1 and DRI2 */
_X_HIDDEN void
driBindCommonExtensions(__GLXscreenConfigs *psc,

View File

@ -48,6 +48,8 @@ extern __GLcontextModes *driConvertConfigs(const __DRIcoreExtension * core,
__GLcontextModes * modes,
const __DRIconfig ** configs);
extern void driDestroyConfigs(const __DRIconfig **configs);
extern const __DRIsystemTimeExtension systemTimeExtension;
extern void InfoMessageF(const char *f, ...);

View File

@ -69,6 +69,7 @@ struct dri_screen
const __DRIcoreExtension *core;
const __DRIswapControlExtension *swapControl;
const __DRImediaStreamCounterExtension *msc;
const __DRIconfig **driver_configs;
void *driver;
int fd;
@ -448,7 +449,7 @@ CallCreateNewScreen(Display *dpy, int scrn, struct dri_screen *psc,
psc->base.visuals =
driConvertConfigs(psc->core, psc->base.visuals, driver_configs);
psc->base.driver_configs = driver_configs;
psc->driver_configs = driver_configs;
/* Visuals with depth != screen depth are subject to automatic compositing
* in the X server, so DRI1 can't render to them properly. Mark them as
@ -664,6 +665,7 @@ driDestroyScreen(__GLXscreenConfigs *base)
/* Free the direct rendering per screen data */
if (psc->driScreen)
(*psc->core->destroyScreen) (psc->driScreen);
driDestroyConfigs(psc->driver_configs);
psc->driScreen = NULL;
if (psc->driver)
dlclose(psc->driver);

View File

@ -48,6 +48,8 @@ struct drisw_screen
__GLXDRIscreen vtable;
const __DRIcoreExtension *core;
const __DRIswrastExtension *swrast;
const __DRIconfig **driver_configs;
void *driver;
};
@ -382,6 +384,7 @@ driDestroyScreen(__GLXscreenConfigs *base)
/* Free the direct rendering per screen data */
(*psc->core->destroyScreen) (psc->driScreen);
driDestroyConfigs(psc->driver_configs);
psc->driScreen = NULL;
if (psc->driver)
dlclose(psc->driver);
@ -456,7 +459,7 @@ driCreateScreen(int screen, __GLXdisplayPrivate *priv)
psc->base.visuals =
driConvertConfigs(psc->core, psc->base.visuals, driver_configs);
psc->base.driver_configs = driver_configs;
psc->driver_configs = driver_configs;
psp = &psc->vtable;
psc->base.driScreen = psp;

View File

@ -534,8 +534,6 @@ struct __GLXscreenConfigsRec
__GLXDRIscreen *driScreen;
const __DRIconfig **driver_configs;
#ifdef __DRI_COPY_SUB_BUFFER
const __DRIcopySubBufferExtension *driCopySubBuffer;
#endif

View File

@ -260,13 +260,6 @@ FreeScreenConfigs(__GLXdisplayPrivate * priv)
Xfree((char *) psc->serverGLXexts);
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
if (psc->driver_configs) {
unsigned int j;
for (j = 0; psc->driver_configs[j]; j++)
free((__DRIconfig *) psc->driver_configs[j]);
free(psc->driver_configs);
psc->driver_configs = NULL;
}
if (psc->driScreen) {
psc->driScreen->destroyScreen(psc);
psc->driScreen = NULL;