diff options
author | Kristian Høgsberg <krh@redhat.com> | 2008-03-08 20:34:24 -0500 |
---|---|---|
committer | Kristian Høgsberg <krh@redhat.com> | 2008-03-08 20:34:24 -0500 |
commit | 92d2a78f8d2d56cfadb4cb5323adec32fe73e353 (patch) | |
tree | 32b0e8b44cf2c90fe5b244d2f887fb7bd2fa1112 /src/glx | |
parent | 53dc86363665b9b22f042c5d950b7de0ed02b4c8 (diff) |
Introduce __GLXDRIscreen so we can start moving function pointers in there.
Temporarily rename the __DRIscreen member to __driScreen. Eventually,
we'll move that into __GLXDRIscreen and only access it in dri_glx.c.
Diffstat (limited to 'src/glx')
-rw-r--r-- | src/glx/x11/dri_glx.c | 44 | ||||
-rw-r--r-- | src/glx/x11/glxclient.h | 24 | ||||
-rw-r--r-- | src/glx/x11/glxcmds.c | 20 | ||||
-rw-r--r-- | src/glx/x11/glxext.c | 16 | ||||
-rw-r--r-- | src/glx/x11/glxextensions.c | 2 |
5 files changed, 58 insertions, 48 deletions
diff --git a/src/glx/x11/dri_glx.c b/src/glx/x11/dri_glx.c index 2b43a74e66..c96356fd63 100644 --- a/src/glx/x11/dri_glx.c +++ b/src/glx/x11/dri_glx.c @@ -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. diff --git a/src/glx/x11/glxclient.h b/src/glx/x11/glxclient.h index 6ac92cf850..b8ba496738 100644 --- a/src/glx/x11/glxclient.h +++ b/src/glx/x11/glxclient.h @@ -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; diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c index e8cb7b96f5..15c9d19c97 100644 --- a/src/glx/x11/glxcmds.c +++ b/src/glx/x11/glxcmds.c @@ -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; diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c index f71c049acd..372dbfca65 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 - 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); diff --git a/src/glx/x11/glxextensions.c b/src/glx/x11/glxextensions.c index 84f556e0cc..6d78c7067d 100644 --- a/src/glx/x11/glxextensions.c +++ b/src/glx/x11/glxextensions.c @@ -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) { |