summaryrefslogtreecommitdiffstats
path: root/src/glx
diff options
context:
space:
mode:
authorKristian Høgsberg <[email protected]>2007-05-16 14:10:29 -0400
committerKristian Høgsberg <[email protected]>2007-10-11 11:09:57 -0400
commit78a6aa57a0155d72280dd91c05513c847bf76f3b (patch)
treef007653457bdcff728af99fda719b574c20a2575 /src/glx
parentefaf90b03e8b69e04909bce071f8ef6b65cc0e9d (diff)
Move GLX_MESA_allocate_memory related functions to new extension mechanism.
Diffstat (limited to 'src/glx')
-rw-r--r--src/glx/x11/glxclient.h4
-rw-r--r--src/glx/x11/glxcmds.c34
-rw-r--r--src/glx/x11/glxext.c11
3 files changed, 29 insertions, 20 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 */
}
}