From 8c7d24b606e3b5b02f20424abee1c240d7696a1f Mon Sep 17 00:00:00 2001 From: Robin KAY Date: Mon, 20 Oct 2003 00:33:28 +0000 Subject: Allow lazy loading of Sun mediaLib. Update ChangeLog. CVS patchset: 5553 CVS date: 2003/10/20 00:33:28 --- src/xine-utils/cpu_accel.c | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) (limited to 'src/xine-utils') diff --git a/src/xine-utils/cpu_accel.c b/src/xine-utils/cpu_accel.c index 6794143f7..d0f328112 100644 --- a/src/xine-utils/cpu_accel.c +++ b/src/xine-utils/cpu_accel.c @@ -26,6 +26,7 @@ #include #include #include +#include #include "xineutils.h" @@ -174,16 +175,32 @@ static uint32_t arch_accel (void) uint32_t xine_mm_accel (void) { -#if defined (ARCH_X86) || (defined (ARCH_PPC) && defined (ENABLE_ALTIVEC)) + static int initialized = 0; static uint32_t accel; - static int initialized; if (!initialized) { +#if defined (ARCH_X86) || (defined (ARCH_PPC) && defined (ENABLE_ALTIVEC)) accel = arch_accel (); +#elif defined (HAVE_MLIB) +#ifdef MLIB_LAZYLOAD + void *hndl; + + if ((hndl = dlopen("libmlib.so.2", RTLD_LAZY | RTLD_GLOBAL | RTLD_NODELETE)) == NULL) { + accel = 0; + } + else { + dlclose(hndl); + accel = MM_ACCEL_MLIB; + } +#else + accel = MM_ACCEL_MLIB; +#endif +#else + accel = 0; +#endif #if defined(ARCH_X86) || defined(ARCH_X86_64) #ifndef _MSC_VER - /* test OS support for SSE */ if( accel & MM_ACCEL_X86_SSE ) { void (*old_sigill_handler)(int); @@ -202,22 +219,14 @@ uint32_t xine_mm_accel (void) signal (SIGILL, old_sigill_handler); } #endif /* _MSC_VER */ -#endif /* ARCH_X86 */ +#endif /* ARCH_X86 || ARCH_X86_64 */ - if( getenv("XINE_NO_ACCEL") ) + if(getenv("XINE_NO_ACCEL")) { accel = 0; + } - initialized++; + initialized = 1; } return accel; - -#else /* !ARCH_X86 && !ARCH_PPC/ENABLE_ALTIVEC */ -#ifdef HAVE_MLIB - return MM_ACCEL_MLIB; -#else - return 0; -#endif -#endif /* !ARCH_X86 && !ARCH_PPC/ENABLE_ALTIVEC */ } - -- cgit v1.2.3