From 78a6aa57a0155d72280dd91c05513c847bf76f3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Wed, 16 May 2007 14:10:29 -0400 Subject: Move GLX_MESA_allocate_memory related functions to new extension mechanism. --- src/glx/x11/glxclient.h | 4 ++++ src/glx/x11/glxcmds.c | 34 ++++++++++++++-------------------- src/glx/x11/glxext.c | 11 +++++++++++ 3 files changed, 29 insertions(+), 20 deletions(-) (limited to 'src/glx/x11') diff --git a/src/glx/x11/glxclient.h b/src/glx/x11/glxclient.h index 09ae70212a..b60d8a0b90 100644 --- a/src/glx/x11/glxclient.h +++ b/src/glx/x11/glxclient.h @@ -485,6 +485,10 @@ struct __GLXscreenConfigsRec { __DRIswapControlExtension *swapControl; #endif +#ifdef __DRI_ALLOCATE + __DRIallocateExtension *allocate; +#endif + #endif /** diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c index 6fda5125db..e2deca5968 100644 --- a/src/glx/x11/glxcmds.c +++ b/src/glx/x11/glxcmds.c @@ -2371,16 +2371,14 @@ PUBLIC void *glXAllocateMemoryMESA(Display *dpy, int scrn, size_t size, float readFreq, float writeFreq, float priority) { -#ifdef GLX_DIRECT_RENDERING +#ifdef __DRI_ALLOCATE __GLXscreenConfigs * const psc = GetGLXScreenConfigs( dpy, scrn ); - if ( __glXExtensionBitIsEnabled( psc, MESA_allocate_memory_bit ) ) { - if (psc && psc->driScreen.private && psc->driScreen.allocateMemory) { - return (*psc->driScreen.allocateMemory)( &psc->driScreen, size, - readFreq, writeFreq, - priority ); - } - } + if (psc && psc->allocate) + return (*psc->allocate->allocateMemory)( &psc->driScreen, size, + readFreq, writeFreq, + priority ); + #else (void) dpy; (void) scrn; @@ -2396,14 +2394,12 @@ PUBLIC void *glXAllocateMemoryMESA(Display *dpy, int scrn, PUBLIC void glXFreeMemoryMESA(Display *dpy, int scrn, void *pointer) { -#ifdef GLX_DIRECT_RENDERING +#ifdef __DRI_ALLOCATE __GLXscreenConfigs * const psc = GetGLXScreenConfigs( dpy, scrn ); - if ( __glXExtensionBitIsEnabled( psc, MESA_allocate_memory_bit ) ) { - if (psc && psc->driScreen.private && psc->driScreen.freeMemory) { - (*psc->driScreen.freeMemory)( &psc->driScreen, pointer ); - } - } + if (psc && psc->allocate) + (*psc->allocate->freeMemory)( &psc->driScreen, pointer ); + #else (void) dpy; (void) scrn; @@ -2415,14 +2411,12 @@ PUBLIC void glXFreeMemoryMESA(Display *dpy, int scrn, void *pointer) PUBLIC GLuint glXGetMemoryOffsetMESA( Display *dpy, int scrn, const void *pointer ) { -#ifdef GLX_DIRECT_RENDERING +#ifdef __DRI_ALLOCATE __GLXscreenConfigs * const psc = GetGLXScreenConfigs( dpy, scrn ); - if ( __glXExtensionBitIsEnabled( psc, MESA_allocate_memory_bit ) ) { - if (psc && psc->driScreen.private && psc->driScreen.memoryOffset) { - return (*psc->driScreen.memoryOffset)( &psc->driScreen, pointer ); - } - } + if (psc && psc->allocate) + return (*psc->allocate->memoryOffset)( &psc->driScreen, pointer ); + #else (void) dpy; (void) scrn; diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c index 1563ca6394..8275b4b9e0 100644 --- a/src/glx/x11/glxext.c +++ b/src/glx/x11/glxext.c @@ -1039,6 +1039,17 @@ static void queryExtensions(__GLXscreenConfigs *psc) } #endif +#ifdef __DRI_ALLOCATE + if (strcmp(extensions[i]->name, __DRI_ALLOCATE) == 0) { + psc->allocate = (__DRIallocateExtension *) extensions[i]; + __glXScrEnableExtension(&psc->driScreen, + "GLX_SGI_swap_control"); + __glXScrEnableExtension(&psc->driScreen, + "GLX_MESA_swap_control"); + + } +#endif + /* Ignore unknown extensions */ } } -- cgit v1.2.3