Mesa uses the glVertexAttrib*NV functions to implement fixed-function
[mesa.git] / src / mesa / drivers / dri / common / glcontextmodes.c
index 448c33d187409a4cfe350d065adb37238d511dd7..4bff387ae0a4f9e34593584b0bfaf56885a5eb76 100644 (file)
  * \author Ian Romanick <idr@us.ibm.com>
  */
 
-#include <X11/X.h>
-#include <GL/glx.h>
-#include "GL/glxint.h"
+#if defined(IN_MINI_GLX)
+# include <stdlib.h>
+# include <string.h>
+# include <GL/gl.h>
+# include "GL/internal/dri_interface.h"
+# include "imports.h"
+# define __glXMemset  memset
+#else
+# include <X11/X.h>
+# include <GL/glx.h>
+# include "GL/glxint.h"
 
-#ifdef XFree86Server
-# include "GL/glx_ansic.h"
+# ifdef XFree86Server
+#  include "GL/glx_ansic.h"
 extern void * __glXMalloc( size_t size );
 extern void __glXFree( void * ptr );
-# define Xmalloc __glXMalloc
-# define Xfree   __glXFree
-#else
-# include <X11/Xlibint.h>
-# define __glXMemset  memset
-#endif /* XFree86Server */
+#  define _mesa_malloc(b) __glXMalloc(b)
+#  define _mesa_free(m)   __glXFree(m)
+# else
+#  include <X11/Xlibint.h>
+#  define __glXMemset  memset
+#  define _mesa_malloc(b) Xmalloc(b)
+#  define _mesa_free(m) Xfree(m)
+# endif /* XFree86Server */
+#endif /* !defined(IN_MINI_GLX) */
 
 #include "glcontextmodes.h"
 
-#ifndef DRI_NEW_INTERFACE_ONLY
+#if !defined(IN_MINI_GLX)
 #define NUM_VISUAL_TYPES   6
 
 /**
@@ -169,7 +180,6 @@ _gl_copy_visual_to_context_mode( __GLcontextModes * mode,
 
     mode->swapMethod = GLX_SWAP_UNDEFINED_OML;
 }
-#endif /* DRI_NEW_INTERFACE_ONLY */
 
 
 /**
@@ -310,6 +320,7 @@ _gl_get_context_mode_data(const __GLcontextModes *mode, int attribute,
        return GLX_BAD_ATTRIBUTE;
     }
 }
+#endif /* !defined(IN_MINI_GLX) */
 
 
 /**
@@ -349,7 +360,7 @@ _gl_context_modes_create( unsigned count, size_t minimum_size )
 
    next = & base;
    for ( i = 0 ; i < count ; i++ ) {
-      *next = (__GLcontextModes *) Xmalloc( size );
+      *next = (__GLcontextModes *) _mesa_malloc( size );
       if ( *next == NULL ) {
         _gl_context_modes_destroy( base );
         base = NULL;
@@ -390,7 +401,7 @@ _gl_context_modes_destroy( __GLcontextModes * modes )
    while ( modes != NULL ) {
       __GLcontextModes * const next = modes->next;
 
-      Xfree( modes );
+      _mesa_free( modes );
       modes = next;
    }
 }