Move GLX_MESA_allocate_memory related functions to new extension mechanism.
This commit is contained in:
parent
efaf90b03e
commit
78a6aa57a0
|
@ -57,9 +57,10 @@ typedef struct __DRIframebufferRec __DRIframebuffer;
|
||||||
typedef struct __DRIversionRec __DRIversion;
|
typedef struct __DRIversionRec __DRIversion;
|
||||||
typedef struct __DRIinterfaceMethodsRec __DRIinterfaceMethods;
|
typedef struct __DRIinterfaceMethodsRec __DRIinterfaceMethods;
|
||||||
|
|
||||||
typedef struct __DRIextensionRec __DRIextension;
|
typedef struct __DRIextensionRec __DRIextension;
|
||||||
typedef struct __DRIcopySubBufferExtensionRec __DRIcopySubBufferExtension;
|
typedef struct __DRIcopySubBufferExtensionRec __DRIcopySubBufferExtension;
|
||||||
typedef struct __DRIswapControlExtensionRec __DRIswapControlExtension;
|
typedef struct __DRIswapControlExtensionRec __DRIswapControlExtension;
|
||||||
|
typedef struct __DRIallocateExtensionRec __DRIallocateExtension;
|
||||||
/*@}*/
|
/*@}*/
|
||||||
|
|
||||||
|
|
||||||
|
@ -95,6 +96,22 @@ struct __DRIswapControlExtensionRec {
|
||||||
unsigned int (*getSwapInterval)(__DRIdrawable *drawable);
|
unsigned int (*getSwapInterval)(__DRIdrawable *drawable);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used by drivers that implement the GLX_MESA_allocate_memory.
|
||||||
|
*/
|
||||||
|
#define __DRI_ALLOCATE "DRI_Allocate"
|
||||||
|
struct __DRIallocateExtensionRec {
|
||||||
|
__DRIextension base;
|
||||||
|
|
||||||
|
void *(*allocateMemory)(__DRIscreen *screen, GLsizei size,
|
||||||
|
GLfloat readfreq, GLfloat writefreq,
|
||||||
|
GLfloat priority);
|
||||||
|
|
||||||
|
void (*freeMemory)(__DRIscreen *screen, GLvoid *pointer);
|
||||||
|
|
||||||
|
GLuint (*memoryOffset)(__DRIscreen *screen, const GLvoid *pointer);
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \name Functions provided by the driver loader.
|
* \name Functions provided by the driver loader.
|
||||||
*/
|
*/
|
||||||
|
@ -340,21 +357,6 @@ struct __DRIscreenRec {
|
||||||
*/
|
*/
|
||||||
int (*getMSC)(__DRIscreen *screen, int64_t *msc);
|
int (*getMSC)(__DRIscreen *screen, int64_t *msc);
|
||||||
|
|
||||||
/**
|
|
||||||
* Functions associated with MESA_allocate_memory.
|
|
||||||
*
|
|
||||||
* \since Internal API version 20030815.
|
|
||||||
*/
|
|
||||||
/*@{*/
|
|
||||||
void *(*allocateMemory)(__DRIscreen *screen, GLsizei size,
|
|
||||||
GLfloat readfreq, GLfloat writefreq,
|
|
||||||
GLfloat priority);
|
|
||||||
|
|
||||||
void (*freeMemory)(__DRIscreen *screen, GLvoid *pointer);
|
|
||||||
|
|
||||||
GLuint (*memoryOffset)(__DRIscreen *screen, const GLvoid *pointer);
|
|
||||||
/*@}*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method to create the private DRI context data and initialize the
|
* Method to create the private DRI context data and initialize the
|
||||||
* context dependent methods.
|
* context dependent methods.
|
||||||
|
|
|
@ -485,6 +485,10 @@ struct __GLXscreenConfigsRec {
|
||||||
__DRIswapControlExtension *swapControl;
|
__DRIswapControlExtension *swapControl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __DRI_ALLOCATE
|
||||||
|
__DRIallocateExtension *allocate;
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -2371,16 +2371,14 @@ PUBLIC void *glXAllocateMemoryMESA(Display *dpy, int scrn,
|
||||||
size_t size, float readFreq,
|
size_t size, float readFreq,
|
||||||
float writeFreq, float priority)
|
float writeFreq, float priority)
|
||||||
{
|
{
|
||||||
#ifdef GLX_DIRECT_RENDERING
|
#ifdef __DRI_ALLOCATE
|
||||||
__GLXscreenConfigs * const psc = GetGLXScreenConfigs( dpy, scrn );
|
__GLXscreenConfigs * const psc = GetGLXScreenConfigs( dpy, scrn );
|
||||||
|
|
||||||
if ( __glXExtensionBitIsEnabled( psc, MESA_allocate_memory_bit ) ) {
|
if (psc && psc->allocate)
|
||||||
if (psc && psc->driScreen.private && psc->driScreen.allocateMemory) {
|
return (*psc->allocate->allocateMemory)( &psc->driScreen, size,
|
||||||
return (*psc->driScreen.allocateMemory)( &psc->driScreen, size,
|
readFreq, writeFreq,
|
||||||
readFreq, writeFreq,
|
priority );
|
||||||
priority );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
(void) dpy;
|
(void) dpy;
|
||||||
(void) scrn;
|
(void) scrn;
|
||||||
|
@ -2396,14 +2394,12 @@ PUBLIC void *glXAllocateMemoryMESA(Display *dpy, int scrn,
|
||||||
|
|
||||||
PUBLIC void glXFreeMemoryMESA(Display *dpy, int scrn, void *pointer)
|
PUBLIC void glXFreeMemoryMESA(Display *dpy, int scrn, void *pointer)
|
||||||
{
|
{
|
||||||
#ifdef GLX_DIRECT_RENDERING
|
#ifdef __DRI_ALLOCATE
|
||||||
__GLXscreenConfigs * const psc = GetGLXScreenConfigs( dpy, scrn );
|
__GLXscreenConfigs * const psc = GetGLXScreenConfigs( dpy, scrn );
|
||||||
|
|
||||||
if ( __glXExtensionBitIsEnabled( psc, MESA_allocate_memory_bit ) ) {
|
if (psc && psc->allocate)
|
||||||
if (psc && psc->driScreen.private && psc->driScreen.freeMemory) {
|
(*psc->allocate->freeMemory)( &psc->driScreen, pointer );
|
||||||
(*psc->driScreen.freeMemory)( &psc->driScreen, pointer );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
(void) dpy;
|
(void) dpy;
|
||||||
(void) scrn;
|
(void) scrn;
|
||||||
|
@ -2415,14 +2411,12 @@ PUBLIC void glXFreeMemoryMESA(Display *dpy, int scrn, void *pointer)
|
||||||
PUBLIC GLuint glXGetMemoryOffsetMESA( Display *dpy, int scrn,
|
PUBLIC GLuint glXGetMemoryOffsetMESA( Display *dpy, int scrn,
|
||||||
const void *pointer )
|
const void *pointer )
|
||||||
{
|
{
|
||||||
#ifdef GLX_DIRECT_RENDERING
|
#ifdef __DRI_ALLOCATE
|
||||||
__GLXscreenConfigs * const psc = GetGLXScreenConfigs( dpy, scrn );
|
__GLXscreenConfigs * const psc = GetGLXScreenConfigs( dpy, scrn );
|
||||||
|
|
||||||
if ( __glXExtensionBitIsEnabled( psc, MESA_allocate_memory_bit ) ) {
|
if (psc && psc->allocate)
|
||||||
if (psc && psc->driScreen.private && psc->driScreen.memoryOffset) {
|
return (*psc->allocate->memoryOffset)( &psc->driScreen, pointer );
|
||||||
return (*psc->driScreen.memoryOffset)( &psc->driScreen, pointer );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
(void) dpy;
|
(void) dpy;
|
||||||
(void) scrn;
|
(void) scrn;
|
||||||
|
|
|
@ -1039,6 +1039,17 @@ static void queryExtensions(__GLXscreenConfigs *psc)
|
||||||
}
|
}
|
||||||
#endif
|
#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 */
|
/* Ignore unknown extensions */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -419,9 +419,17 @@ intelUpdateScreenFromSAREA(intelScreenPrivate * intelScreen,
|
||||||
intelPrintSAREA(sarea);
|
intelPrintSAREA(sarea);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const __DRIallocateExtension intelAllocateExtension = {
|
||||||
|
{ __DRI_ALLOCATE },
|
||||||
|
intelAllocateMemoryMESA,
|
||||||
|
intelFreeMemoryMESA,
|
||||||
|
intelGetMemoryOffsetMESA
|
||||||
|
};
|
||||||
|
|
||||||
static const __DRIextension *intelExtensions[] = {
|
static const __DRIextension *intelExtensions[] = {
|
||||||
&driCopySubBufferExtension.base,
|
&driCopySubBufferExtension.base,
|
||||||
&driSwapControlExtension.base,
|
&driSwapControlExtension.base,
|
||||||
|
&intelAllocateExtension.base,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -332,6 +332,17 @@ radeonFillInModes( unsigned pixel_bits, unsigned depth_bits,
|
||||||
return modes;
|
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.
|
/* Create the device specific screen private data struct.
|
||||||
*/
|
*/
|
||||||
static radeonScreenPtr
|
static radeonScreenPtr
|
||||||
|
@ -741,22 +752,17 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv )
|
||||||
}
|
}
|
||||||
|
|
||||||
(*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" );
|
(*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" );
|
(*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 RADEON_COMMON && defined(RADEON_COMMON_FOR_R200)
|
||||||
if (IS_R200_CLASS(screen)) {
|
if (IS_R200_CLASS(screen))
|
||||||
sPriv->psc->allocateMemory = (void *) r200AllocateMemoryMESA;
|
screen->extensions[i++] = &r200AllocateExtension.base;
|
||||||
sPriv->psc->freeMemory = (void *) r200FreeMemoryMESA;
|
|
||||||
sPriv->psc->memoryOffset = (void *) r200GetMemoryOffsetMESA;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
screen->extensions[i++] = NULL;
|
||||||
|
sPriv->extensions = screen->extensions;
|
||||||
|
|
||||||
screen->driScreen = sPriv;
|
screen->driScreen = sPriv;
|
||||||
screen->sarea_priv_offset = dri_priv->sarea_priv_offset;
|
screen->sarea_priv_offset = dri_priv->sarea_priv_offset;
|
||||||
return screen;
|
return screen;
|
||||||
|
|
|
@ -104,7 +104,7 @@ typedef struct {
|
||||||
/* Configuration cache with default values for all contexts */
|
/* Configuration cache with default values for all contexts */
|
||||||
driOptionCache optionCache;
|
driOptionCache optionCache;
|
||||||
|
|
||||||
const __DRIextension *extensions[3];
|
const __DRIextension *extensions[4];
|
||||||
} radeonScreenRec, *radeonScreenPtr;
|
} radeonScreenRec, *radeonScreenPtr;
|
||||||
|
|
||||||
#define IS_R100_CLASS(screen) \
|
#define IS_R100_CLASS(screen) \
|
||||||
|
|
Loading…
Reference in New Issue