Index: src/mesa/main/glheader.h =================================================================== RCS file: /cvs/mesa/Mesa/src/mesa/main/glheader.h,v retrieving revision 1.72 diff -u -r1.72 glheader.h --- src/mesa/main/glheader.h 13 Apr 2006 01:52:32 -0000 1.72 +++ src/mesa/main/glheader.h 24 Nov 2006 06:10:02 -0000 @@ -5,8 +5,8 @@ * This is the top-most include file of the Mesa sources. * It includes gl.h and all system headers which are needed. * Other Mesa source files should \e not directly include any system - * headers. This allows Mesa to be integrated into XFree86 and - * allows system-dependent hacks/workarounds to be collected in one place. + * headers. This allows system-dependent hacks/workarounds to be + * collected in one place. * * \note Actually, a lot of system-dependent stuff is now in imports.[ch]. * @@ -50,14 +50,10 @@ #include "dix-config.h" #endif -#if defined(XFree86LOADER) && defined(IN_MODULE) && !defined(NO_LIBCWRAPPER) -#include "xf86_ansic.h" -#else #include #include -/* If we can use Compaq's Fast Math Library on Alpha */ #if defined(__alpha__) && defined(CCPML) -#include +#include /* use Compaq's Fast Math Library on Alpha */ #else #include #endif @@ -68,7 +64,6 @@ #if defined(__linux__) && defined(__i386__) #include #endif -#endif #include #include Index: src/mesa/main/imports.c =================================================================== RCS file: /cvs/mesa/Mesa/src/mesa/main/imports.c,v retrieving revision 1.66 diff -u -r1.66 imports.c --- src/mesa/main/imports.c 29 Aug 2006 22:30:58 -0000 1.66 +++ src/mesa/main/imports.c 24 Nov 2006 06:10:03 -0000 @@ -24,9 +24,6 @@ * - scanf * - qsort * - rand and RAND_MAX - * - * \note When compiled into a XFree86 module these functions wrap around - * XFree86 own wrappers. */ /* @@ -71,50 +68,29 @@ #endif #endif -/* If we don't actually want to use the libcwrapper junk (even though we're - * building an Xorg server module), then just undef IN_MODULE to signal that to - * the following code. It's left around for now to allow compiling of newish - * Mesa with older servers, but this whole mess should go away at some point. - */ -#ifdef NO_LIBCWRAPPER -#undef IN_MODULE -#endif - /**********************************************************************/ /** \name Memory */ /*@{*/ -/** Wrapper around either malloc() or xf86malloc() */ +/** Wrapper around malloc() */ void * _mesa_malloc(size_t bytes) { -#if defined(XFree86LOADER) && defined(IN_MODULE) - return xf86malloc(bytes); -#else return malloc(bytes); -#endif } -/** Wrapper around either calloc() or xf86calloc() */ +/** Wrapper around calloc() */ void * _mesa_calloc(size_t bytes) { -#if defined(XFree86LOADER) && defined(IN_MODULE) - return xf86calloc(1, bytes); -#else return calloc(1, bytes); -#endif } -/** Wrapper around either free() or xf86free() */ +/** Wrapper around free() */ void _mesa_free(void *ptr) { -#if defined(XFree86LOADER) && defined(IN_MODULE) - xf86free(ptr); -#else free(ptr); -#endif } /** @@ -131,7 +107,7 @@ void * _mesa_align_malloc(size_t bytes, unsigned long alignment) { -#if defined(HAVE_POSIX_MEMALIGN) && !(defined(XFree86LOADER) && defined(IN_MODULE)) +#if defined(HAVE_POSIX_MEMALIGN) void *mem; (void) posix_memalign(& mem, alignment, bytes); @@ -157,7 +133,7 @@ #endif return (void *) buf; -#endif /* defined(HAVE_POSIX_MEMALIGN) && !(defined(XFree86LOADER) && defined(IN_MODULE)) */ +#endif /* defined(HAVE_POSIX_MEMALIGN) */ } /** @@ -167,7 +143,7 @@ void * _mesa_align_calloc(size_t bytes, unsigned long alignment) { -#if defined(HAVE_POSIX_MEMALIGN) && !(defined(XFree86LOADER) && defined(IN_MODULE)) +#if defined(HAVE_POSIX_MEMALIGN) void *mem; mem = _mesa_align_malloc(bytes, alignment); @@ -197,7 +173,7 @@ #endif return (void *)buf; -#endif /* defined(HAVE_POSIX_MEMALIGN) && !(defined(XFree86LOADER) && defined(IN_MODULE)) */ +#endif /* defined(HAVE_POSIX_MEMALIGN) */ } /** @@ -210,13 +186,13 @@ void _mesa_align_free(void *ptr) { -#if defined(HAVE_POSIX_MEMALIGN) && !(defined(XFree86LOADER) && defined(IN_MODULE)) +#if defined(HAVE_POSIX_MEMALIGN) free(ptr); #else void **cubbyHole = (void **) ((char *) ptr - sizeof(void *)); void *realAddr = *cubbyHole; _mesa_free(realAddr); -#endif /* defined(HAVE_POSIX_MEMALIGN) && !(defined(XFree86LOADER) && defined(IN_MODULE)) */ +#endif /* defined(HAVE_POSIX_MEMALIGN) */ } /** @@ -255,22 +231,18 @@ void * _mesa_memcpy(void *dest, const void *src, size_t n) { -#if defined(XFree86LOADER) && defined(IN_MODULE) - return xf86memcpy(dest, src, n); -#elif defined(SUNOS4) +#if defined(SUNOS4) return memcpy((char *) dest, (char *) src, (int) n); #else return memcpy(dest, src, n); #endif } -/** Wrapper around either memset() or xf86memset() */ +/** Wrapper around memset() */ void _mesa_memset( void *dst, int val, size_t n ) { -#if defined(XFree86LOADER) && defined(IN_MODULE) - xf86memset( dst, val, n ); -#elif defined(SUNOS4) +#if defined(SUNOS4) memset( (char *) dst, (int) val, (int) n ); #else memset(dst, val, n); @@ -290,26 +262,22 @@ *dst++ = val; } -/** Wrapper around either memcpy() or xf86memcpy() or bzero() */ +/** Wrapper around either memcpy() or bzero() */ void _mesa_bzero( void *dst, size_t n ) { -#if defined(XFree86LOADER) && defined(IN_MODULE) - xf86memset( dst, 0, n ); -#elif defined(__FreeBSD__) +#if defined(__FreeBSD__) bzero( dst, n ); #else memset( dst, 0, n ); #endif } -/** Wrapper around either memcmp() or xf86memcmp() */ +/** Wrapper around memcmp() */ int _mesa_memcmp( const void *s1, const void *s2, size_t n ) { -#if defined(XFree86LOADER) && defined(IN_MODULE) - return xf86memcmp( s1, s2, n ); -#elif defined(SUNOS4) +#if defined(SUNOS4) return memcmp( (char *) s1, (char *) s2, (int) n ); #else return memcmp(s1, s2, n); @@ -323,70 +291,46 @@ /** \name Math */ /*@{*/ -/** Wrapper around either sin() or xf86sin() */ +/** Wrapper around sin() */ double _mesa_sin(double a) { -#if defined(XFree86LOADER) && defined(IN_MODULE) - return xf86sin(a); -#else return sin(a); -#endif } -/** Single precision wrapper around either sin() or xf86sin() */ +/** Single precision wrapper around sin() */ float _mesa_sinf(float a) { -#if defined(XFree86LOADER) && defined(IN_MODULE) - return (float) xf86sin((double) a); -#else return (float) sin((double) a); -#endif } -/** Wrapper around either cos() or xf86cos() */ +/** Wrapper around cos() */ double _mesa_cos(double a) { -#if defined(XFree86LOADER) && defined(IN_MODULE) - return xf86cos(a); -#else return cos(a); -#endif } -/** Single precision wrapper around either asin() or xf86asin() */ +/** Single precision wrapper around asin() */ float _mesa_asinf(float x) { -#if defined(XFree86LOADER) && defined(IN_MODULE) - return (float) xf86asin((double) x); -#else return (float) asin((double) x); -#endif } -/** Single precision wrapper around either atan() or xf86atan() */ +/** Single precision wrapper around atan() */ float _mesa_atanf(float x) { -#if defined(XFree86LOADER) && defined(IN_MODULE) - return (float) xf86atan((double) x); -#else return (float) atan((double) x); -#endif } -/** Wrapper around either sqrt() or xf86sqrt() */ +/** Wrapper around sqrt() */ double _mesa_sqrtd(double x) { -#if defined(XFree86LOADER) && defined(IN_MODULE) - return xf86sqrt(x); -#else return sqrt(x); -#endif } @@ -584,25 +528,17 @@ return x3 * r3; #endif -#elif defined(XFree86LOADER) && defined(IN_MODULE) - return 1.0F / xf86sqrt(n); #else return (float) (1.0 / sqrt(n)); #endif } -/** - * Wrapper around either pow() or xf86pow(). - */ +/** Wrapper around pow() */ double _mesa_pow(double x, double y) { -#if defined(XFree86LOADER) && defined(IN_MODULE) - return xf86pow(x, y); -#else return pow(x, y); -#endif } @@ -633,8 +569,6 @@ } } return bit; -#elif defined(XFree86LOADER) && defined(IN_MODULE) - return xf86ffs(i); #else return ffs(i); #endif @@ -807,11 +741,7 @@ _mesa_bsearch( const void *key, const void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *) ) { -#if defined(XFree86LOADER) && defined(IN_MODULE) - return xf86bsearch(key, base, nmemb, size, compar); -#else return bsearch(key, base, nmemb, size, compar); -#endif } /*@}*/ @@ -827,9 +757,7 @@ char * _mesa_getenv( const char *var ) { -#if defined(XFree86LOADER) && defined(IN_MODULE) - return xf86getenv(var); -#elif defined(_XBOX) +#if defined(_XBOX) return NULL; #else return getenv(var); @@ -843,81 +771,53 @@ /** \name String */ /*@{*/ -/** Wrapper around either strstr() or xf86strstr() */ +/** Wrapper around strstr() */ char * _mesa_strstr( const char *haystack, const char *needle ) { -#if defined(XFree86LOADER) && defined(IN_MODULE) - return xf86strstr(haystack, needle); -#else return strstr(haystack, needle); -#endif } -/** Wrapper around either strncat() or xf86strncat() */ +/** Wrapper around strncat() */ char * _mesa_strncat( char *dest, const char *src, size_t n ) { -#if defined(XFree86LOADER) && defined(IN_MODULE) - return xf86strncat(dest, src, n); -#else return strncat(dest, src, n); -#endif } -/** Wrapper around either strcpy() or xf86strcpy() */ +/** Wrapper around strcpy() */ char * _mesa_strcpy( char *dest, const char *src ) { -#if defined(XFree86LOADER) && defined(IN_MODULE) - return xf86strcpy(dest, src); -#else return strcpy(dest, src); -#endif } -/** Wrapper around either strncpy() or xf86strncpy() */ +/** Wrapper around strncpy() */ char * _mesa_strncpy( char *dest, const char *src, size_t n ) { -#if defined(XFree86LOADER) && defined(IN_MODULE) - return xf86strncpy(dest, src, n); -#else return strncpy(dest, src, n); -#endif } -/** Wrapper around either strlen() or xf86strlen() */ +/** Wrapper around strlen() */ size_t _mesa_strlen( const char *s ) { -#if defined(XFree86LOADER) && defined(IN_MODULE) - return xf86strlen(s); -#else return strlen(s); -#endif } -/** Wrapper around either strcmp() or xf86strcmp() */ +/** Wrapper around strcmp() */ int _mesa_strcmp( const char *s1, const char *s2 ) { -#if defined(XFree86LOADER) && defined(IN_MODULE) - return xf86strcmp(s1, s2); -#else return strcmp(s1, s2); -#endif } -/** Wrapper around either strncmp() or xf86strncmp() */ +/** Wrapper around strncmp() */ int _mesa_strncmp( const char *s1, const char *s2, size_t n ) { -#if defined(XFree86LOADER) && defined(IN_MODULE) - return xf86strncmp(s1, s2, n); -#else return strncmp(s1, s2, n); -#endif } /** Implemented using _mesa_malloc() and _mesa_strcpy */ @@ -931,26 +831,18 @@ return s2; } -/** Wrapper around either atoi() or xf86atoi() */ +/** Wrapper around atoi() */ int _mesa_atoi(const char *s) { -#if defined(XFree86LOADER) && defined(IN_MODULE) - return xf86atoi(s); -#else return atoi(s); -#endif } -/** Wrapper around either strtod() or xf86strtod() */ +/** Wrapper around strtod() */ double _mesa_strtod( const char *s, char **end ) { -#if defined(XFree86LOADER) && defined(IN_MODULE) - return xf86strtod(s, end); -#else return strtod(s, end); -#endif } /*@}*/ @@ -960,24 +852,19 @@ /** \name I/O */ /*@{*/ -/** Wrapper around either vsprintf() or xf86vsprintf() */ +/** Wrapper around vsprintf() */ int _mesa_sprintf( char *str, const char *fmt, ... ) { int r; va_list args; va_start( args, fmt ); -#if defined(XFree86LOADER) && defined(IN_MODULE) - r = xf86vsprintf( str, fmt, args ); -#else r = vsprintf( str, fmt, args ); -#endif va_end( args ); return r; } -/** Wrapper around either printf() or xf86printf(), using vsprintf() for - * the formatting. */ +/** Wrapper around printf(), using vsprintf() for the formatting. */ void _mesa_printf( const char *fmtString, ... ) { @@ -986,22 +873,14 @@ va_start( args, fmtString ); vsnprintf(s, MAXSTRING, fmtString, args); va_end( args ); -#if defined(XFree86LOADER) && defined(IN_MODULE) - xf86printf("%s", s); -#else fprintf(stderr,"%s", s); -#endif } -/** Wrapper around either vsprintf() or xf86vsprintf() */ +/** Wrapper around vsprintf() */ int _mesa_vsprintf( char *str, const char *fmt, va_list args ) { -#if defined(XFree86LOADER) && defined(IN_MODULE) - return xf86vsprintf( str, fmt, args ); -#else return vsprintf( str, fmt, args ); -#endif } /*@}*/ @@ -1019,7 +898,7 @@ * * If debugging is enabled (either at compile-time via the DEBUG macro, or * run-time via the MESA_DEBUG environment variable), prints the warning to - * stderr, either via fprintf() or xf86printf(). + * stderr via fprintf(). */ void _mesa_warning( GLcontext *ctx, const char *fmtString, ... ) @@ -1037,11 +916,7 @@ debug = _mesa_getenv("MESA_DEBUG") ? GL_TRUE : GL_FALSE; #endif if (debug) { -#if defined(XFree86LOADER) && defined(IN_MODULE) - xf86fprintf(stderr, "Mesa warning: %s\n", str); -#else fprintf(stderr, "Mesa warning: %s\n", str); -#endif } } @@ -1052,7 +927,7 @@ * \param ctx GL context. * \param s problem description string. * - * Prints the message to stderr, either via fprintf() or xf86fprintf(). + * Prints the message to stderr via fprintf(). */ void _mesa_problem( const GLcontext *ctx, const char *fmtString, ... ) @@ -1065,13 +940,8 @@ vsnprintf( str, MAXSTRING, fmtString, args ); va_end( args ); -#if defined(XFree86LOADER) && defined(IN_MODULE) - xf86fprintf(stderr, "Mesa %s implementation error: %s\n", MESA_VERSION_STRING, str); - xf86fprintf(stderr, "Please report at bugzilla.freedesktop.org\n"); -#else fprintf(stderr, "Mesa %s implementation error: %s\n", MESA_VERSION_STRING, str); fprintf(stderr, "Please report at bugzilla.freedesktop.org\n"); -#endif } /** @@ -1161,7 +1031,7 @@ * \param ctx GL context. * \param fmtString printf() alike format string. * - * Prints the message to stderr, either via fprintf() or xf86printf(). + * Prints the message to stderr via fprintf(). */ void _mesa_debug( const GLcontext *ctx, const char *fmtString, ... ) @@ -1172,11 +1042,7 @@ va_start(args, fmtString); vsnprintf(s, MAXSTRING, fmtString, args); va_end(args); -#if defined(XFree86LOADER) && defined(IN_MODULE) - xf86fprintf(stderr, "Mesa: %s", s); -#else fprintf(stderr, "Mesa: %s", s); -#endif #endif /* DEBUG */ (void) ctx; (void) fmtString; @@ -1195,11 +1061,7 @@ void _mesa_exit( int status ) { -#if defined(XFree86LOADER) && defined(IN_MODULE) - xf86exit(status); -#else exit(status); -#endif } /*@}*/ @@ -1225,16 +1087,12 @@ return _mesa_calloc(numElem * elemSize); } -/** Wrapper around either realloc() or xf86realloc() */ +/** Wrapper around realloc() */ static void * default_realloc(__GLcontext *gc, void *oldAddr, size_t newSize) { (void) gc; -#if defined(XFree86LOADER) && defined(IN_MODULE) - return xf86realloc(oldAddr, newSize); -#else return realloc(oldAddr, newSize); -#endif } /** Wrapper around _mesa_free() */ Index: src/mesa/main/imports.h =================================================================== RCS file: /cvs/mesa/Mesa/src/mesa/main/imports.h,v retrieving revision 1.71 diff -u -r1.71 imports.h --- src/mesa/main/imports.h 15 Nov 2006 19:54:25 -0000 1.71 +++ src/mesa/main/imports.h 24 Nov 2006 06:10:03 -0000 @@ -142,11 +142,6 @@ #define FLT_MAX_EXP 128 #endif -/* XXX this is a bit of a hack needed for compilation within XFree86 */ -#ifndef FLT_MIN -#define FLT_MIN (1.0e-37) -#endif - /* Degrees to radians conversion: */ #define DEG2RAD (M_PI/180.0) @@ -173,8 +168,6 @@ ***/ #if 0 /* _mesa_sqrtf() not accurate enough - temporarily disabled */ # define SQRTF(X) _mesa_sqrtf(X) -#elif defined(XFree86LOADER) && defined(IN_MODULE) && !defined(NO_LIBCWRAPPER) -# define SQRTF(X) (float) xf86sqrt((float) (X)) #else # define SQRTF(X) (float) sqrt((float) (X)) #endif @@ -221,8 +214,6 @@ num.f = ((-1.0f/3) * num.f + 2) * num.f - 2.0f/3; return num.f + log_2; } -#elif defined(XFree86LOADER) && defined(IN_MODULE) && !defined(NO_LIBCWRAPPER) -#define LOG2(x) ((GLfloat) (xf86log(x) * 1.442695)) #else /* * NOTE: log_base_2(x) = log(x) / log(2) @@ -293,15 +284,7 @@ *** LDEXPF: multiply value by an integral power of two *** FREXPF: extract mantissa and exponent from value ***/ -#if defined(XFree86LOADER) && defined(IN_MODULE) && !defined(NO_LIBCWRAPPER) -#define CEILF(x) ((GLfloat) xf86ceil(x)) -#define FLOORF(x) ((GLfloat) xf86floor(x)) -#define FABSF(x) ((GLfloat) xf86fabs(x)) -#define LOGF(x) ((GLfloat) xf86log(x)) -#define EXPF(x) ((GLfloat) xf86exp(x)) -#define LDEXPF(x,y) ((GLfloat) xf86ldexp(x,y)) -#define FREXPF(x,y) ((GLfloat) xf86frexp(x,y)) -#elif defined(__gnu_linux__) +#if defined(__gnu_linux__) /* C99 functions */ #define CEILF(x) ceilf(x) #define FLOORF(x) floorf(x)