From bab13969d8bf3ff9259524c3f4ab96d81485ccef Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristian=20H=C3=B8gsberg?= Date: Mon, 19 Jul 2010 22:12:22 -0400 Subject: [PATCH] glx: Move driver_configs to DRI screen privates --- src/glx/dri2_glx.c | 4 +++- src/glx/dri_common.c | 10 ++++++++++ src/glx/dri_common.h | 2 ++ src/glx/dri_glx.c | 4 +++- src/glx/drisw_glx.c | 5 ++++- src/glx/glxclient.h | 2 -- src/glx/glxext.c | 7 ------- 7 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c index 6ac03cf0cfb..df7ad477ffd 100644 --- a/src/glx/dri2_glx.c +++ b/src/glx/dri2_glx.c @@ -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; diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c index b1d9f320210..796654a65d0 100644 --- a/src/glx/dri_common.c +++ b/src/glx/dri_common.c @@ -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, diff --git a/src/glx/dri_common.h b/src/glx/dri_common.h index 7ed7767c92b..509ddab8edd 100644 --- a/src/glx/dri_common.h +++ b/src/glx/dri_common.h @@ -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, ...); diff --git a/src/glx/dri_glx.c b/src/glx/dri_glx.c index d3facca8434..aba7b1b844e 100644 --- a/src/glx/dri_glx.c +++ b/src/glx/dri_glx.c @@ -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); diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c index 0ea846b6911..94866269c47 100644 --- a/src/glx/drisw_glx.c +++ b/src/glx/drisw_glx.c @@ -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; diff --git a/src/glx/glxclient.h b/src/glx/glxclient.h index adfa3ce1b6b..c6c02aee1ea 100644 --- a/src/glx/glxclient.h +++ b/src/glx/glxclient.h @@ -534,8 +534,6 @@ struct __GLXscreenConfigsRec __GLXDRIscreen *driScreen; - const __DRIconfig **driver_configs; - #ifdef __DRI_COPY_SUB_BUFFER const __DRIcopySubBufferExtension *driCopySubBuffer; #endif diff --git a/src/glx/glxext.c b/src/glx/glxext.c index 65aacc5887d..9c3c7a4840a 100644 --- a/src/glx/glxext.c +++ b/src/glx/glxext.c @@ -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; -- 2.30.2