From a1ea6f6198d80f716936a308cfab235f18a014e1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristian=20H=C3=B8gsberg?= Date: Sat, 8 Mar 2008 19:15:50 -0500 Subject: [PATCH] Convert driCreateScreen and driDestroyScreen to function pointers. We avoid leaking the symbols and will be able to replace them with DRI2 implementation later on. --- src/glx/x11/dri_glx.c | 30 ++++++++++++++++-------------- src/glx/x11/glxclient.h | 8 +++++--- src/glx/x11/glxext.c | 4 ++-- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/src/glx/x11/dri_glx.c b/src/glx/x11/dri_glx.c index fd824f386da..194517a6577 100644 --- a/src/glx/x11/dri_glx.c +++ b/src/glx/x11/dri_glx.c @@ -657,9 +657,20 @@ CallCreateNewScreen(Display *dpy, int scrn, __GLXscreenConfigs *psc, return psp; } -void -driCreateScreen(__GLXscreenConfigs *psc, int screen, - __GLXdisplayPrivate *priv) +static void driDestroyScreen(__GLXscreenConfigs *psc) +{ + /* Free the direct rendering per screen data */ + if (psc->driScreen.private) + (*psc->driScreen.destroyScreen)(&psc->driScreen); + psc->driScreen.private = NULL; + if (psc->drawHash) + __glxHashDestroy(psc->drawHash); + if (psc->driver) + dlclose(psc->driver); +} + +static void driCreateScreen(__GLXscreenConfigs *psc, int screen, + __GLXdisplayPrivate *priv) { PFNCREATENEWSCREENFUNC createNewScreen; __GLXDRIdisplayPrivate *pdp; @@ -685,18 +696,8 @@ driCreateScreen(__GLXscreenConfigs *psc, int screen, CallCreateNewScreen(psc->dpy, screen, psc, pdp, createNewScreen); if (psc->driScreen.private != NULL) __glXScrEnableDRIExtension(psc); -} -void driDestroyScreen(__GLXscreenConfigs *psc) -{ - /* Free the direct rendering per screen data */ - if (psc->driScreen.private) - (*psc->driScreen.destroyScreen)(&psc->driScreen); - psc->driScreen.private = NULL; - if (psc->drawHash) - __glxHashDestroy(psc->drawHash); - if (psc->driver) - dlclose(psc->driver); + psc->driDestroyScreen = driDestroyScreen; } /* Called from __glXFreeDisplayPrivate. @@ -735,6 +736,7 @@ __GLXDRIdisplay *driCreateDisplay(Display *dpy) pdpyp->driPatch = patch; pdpyp->base.destroyDisplay = driDestroyDisplay; + pdpyp->base.createScreen = driCreateScreen; return (void *)pdpyp; } diff --git a/src/glx/x11/glxclient.h b/src/glx/x11/glxclient.h index b3f07a30b6e..99dbb597a68 100644 --- a/src/glx/x11/glxclient.h +++ b/src/glx/x11/glxclient.h @@ -98,6 +98,9 @@ struct __GLXDRIdisplayRec { * Method to destroy the private DRI display data. */ void (*destroyDisplay)(__GLXDRIdisplay *display); + + void (*createScreen)(__GLXscreenConfigs *psc, int screen, + __GLXdisplayPrivate *priv); }; /* @@ -105,9 +108,6 @@ struct __GLXDRIdisplayRec { ** dependent methods. */ extern __GLXDRIdisplay *driCreateDisplay(Display *dpy); -extern void driCreateScreen(__GLXscreenConfigs *psc, int screen, - __GLXdisplayPrivate *priv); -extern void driDestroyScreen(__GLXscreenConfigs *psc); extern void DRI_glXUseXFont( Font font, int first, int count, int listbase ); @@ -436,6 +436,8 @@ struct __GLXscreenConfigsRec { int scr; void *driver; + void (*driDestroyScreen)(__GLXscreenConfigs *psc); + #ifdef __DRI_COPY_SUB_BUFFER __DRIcopySubBufferExtension *copySubBuffer; #endif diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c index b4a03e40577..f71c049acd7 100644 --- a/src/glx/x11/glxext.c +++ b/src/glx/x11/glxext.c @@ -349,7 +349,7 @@ static void FreeScreenConfigs(__GLXdisplayPrivate *priv) Xfree((char*) psc->serverGLXexts); #ifdef GLX_DIRECT_RENDERING - driDestroyScreen(psc); + psc->driDestroyScreen(psc); #endif } XFree((char*) priv->screenConfigs); @@ -772,7 +772,7 @@ static Bool AllocAndFetchScreenConfigs(Display *dpy, __GLXdisplayPrivate *priv) psc->scr = i; psc->dpy = dpy; #ifdef GLX_DIRECT_RENDERING - driCreateScreen(psc, i, priv); + (*priv->driDisplay->createScreen)(psc, i, priv); #endif } SyncHandle(); -- 2.30.2