summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xc/include/GL/glx.h18
-rw-r--r--xc/lib/GL/glx/glxclient.h11
-rw-r--r--xc/lib/GL/glx/glxcmds.c87
-rw-r--r--xc/lib/GL/glx/glxextensions.c3
-rw-r--r--xc/lib/GL/glx/glxextensions.h1
5 files changed, 115 insertions, 5 deletions
diff --git a/xc/include/GL/glx.h b/xc/include/GL/glx.h
index b02a237d8..910504a1d 100644
--- a/xc/include/GL/glx.h
+++ b/xc/include/GL/glx.h
@@ -156,7 +156,7 @@ typedef void ( * PFNGLXFREEMEMORYNVPROC) (GLvoid *pointer);
/*
- * ???. GLX_MESA_agp_offset
+ * ???. GLX_MESA_agp_offset (deprecated)
*/
#ifndef GLX_MESA_agp_offset
#define GLX_MESA_agp_offset 1
@@ -166,6 +166,22 @@ typedef GLuint (* PFNGLXGETAGPOFFSETMESAPROC) (const GLvoid *pointer);
#endif /* GLX_MESA_agp_offset */
+
+/*
+ * ???. GLX_MESA_allocate_memory
+ */
+#ifndef GLX_MESA_allocate_memory
+#define GLX_MESA_allocate_memory 1
+
+extern void *glXAllocateMemoryMESA(Display *dpy, int scrn, size_t size, float readfreq, float writefreq, float priority);
+extern void glXFreeMemoryMESA(Display *dpy, int scrn, void *pointer);
+extern GLuint glXGetMemoryOffsetMESA(Display *dpy, int scrn, const void *pointer);
+typedef void * ( * PFNGLXALLOCATEMEMORYMESAPROC) (Display *dpy, int scrn, size_t size, float readfreq, float writefreq, float priority);
+typedef void ( * PFNGLXFREEMEMORYMESAPROC) (Display *dpy, int scrn, void *pointer);
+typedef GLuint (* PFNGLXGETMEMORYOFFSETMESAPROC) (Display *dpy, int scrn, const void *pointer);
+
+#endif /* GLX_MESA_allocate_memory */
+
/*
* ???. GLX_ARB_render_texture
*/
diff --git a/xc/lib/GL/glx/glxclient.h b/xc/lib/GL/glx/glxclient.h
index 365939ae6..d5b7bc6b4 100644
--- a/xc/lib/GL/glx/glxclient.h
+++ b/xc/lib/GL/glx/glxclient.h
@@ -171,6 +171,17 @@ struct __DRIscreenRec {
** Added with internal API version "20030813".
*/
void *screenConfigs;
+
+ /*
+ ** Added with internal API version "20030815".
+ */
+ void *(*allocateMemory)(Display *dpy, int scrn, GLsizei size,
+ GLfloat readfreq, GLfloat writefreq,
+ GLfloat priority);
+
+ void (*freeMemory)(Display *dpy, int scrn, GLvoid *pointer);
+
+ GLuint (*memoryOffset)(Display *dpy, int scrn, const GLvoid *pointer);
};
/*
diff --git a/xc/lib/GL/glx/glxcmds.c b/xc/lib/GL/glx/glxcmds.c
index c942a9b9e..6629cfabc 100644
--- a/xc/lib/GL/glx/glxcmds.c
+++ b/xc/lib/GL/glx/glxcmds.c
@@ -311,7 +311,7 @@ GetGLXPrivScreenConfig( Display *dpy, int scrn, __GLXdisplayPrivate ** ppriv,
return Success;
}
-
+
static
GLXContext AllocateGLXContext( Display *dpy )
{
@@ -511,6 +511,7 @@ GLXContext CreateContext(Display *dpy, XVisualInfo *vis,
return gc;
}
+
GLXContext GLX_PREFIX(glXCreateContext)(Display *dpy, XVisualInfo *vis,
GLXContext shareList, Bool allowDirect)
{
@@ -1538,7 +1539,7 @@ const char *GLX_PREFIX(glXQueryServerString)( Display *dpy, int screen, int name
if ( GetGLXPrivScreenConfig( dpy, screen, & priv, & psc ) != Success ) {
return NULL;
}
-
+
switch(name) {
case GLX_VENDOR:
if (!priv->serverGLXvendor) {
@@ -2753,6 +2754,78 @@ Bool GLX_PREFIX(glXWaitForSbcOML)(Display * dpy, GLXDrawable drawable,
/*
+** GLX_MESA_allocate_memory
+*/
+
+void *GLX_PREFIX(glXAllocateMemoryMESA)(Display *dpy, int scrn,
+ size_t size,
+ float readFreq,
+ float writeFreq,
+ float priority)
+{
+#ifdef GLX_DIRECT_RENDERING
+ __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)( dpy, scrn, size,
+ readFreq, writeFreq,
+ priority );
+ }
+ }
+#else
+ (void) dpy;
+ (void) scrn;
+ (void) size;
+ (void) readFreq;
+ (void) writeFreq;
+ (void) priority;
+#endif /* GLX_DIRECT_RENDERING */
+
+ return NULL;
+}
+
+
+void GLX_PREFIX(glXFreeMemoryMESA)(Display *dpy, int scrn, void *pointer)
+{
+#ifdef GLX_DIRECT_RENDERING
+ __GLXscreenConfigs * const psc = GetGLXScreenConfigs( dpy, scrn );
+
+ if ( __glXExtensionBitIsEnabled( psc, MESA_allocate_memory_bit ) ) {
+ if (psc && psc->driScreen.private && psc->driScreen.freeMemory) {
+ (*psc->driScreen.freeMemory)( dpy, scrn, pointer );
+ }
+ }
+#else
+ (void) dpy;
+ (void) scrn;
+ (void) pointer;
+#endif /* GLX_DIRECT_RENDERING */
+}
+
+
+GLuint GLX_PREFIX(glXGetMemoryOffsetMESA)( Display *dpy, int scrn,
+ const void *pointer )
+{
+#ifdef GLX_DIRECT_RENDERING
+ __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)( dpy, scrn, pointer );
+ }
+ }
+#else
+ (void) dpy;
+ (void) scrn;
+ (void) pointer;
+#endif /* GLX_DIRECT_RENDERING */
+
+ return ~0L;
+}
+
+
+/*
** Mesa extension stubs. These will help reduce portability problems.
*/
@@ -2933,6 +3006,11 @@ static const struct name_address_pair GLX_functions[] = {
/*** GLX_SUN_get_transparent_index ***/
GLX_FUNCTION( glXGetTransparentIndexSUN ),
+ /*** GLX_MESA_allocate_memory ***/
+ GLX_FUNCTION( glXAllocateMemoryMESA ),
+ GLX_FUNCTION( glXFreeMemoryMESA ),
+ GLX_FUNCTION( glXGetMemoryOffsetMESA ),
+
/*** GLX_MESA_copy_sub_buffer ***/
GLX_FUNCTION( glXCopySubBufferMESA ),
@@ -3046,8 +3124,11 @@ int __glXGetInternalVersion(void)
* GLX_SGIX_visual_select_group.
* 20030606 - Added support for GLX_SGI_make_current_read.
* 20030813 - Made support for dynamic extensions multi-head aware.
+ * 20030818 - Added support for GLX_MESA_allocate_memory in place of the
+ * depricated GLX_NV_vertex_array_range & GLX_MESA_agp_offset
+ * interfaces.
*/
- return 20030813;
+ return 20030818;
}
diff --git a/xc/lib/GL/glx/glxextensions.c b/xc/lib/GL/glx/glxextensions.c
index 64453d178..22116a062 100644
--- a/xc/lib/GL/glx/glxextensions.c
+++ b/xc/lib/GL/glx/glxextensions.c
@@ -84,6 +84,7 @@ static struct {
{ GLX(EXT_visual_info), VER(0,0), Y, Y, N, N },
{ GLX(EXT_visual_rating), VER(0,0), Y, Y, N, N },
{ GLX(MESA_agp_offset), VER(0,0), N, N, N, Y }, /* Deprecated */
+ { GLX(MESA_allocate_memory), VER(0,0), Y, N, N, Y },
{ GLX(MESA_copy_sub_buffer), VER(0,0), N, N, N, N }, /* Deprecated? */
{ GLX(MESA_pixmap_colormap), VER(0,0), N, N, N, N }, /* Deprecated */
{ GLX(MESA_release_buffers), VER(0,0), N, N, N, N }, /* Deprecated */
@@ -362,7 +363,7 @@ GLboolean
__glXExtensionBitIsEnabled( __GLXscreenConfigs *psc, unsigned bit )
{
GLboolean enabled = GL_FALSE;
-
+
if ( psc != NULL ) {
__glXExtensionsCtr();
__glXExtensionsCtrScreen( psc );
diff --git a/xc/lib/GL/glx/glxextensions.h b/xc/lib/GL/glx/glxextensions.h
index 695a47911..6699c3e9e 100644
--- a/xc/lib/GL/glx/glxextensions.h
+++ b/xc/lib/GL/glx/glxextensions.h
@@ -38,6 +38,7 @@ enum {
EXT_visual_rating_bit,
EXT_import_context_bit,
MESA_agp_offset_bit,
+ MESA_allocate_memory_bit, /* Replaces MESA_agp_offset & NV_vertex_array_range */
MESA_copy_sub_buffer_bit,
MESA_depth_float_bit,
MESA_pixmap_colormap_bit,