diff options
Diffstat (limited to 'src/mesa/x86/common_x86.c')
-rw-r--r-- | src/mesa/x86/common_x86.c | 89 |
1 files changed, 34 insertions, 55 deletions
diff --git a/src/mesa/x86/common_x86.c b/src/mesa/x86/common_x86.c index eece7c1c84..37a434596a 100644 --- a/src/mesa/x86/common_x86.c +++ b/src/mesa/x86/common_x86.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.0.1 + * Version: 6.5.1 * - * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -58,22 +58,6 @@ extern GLuint _ASMAPI _mesa_x86_cpuid_ebx(GLuint op); extern GLuint _ASMAPI _mesa_x86_cpuid_ecx(GLuint op); extern GLuint _ASMAPI _mesa_x86_cpuid_edx(GLuint op); -static void message( const char *msg ) -{ - GLboolean debug; -#ifdef DEBUG - debug = GL_TRUE; -#else - if ( _mesa_getenv( "MESA_DEBUG" ) ) { - debug = GL_TRUE; - } else { - debug = GL_FALSE; - } -#endif - if ( debug ) { - _mesa_debug( NULL, "%s", msg ); - } -} #if defined(USE_SSE_ASM) /* @@ -105,7 +89,7 @@ extern void _mesa_test_os_sse_exception_support( void ); && !defined(IN_DRI_DRIVER) static void sigill_handler( int signal, struct sigcontext sc ) { - message( "SIGILL, " ); + /*message( "SIGILL, " );*/ /* Both the "xorps %%xmm0,%%xmm0" and "divps %xmm0,%%xmm1" * instructions are 3 bytes long. We must increment the instruction @@ -124,7 +108,7 @@ static void sigill_handler( int signal, struct sigcontext sc ) static void sigfpe_handler( int signal, struct sigcontext sc ) { - message( "SIGFPE, " ); + /*message( "SIGFPE, " );*/ if ( sc.fpstate->magic != 0xffff ) { /* Our signal context has the extended FPU state, so reset the @@ -136,7 +120,7 @@ static void sigfpe_handler( int signal, struct sigcontext sc ) } else { /* If we ever get here, we're completely hosed. */ - message( "\n\n" ); + /*message( "\n\n" );*/ _mesa_problem( NULL, "SSE enabling test failed badly!" ); } } @@ -152,18 +136,18 @@ static LONG WINAPI ExceptionFilter(LPEXCEPTION_POINTERS exp) PCONTEXT ctx = exp->ContextRecord; if ( rec->ExceptionCode == EXCEPTION_ILLEGAL_INSTRUCTION ) { - message( "EXCEPTION_ILLEGAL_INSTRUCTION, " ); + _mesa_debug(NULL, "EXCEPTION_ILLEGAL_INSTRUCTION\n" ); _mesa_x86_cpu_features &= ~(X86_FEATURE_XMM); } else if ( rec->ExceptionCode == STATUS_FLOAT_MULTIPLE_TRAPS ) { - message( "STATUS_FLOAT_MULTIPLE_TRAPS, " ); + _mesa_debug(NULL, "STATUS_FLOAT_MULTIPLE_TRAPS\n"); /* Windows seems to clear the exception flag itself, we just have to increment Eip */ } else { - message( "UNEXPECTED EXCEPTION (0x%08x), terminating!" ); + _mesa_debug(NULL, "UNEXPECTED EXCEPTION (0x%08x), terminating!\n" ); return EXCEPTION_EXECUTE_HANDLER; } if ( (ctx->ContextFlags & CONTEXT_CONTROL) != CONTEXT_CONTROL ) { - message( "Context does not contain control registers, terminating!" ); + _mesa_debug(NULL, "Context does not contain control registers, terminating!\n"); return EXCEPTION_EXECUTE_HANDLER; } ctx->Eip += 3; @@ -203,14 +187,14 @@ static void check_os_sse_support( void ) * does. */ if ( cpu_has_xmm ) { - message( "Testing OS support for SSE... " ); + _mesa_debug(NULL, "Testing OS support for SSE...\n"); _mesa_test_os_sse_support(); if ( cpu_has_xmm ) { - message( "yes.\n" ); + _mesa_debug(NULL, "Yes\n"); } else { - message( "no!\n" ); + _mesa_debug(NULL, "No\n"); } } @@ -228,14 +212,14 @@ static void check_os_sse_support( void ) * and therefore to be safe I'm going to leave this test in here. */ if ( cpu_has_xmm ) { - message( "Testing OS support for SSE unmasked exceptions... " ); + _mesa_debug(NULL, "Testing OS support for SSE unmasked exceptions...\n"); _mesa_test_os_sse_exception_support(); if ( cpu_has_xmm ) { - message( "yes.\n" ); + _mesa_debug(NULL, "Yes.\n"); } else { - message( "no!\n" ); + _mesa_debug(NULL, "No!\n"); } } @@ -248,15 +232,15 @@ static void check_os_sse_support( void ) * safe to go ahead and hook out the SSE code throughout Mesa. */ if ( cpu_has_xmm ) { - message( "Tests of OS support for SSE passed.\n" ); + _mesa_debug(NULL, "Tests of OS support for SSE passed.\n"); } else { - message( "Tests of OS support for SSE failed!\n" ); + _mesa_debug(NULL, "Tests of OS support for SSE failed!\n"); } #else /* We can't use POSIX signal handling to test the availability of * SSE, so we disable it by default. */ - message( "Cannot test OS support for SSE, disabling to be safe.\n" ); + _mesa_debug(NULL, "Cannot test OS support for SSE, disabling to be safe.\n"); _mesa_x86_cpu_features &= ~(X86_FEATURE_XMM); #endif /* _POSIX_SOURCE && X86_FXSR_MAGIC */ #elif defined(__FreeBSD__) @@ -275,26 +259,26 @@ static void check_os_sse_support( void ) oldFilter = SetUnhandledExceptionFilter( ExceptionFilter ); if ( cpu_has_xmm ) { - message( "Testing OS support for SSE... " ); + _mesa_debug(NULL, "Testing OS support for SSE...\n"); _mesa_test_os_sse_support(); if ( cpu_has_xmm ) { - message( "yes.\n" ); + _mesa_debug(NULL, "Yes.\n"); } else { - message( "no!\n" ); + _mesa_debug(NULL, "No!\n"); } } if ( cpu_has_xmm ) { - message( "Testing OS support for SSE unmasked exceptions... " ); + _mesa_debug(NULL, "Testing OS support for SSE unmasked exceptions...\n"); _mesa_test_os_sse_exception_support(); if ( cpu_has_xmm ) { - message( "yes.\n" ); + _mesa_debug(NULL, "Yes.\n"); } else { - message( "no!\n" ); + _mesa_debug(NULL, "No!\n"); } } @@ -302,14 +286,14 @@ static void check_os_sse_support( void ) SetUnhandledExceptionFilter( oldFilter ); if ( cpu_has_xmm ) { - message( "Tests of OS support for SSE passed.\n" ); + _mesa_debug(NULL, "Tests of OS support for SSE passed.\n"); } else { - message( "Tests of OS support for SSE failed!\n" ); + _mesa_debug(NULL, "Tests of OS support for SSE failed!\n"); } #else /* Do nothing on other platforms for now. */ - message( "Not testing OS support for SSE, leaving enabled.\n" ); + _mesa_debug(NULL, "Not testing OS support for SSE, leaving enabled.\n"); #endif /* __linux__ */ } @@ -318,12 +302,11 @@ static void check_os_sse_support( void ) void _mesa_init_all_x86_transform_asm( void ) { - (void) message; /* silence warning */ #ifdef USE_X86_ASM _mesa_x86_cpu_features = 0; if (!_mesa_x86_has_cpuid()) { - message("CPUID not detected"); + _mesa_debug(NULL, "CPUID not detected\n"); } else { GLuint cpu_features; @@ -336,9 +319,7 @@ void _mesa_init_all_x86_transform_asm( void ) _mesa_x86_cpuid(0, &result, (GLuint *)(cpu_vendor + 0), (GLuint *)(cpu_vendor + 8), (GLuint *)(cpu_vendor + 4)); cpu_vendor[12] = '\0'; - message("cpu vendor: "); - message(cpu_vendor); - message("\n"); + _mesa_debug(NULL, "CPU vendor: %s\n", cpu_vendor); /* get cpu features */ cpu_features = _mesa_x86_cpuid_edx(1); @@ -390,9 +371,7 @@ void _mesa_init_all_x86_transform_asm( void ) _mesa_x86_cpuid(0x80000002+ofs, (GLuint *)(cpu_name + (16*ofs)+0), (GLuint *)(cpu_name + (16*ofs)+4), (GLuint *)(cpu_name + (16*ofs)+8), (GLuint *)(cpu_name + (16*ofs)+12)); cpu_name[48] = '\0'; /* the name should be NULL terminated, but just to be sure */ - message("cpu name: "); - message(cpu_name); - message("\n"); + _mesa_debug(NULL, "CPU name: %s\n", cpu_name); } } @@ -409,7 +388,7 @@ void _mesa_init_all_x86_transform_asm( void ) #ifdef USE_MMX_ASM if ( cpu_has_mmx ) { if ( _mesa_getenv( "MESA_NO_MMX" ) == 0 ) { - message( "MMX cpu detected.\n" ); + _mesa_debug(NULL, "MMX cpu detected.\n"); } else { _mesa_x86_cpu_features &= ~(X86_FEATURE_MMX); } @@ -419,7 +398,7 @@ void _mesa_init_all_x86_transform_asm( void ) #ifdef USE_3DNOW_ASM if ( cpu_has_3dnow ) { if ( _mesa_getenv( "MESA_NO_3DNOW" ) == 0 ) { - message( "3DNow! cpu detected.\n" ); + _mesa_debug(NULL, "3DNow! cpu detected.\n"); _mesa_init_3dnow_transform_asm(); } else { _mesa_x86_cpu_features &= ~(X86_FEATURE_3DNOW); @@ -430,7 +409,7 @@ void _mesa_init_all_x86_transform_asm( void ) #ifdef USE_SSE_ASM if ( cpu_has_xmm ) { if ( _mesa_getenv( "MESA_NO_SSE" ) == 0 ) { - message( "SSE cpu detected.\n" ); + _mesa_debug(NULL, "SSE cpu detected.\n"); if ( _mesa_getenv( "MESA_FORCE_SSE" ) == 0 ) { check_os_sse_support(); } @@ -438,7 +417,7 @@ void _mesa_init_all_x86_transform_asm( void ) _mesa_init_sse_transform_asm(); } } else { - message( "SSE cpu detected, but switched off by user.\n" ); + _mesa_debug(NULL, "SSE cpu detected, but switched off by user.\n"); _mesa_x86_cpu_features &= ~(X86_FEATURE_XMM); } } |