Introduce __GLXDRIscreen so we can start moving function pointers in there.
authorKristian Høgsberg <krh@redhat.com>
Sun, 9 Mar 2008 01:34:24 +0000 (20:34 -0500)
committerKristian Høgsberg <krh@redhat.com>
Sun, 9 Mar 2008 01:34:24 +0000 (20:34 -0500)
Temporarily rename the __DRIscreen member to __driScreen.  Eventually,
we'll move that into __GLXDRIscreen and only access it in dri_glx.c.

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

index 2b43a74e66a1eaf4ec705913f083813b229f268f..c96356fd634bbf00df2b9dd470b5732d3f372e67 100644 (file)
@@ -601,7 +601,7 @@ CallCreateNewScreen(Display *dpy, int scrn, __GLXscreenConfigs *psc,
                                    err_msg = "InitDriver";
                                    err_extra = NULL;
                                    psp = (*createNewScreen)(scrn,
-                                                            &psc->driScreen,
+                                                            &psc->__driScreen,
                                                             & ddx_version,
                                                             & dri_version,
                                                             & drm_version,
@@ -666,7 +666,7 @@ static void driCreateContext(__GLXscreenConfigs *psc,
     drm_context_t hwContext;
     __DRIcontext *shared;
 
-    if (psc && psc->driScreen.private) {
+    if (psc && psc->driScreen) {
        shared = (shareList != NULL) ? &shareList->driContext : NULL;
 
        if (!XF86DRICreateContextWithConfig(psc->dpy, psc->scr,
@@ -676,11 +676,11 @@ static void driCreateContext(__GLXscreenConfigs *psc,
            return;
 
        gc->driContext.private = 
-           (*psc->driScreen.createNewContext)( &psc->driScreen,
-                                               mode, renderType,
-                                               shared,
-                                               hwContext,
-                                               &gc->driContext );
+           (*psc->__driScreen.createNewContext)( &psc->__driScreen,
+                                                 mode, renderType,
+                                                 shared,
+                                                 hwContext,
+                                                 &gc->driContext );
        if (gc->driContext.private) {
            gc->isDirect = GL_TRUE;
            gc->screen = mode->screen;
@@ -696,28 +696,30 @@ static void driCreateContext(__GLXscreenConfigs *psc,
 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->__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)
+static __GLXDRIscreen *driCreateScreen(__GLXscreenConfigs *psc, int screen,
+                                      __GLXdisplayPrivate *priv)
 {
     PFNCREATENEWSCREENFUNC createNewScreen;
     __GLXDRIdisplayPrivate *pdp;
+    __GLXDRIscreen *psp;
 
-    if (priv->driDisplay == NULL)
-       return;
+    psp = Xmalloc(sizeof *psp);
+    if (psp == NULL)
+       return NULL;
 
     /* Create drawable hash */
     psc->drawHash = __glxHashCreate();
     if ( psc->drawHash == NULL )
-       return;
+       return NULL;
 
     /* Initialize per screen dynamic client GLX extensions */
     psc->ext_list_first_time = GL_TRUE;
@@ -725,16 +727,18 @@ static void driCreateScreen(__GLXscreenConfigs *psc, int screen,
     psc->driver = driGetDriver(priv->dpy, screen);
     createNewScreen = dlsym(psc->driver, createNewScreenName);
     if (createNewScreenName == NULL)
-       return;
+       return NULL;
 
     pdp = (__GLXDRIdisplayPrivate *) priv->driDisplay;
-    psc->driScreen.private =
+    psc->__driScreen.private =
        CallCreateNewScreen(psc->dpy, screen, psc, pdp, createNewScreen);
-    if (psc->driScreen.private != NULL)
+    if (psc->__driScreen.private != NULL)
        __glXScrEnableDRIExtension(psc);
 
-    psc->driDestroyScreen = driDestroyScreen;
-    psc->driCreateContext = driCreateContext;
+    psp->destroyScreen = driDestroyScreen;
+    psp->createContext = driCreateContext;
+
+    return psp;
 }
 
 /* Called from __glXFreeDisplayPrivate.
index 6ac92cf850afbb45e987bf90d5e4262e62874602..b8ba49673872b77926990efe5516222358b4b8c6 100644 (file)
@@ -93,14 +93,25 @@ typedef struct _glapi_table __GLapi;
  * \c driCreateDisplay call.
  */
 typedef struct __GLXDRIdisplayRec __GLXDRIdisplay;
+typedef struct __GLXDRIscreenRec __GLXDRIscreen;
+
 struct __GLXDRIdisplayRec {
     /**
      * Method to destroy the private DRI display data.
      */
     void (*destroyDisplay)(__GLXDRIdisplay *display);
 
-    void (*createScreen)(__GLXscreenConfigs *psc, int screen,
-                        __GLXdisplayPrivate *priv);
+    __GLXDRIscreen *(*createScreen)(__GLXscreenConfigs *psc, int screen,
+                                   __GLXdisplayPrivate *priv);
+};
+
+struct __GLXDRIscreenRec {
+
+    void (*destroyScreen)(__GLXscreenConfigs *psc);
+
+    void (*createContext)(__GLXscreenConfigs *psc,
+                         const __GLcontextModes *mode,
+                         GLXContext gc, GLXContext shareList, int renderType);
 };
 
 /*
@@ -430,18 +441,13 @@ struct __GLXscreenConfigsRec {
     /**
      * Per screen direct rendering interface functions and data.
      */
-    __DRIscreen driScreen;
+    __DRIscreen __driScreen;
     __glxHashTable *drawHash;
     Display *dpy;
     int scr;
     void *driver;
 
-    void (*driDestroyScreen)(__GLXscreenConfigs *psc);
-
-    void (*driCreateContext)(__GLXscreenConfigs *psc,
-                            const __GLcontextModes *mode,
-                            GLXContext gc,
-                            GLXContext shareList, int renderType);
+    __GLXDRIscreen *driScreen;
 
 #ifdef __DRI_COPY_SUB_BUFFER
     __DRIcopySubBufferExtension *copySubBuffer;
index e8cb7b96f57dd4eef2a1438caa312bfda9a4fd44..15c9d19c97d25c171d370a22082c7831d2903673 100644 (file)
@@ -398,7 +398,7 @@ CreateContext(Display *dpy, XVisualInfo *vis,
                mode = fbconfig;
            }
 
-           psc->driCreateContext(psc, mode, gc, shareList, renderType);
+           psc->driScreen->createContext(psc, mode, gc, shareList, renderType);
        }
 #endif
 
@@ -1307,7 +1307,7 @@ PUBLIC const char *glXQueryExtensionsString( Display *dpy, int screen )
 
        __glXCalculateUsableExtensions(psc,
 #ifdef GLX_DIRECT_RENDERING
-                                      (psc->driScreen.private != NULL),
+                                      (psc->driScreen != NULL),
 #else
                                       GL_FALSE,
 #endif
@@ -1769,7 +1769,7 @@ static int __glXSwapIntervalMESA(unsigned int interval)
       __GLXscreenConfigs * const psc = GetGLXScreenConfigs( gc->currentDpy,
                                                            gc->screen );
       
-      if ( (psc != NULL) && (psc->driScreen.private != NULL) ) {
+      if ( (psc != NULL) && (psc->driScreen != NULL) ) {
         __DRIdrawable * const pdraw = 
             GetDRIDrawable(gc->currentDpy, gc->currentDrawable, NULL);
         if (psc->swapControl != NULL && pdraw != NULL) {
@@ -1795,7 +1795,7 @@ static int __glXGetSwapIntervalMESA(void)
       __GLXscreenConfigs * const psc = GetGLXScreenConfigs( gc->currentDpy,
                                                            gc->screen );
       
-      if ( (psc != NULL) && (psc->driScreen.private != NULL) ) {
+      if ( (psc != NULL) && (psc->driScreen != NULL) ) {
         __DRIdrawable * const pdraw = 
             GetDRIDrawable(gc->currentDpy, gc->currentDrawable, NULL);
         if (psc->swapControl != NULL && pdraw != NULL) {
@@ -1919,13 +1919,13 @@ static int __glXGetVideoSyncSGI(unsigned int *count)
    if ( (gc != NULL) && gc->isDirect ) {
       __GLXscreenConfigs * const psc = GetGLXScreenConfigs( gc->currentDpy,
                                                            gc->screen );
-      if ( psc->msc && psc->driScreen.private ) {
+      if ( psc->msc && psc->driScreen ) {
           __DRIdrawable * const pdraw = 
               GetDRIDrawable(gc->currentDpy, gc->currentDrawable, NULL);
          int64_t temp; 
          int ret;
  
-         ret = (*psc->msc->getDrawableMSC)(&psc->driScreen, pdraw, &temp);
+         ret = (*psc->msc->getDrawableMSC)(&psc->__driScreen, pdraw, &temp);
          *count = (unsigned) temp;
 
          return (ret == 0) ? 0 : GLX_BAD_CONTEXT;
@@ -1948,7 +1948,7 @@ static int __glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count
    if ( (gc != NULL) && gc->isDirect ) {
       __GLXscreenConfigs * const psc = GetGLXScreenConfigs( gc->currentDpy,
                                                            gc->screen );
-      if (psc->msc != NULL && psc->driScreen.private ) {
+      if (psc->msc != NULL && psc->driScreen ) {
         __DRIdrawable * const pdraw = 
             GetDRIDrawable(gc->currentDpy, gc->currentDrawable, NULL);
         int       ret;
@@ -2358,7 +2358,7 @@ PUBLIC void *glXAllocateMemoryMESA(Display *dpy, int scrn,
    __GLXscreenConfigs * const psc = GetGLXScreenConfigs( dpy, scrn );
 
    if (psc && psc->allocate)
-       return (*psc->allocate->allocateMemory)( &psc->driScreen, size,
+       return (*psc->allocate->allocateMemory)( &psc->__driScreen, size,
                                                readFreq, writeFreq,
                                                priority );
 
@@ -2381,7 +2381,7 @@ PUBLIC void glXFreeMemoryMESA(Display *dpy, int scrn, void *pointer)
    __GLXscreenConfigs * const psc = GetGLXScreenConfigs( dpy, scrn );
 
    if (psc && psc->allocate)
-        (*psc->allocate->freeMemory)( &psc->driScreen, pointer );
+        (*psc->allocate->freeMemory)( &psc->__driScreen, pointer );
 
 #else
    (void) dpy;
@@ -2398,7 +2398,7 @@ PUBLIC GLuint glXGetMemoryOffsetMESA( Display *dpy, int scrn,
    __GLXscreenConfigs * const psc = GetGLXScreenConfigs( dpy, scrn );
 
    if (psc && psc->allocate)
-       return (*psc->allocate->memoryOffset)( &psc->driScreen, pointer );
+       return (*psc->allocate->memoryOffset)( &psc->__driScreen, pointer );
 
 #else
    (void) dpy;
index f71c049acd736d04daccb59c91445b6a354fdca8..372dbfca657990e48176712a0bc7d6b74bdfef26 100644 (file)
@@ -349,7 +349,7 @@ static void FreeScreenConfigs(__GLXdisplayPrivate *priv)
        Xfree((char*) psc->serverGLXexts);
 
 #ifdef GLX_DIRECT_RENDERING
-       psc->driDestroyScreen(psc);
+       psc->driScreen->destroyScreen(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
-       (*priv->driDisplay->createScreen)(psc, i, priv);
+       psc->driScreen = (*priv->driDisplay->createScreen)(psc, i, priv);
 #endif
     }
     SyncHandle();
@@ -1206,12 +1206,12 @@ FetchDRIDrawable( Display *dpy, GLXDrawable drawable, GLXContext gc)
 
     /* Create a new drawable */
     pdraw->driDrawable.private =
-       (*sc->driScreen.createNewDrawable)(&sc->driScreen,
-                                          gc->mode,
-                                          &pdraw->driDrawable,
-                                          hwDrawable,
-                                          GLX_WINDOW_BIT,
-                                          empty_attribute_list);
+       (*sc->__driScreen.createNewDrawable)(&sc->__driScreen,
+                                            gc->mode,
+                                            &pdraw->driDrawable,
+                                            hwDrawable,
+                                            GLX_WINDOW_BIT,
+                                            empty_attribute_list);
 
     if (!pdraw->driDrawable.private) {
        XF86DRIDestroyDrawable(dpy, sc->scr, drawable);
index 84f556e0cc83a48f1d6252edfbf864ef6fc6b4d3..6d78c7067d1851c78d9629e0fda521bb3b2325f9 100644 (file)
@@ -367,7 +367,7 @@ __glXScrEnableDRIExtension(__GLXscreenConfigs *psc)
     __glXExtensionsCtr();
     __glXExtensionsCtrScreen(psc);
 
-    extensions = psc->driScreen.getExtensions(&psc->driScreen);
+    extensions = psc->__driScreen.getExtensions(&psc->__driScreen);
     for (i = 0; extensions[i]; i++) {
 #ifdef __DRI_COPY_SUB_BUFFER
        if (strcmp(extensions[i]->name, __DRI_COPY_SUB_BUFFER) == 0) {