diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/glx/x11/glxclient.h | 4 | ||||
-rw-r--r-- | src/glx/x11/glxcmds.c | 34 | ||||
-rw-r--r-- | src/glx/x11/glxext.c | 11 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i915/intel_screen.c | 8 | ||||
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_screen.c | 26 | ||||
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_screen.h | 2 |
6 files changed, 54 insertions, 31 deletions
diff --git a/src/glx/x11/glxclient.h b/src/glx/x11/glxclient.h index 09ae70212ac..b60d8a0b904 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 6fda5125db7..e2deca59686 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 1563ca63943..8275b4b9e07 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 */ } } diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c index f507a3bf05f..27bf5e12a20 100644 --- a/src/mesa/drivers/dri/i915/intel_screen.c +++ b/src/mesa/drivers/dri/i915/intel_screen.c @@ -419,9 +419,17 @@ intelUpdateScreenFromSAREA(intelScreenPrivate * intelScreen, intelPrintSAREA(sarea); } +static const __DRIallocateExtension intelAllocateExtension = { + { __DRI_ALLOCATE }, + intelAllocateMemoryMESA, + intelFreeMemoryMESA, + intelGetMemoryOffsetMESA +}; + static const __DRIextension *intelExtensions[] = { &driCopySubBufferExtension.base, &driSwapControlExtension.base, + &intelAllocateExtension.base, NULL }; diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 46160babb01..362d70f9e57 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -332,6 +332,17 @@ radeonFillInModes( unsigned pixel_bits, unsigned depth_bits, return modes; } +#if RADEON_COMMON && defined(RADEON_COMMON_FOR_R200) + +static const __DRIallocateExtension r200AllocateExtension = { + { __DRI_ALLOCATE }, + r200AllocateMemoryMESA, + r200FreeMemoryMESA, + r200GetMemoryOffsetMESA +}; + +#endif + /* Create the device specific screen private data struct. */ static radeonScreenPtr @@ -741,22 +752,17 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) } (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" ); - if (IS_R200_CLASS(screen)) - (*glx_enable_extension)( sPriv->psc, "GLX_MESA_allocate_memory" ); - (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); } - screen->extensions[i++] = NULL; - sPriv->extensions = screen->extensions; #if RADEON_COMMON && defined(RADEON_COMMON_FOR_R200) - if (IS_R200_CLASS(screen)) { - sPriv->psc->allocateMemory = (void *) r200AllocateMemoryMESA; - sPriv->psc->freeMemory = (void *) r200FreeMemoryMESA; - sPriv->psc->memoryOffset = (void *) r200GetMemoryOffsetMESA; - } + if (IS_R200_CLASS(screen)) + screen->extensions[i++] = &r200AllocateExtension.base; #endif + screen->extensions[i++] = NULL; + sPriv->extensions = screen->extensions; + screen->driScreen = sPriv; screen->sarea_priv_offset = dri_priv->sarea_priv_offset; return screen; diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.h b/src/mesa/drivers/dri/radeon/radeon_screen.h index eceab53f5f5..954096f6770 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.h +++ b/src/mesa/drivers/dri/radeon/radeon_screen.h @@ -104,7 +104,7 @@ typedef struct { /* Configuration cache with default values for all contexts */ driOptionCache optionCache; - const __DRIextension *extensions[3]; + const __DRIextension *extensions[4]; } radeonScreenRec, *radeonScreenPtr; #define IS_R100_CLASS(screen) \ |