Convert driCreateScreen and driDestroyScreen to function pointers.
authorKristian Høgsberg <krh@redhat.com>
Sun, 9 Mar 2008 00:15:50 +0000 (19:15 -0500)
committerKristian Høgsberg <krh@redhat.com>
Sun, 9 Mar 2008 00:15:50 +0000 (19:15 -0500)
We avoid leaking the symbols and will be able to replace them with
DRI2 implementation later on.

src/glx/x11/dri_glx.c
src/glx/x11/glxclient.h
src/glx/x11/glxext.c

index fd824f386dac579c5fc9b62e8c5f692ae17f524f..194517a65773d1270169b959415de3db5c901f7a 100644 (file)
@@ -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;
 }
index b3f07a30b6e45b5d7f838e10c39c8c7944bc96af..99dbb597a685df4e33d3efaee3fb268a87cde5a4 100644 (file)
@@ -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
index b4a03e4057797ba1d26f618c3e167d91f8231011..f71c049acd736d04daccb59c91445b6a354fdca8 100644 (file)
@@ -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();