diff options
author | George Sapountzis <[email protected]> | 2006-12-06 06:40:18 +0200 |
---|---|---|
committer | George Sapountzis <[email protected]> | 2006-12-21 19:41:08 +0200 |
commit | b766643e5c3c9ed174c59b54e520f94e3420e39a (patch) | |
tree | f32c42201172ca2601a66213eb655676d72825fb /src/mesa | |
parent | af0190bc6ece5ab71346ad436f5e2558d072ad56 (diff) |
Drop mesa wrappers for XFree86.
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/main/glheader.h | 12 | ||||
-rw-r--r-- | src/mesa/main/imports.c | 222 | ||||
-rw-r--r-- | src/mesa/main/imports.h | 19 |
3 files changed, 45 insertions, 208 deletions
diff --git a/src/mesa/main/glheader.h b/src/mesa/main/glheader.h index e37499e4be7..5abea137d74 100644 --- a/src/mesa/main/glheader.h +++ b/src/mesa/main/glheader.h @@ -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]. * @@ -46,18 +46,15 @@ #ifndef GLHEADER_H #define GLHEADER_H +/* This allows Mesa to be integrated into XFree86 */ #ifdef HAVE_DIX_CONFIG_H #include "dix-config.h" #endif -#if defined(XFree86LOADER) && defined(IN_MODULE) && !defined(NO_LIBCWRAPPER) -#include "xf86_ansic.h" -#else #include <assert.h> #include <ctype.h> -/* If we can use Compaq's Fast Math Library on Alpha */ #if defined(__alpha__) && defined(CCPML) -#include <cpml.h> +#include <cpml.h> /* use Compaq's Fast Math Library on Alpha */ #else #include <math.h> #endif @@ -68,7 +65,6 @@ #if defined(__linux__) && defined(__i386__) #include <fpu_control.h> #endif -#endif #include <float.h> #include <stdarg.h> diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c index a09c497795e..ed809acbe2a 100644 --- a/src/mesa/main/imports.c +++ b/src/mesa/main/imports.c @@ -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 @@ extern int vsnprintf(char *str, size_t count, const char *fmt, va_list arg); #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 @@ _mesa_free(void *ptr) 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 @@ _mesa_align_malloc(size_t bytes, unsigned long alignment) #endif return (void *) buf; -#endif /* defined(HAVE_POSIX_MEMALIGN) && !(defined(XFree86LOADER) && defined(IN_MODULE)) */ +#endif /* defined(HAVE_POSIX_MEMALIGN) */ } /** @@ -167,7 +143,7 @@ _mesa_align_malloc(size_t bytes, unsigned long alignment) 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 @@ _mesa_align_calloc(size_t bytes, unsigned long alignment) #endif return (void *)buf; -#endif /* defined(HAVE_POSIX_MEMALIGN) && !(defined(XFree86LOADER) && defined(IN_MODULE)) */ +#endif /* defined(HAVE_POSIX_MEMALIGN) */ } /** @@ -210,13 +186,13 @@ _mesa_align_calloc(size_t bytes, unsigned long alignment) 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 @@ _mesa_realloc(void *oldBuffer, size_t oldSize, size_t newSize) 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 @@ _mesa_memset16( unsigned short *dst, unsigned short val, size_t n ) *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 @@ _mesa_memcmp( const void *s1, const void *s2, size_t n ) /** \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 @@ _mesa_inv_sqrtf(float n) 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 @@ _mesa_ffs(int i) } } return bit; -#elif defined(XFree86LOADER) && defined(IN_MODULE) - return xf86ffs(i); #else return ffs(i); #endif @@ -807,11 +741,7 @@ void * _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 @@ _mesa_bsearch( const void *key, const void *base, size_t nmemb, size_t size, 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 @@ _mesa_getenv( const char *var ) /** \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 @@ _mesa_strdup( const char *s ) 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 @@ _mesa_strtod( const char *s, char **end ) /** \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 @@ _mesa_printf( const char *fmtString, ... ) 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 @@ _mesa_vsprintf( char *str, const char *fmt, va_list args ) * * 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 @@ _mesa_warning( GLcontext *ctx, const char *fmtString, ... ) 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 @@ _mesa_warning( GLcontext *ctx, const char *fmtString, ... ) * \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 @@ _mesa_problem( const GLcontext *ctx, const char *fmtString, ... ) 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 @@ _mesa_error( GLcontext *ctx, GLenum error, const char *fmtString, ... ) * \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 @@ _mesa_debug( const GLcontext *ctx, const char *fmtString, ... ) 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 @@ _mesa_debug( const GLcontext *ctx, const char *fmtString, ... ) void _mesa_exit( int status ) { -#if defined(XFree86LOADER) && defined(IN_MODULE) - xf86exit(status); -#else exit(status); -#endif } /*@}*/ @@ -1225,16 +1087,12 @@ default_calloc(__GLcontext *gc, size_t numElem, size_t elemSize) 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() */ diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h index dad2767e72d..19a9478f76a 100644 --- a/src/mesa/main/imports.h +++ b/src/mesa/main/imports.h @@ -142,11 +142,6 @@ typedef union { GLfloat f; GLint i; } fi_type; #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 @@ typedef union { GLfloat f; GLint i; } fi_type; ***/ #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 @@ static INLINE GLfloat LOG2(GLfloat val) 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 @@ static INLINE int GET_FLOAT_BITS( float x ) *** 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) |