summaryrefslogtreecommitdiff
path: root/src/xine-utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/xine-utils')
-rw-r--r--src/xine-utils/cpu_accel.c115
-rw-r--r--src/xine-utils/xineutils.h7
2 files changed, 87 insertions, 35 deletions
diff --git a/src/xine-utils/cpu_accel.c b/src/xine-utils/cpu_accel.c
index 962eb7456..60ae51cba 100644
--- a/src/xine-utils/cpu_accel.c
+++ b/src/xine-utils/cpu_accel.c
@@ -140,68 +140,115 @@ static void sigill_handler (int n) {
}
#endif /* ARCH_X86 */
-#if defined (ARCH_PPC) && defined (ENABLE_ALTIVEC)
+#if defined(ARCH_PPC) && defined(ENABLE_ALTIVEC)
static sigjmp_buf jmpbuf;
static volatile sig_atomic_t canjump = 0;
static void sigill_handler (int sig)
{
- if (!canjump) {
- signal (sig, SIG_DFL);
- raise (sig);
- }
+ if (!canjump) {
+ signal (sig, SIG_DFL);
+ raise (sig);
+ }
- canjump = 0;
- siglongjmp (jmpbuf, 1);
+ canjump = 0;
+ siglongjmp (jmpbuf, 1);
}
static uint32_t arch_accel (void)
{
- /* FIXME: Autodetect cache line size via AUX ELF vector or otherwise */
- uint32_t flags = MM_ACCEL_PPC_CACHE32;
-
- signal (SIGILL, sigill_handler);
- if (sigsetjmp (jmpbuf, 1)) {
- signal (SIGILL, SIG_DFL);
- return flags;
- }
+ /* FIXME: Autodetect cache line size via AUX ELF vector or otherwise */
+ uint32_t flags = MM_ACCEL_PPC_CACHE32;
- canjump = 1;
+ signal (SIGILL, sigill_handler);
+ if (sigsetjmp (jmpbuf, 1)) {
+ signal (SIGILL, SIG_DFL);
+ return flags;
+ }
- __asm__ volatile ("mtspr 256, %0\n\t"
- "vand %%v0, %%v0, %%v0"
- :
- : "r" (-1));
+ canjump = 1;
+ __asm__ volatile ("mtspr 256, %0\n\t"
+ "vand %%v0, %%v0, %%v0"
+ :
+ : "r" (-1));
- signal (SIGILL, SIG_DFL);
- return flags|MM_ACCEL_PPC_ALTIVEC;
+ signal (SIGILL, SIG_DFL);
+ return flags|MM_ACCEL_PPC_ALTIVEC;
}
#endif /* ARCH_PPC */
+#if defined(ARCH_SPARC) && defined(ENABLE_VIS)
+static sigjmp_buf jmpbuf;
+static volatile sig_atomic_t canjump = 0;
+
+static void sigill_handler (int sig)
+{
+ if (!canjump) {
+ signal(sig, SIG_DFL);
+ raise(sig);
+ }
+
+ canjump = 0;
+ siglongjmp(jmpbuf, 1);
+}
+
+static uint32_t arch_accel (void)
+{
+ uint32_t flags = 0;
+
+ signal(SIGILL, sigill_handler);
+ if (sigsetjmp(jmpbuf, 1)) {
+ signal(SIGILL, SIG_DFL);
+ return flags;
+ }
+
+ canjump = 1;
+
+ /* pdist %f0, %f0, %f0 */
+ __asm__ __volatile__(".word\t0x81b007c0");
+
+ canjump = 0;
+ flags |= MM_ACCEL_SPARC_VIS;
+
+ if (sigsetjmp(jmpbuf, 1)) {
+ signal(SIGILL, SIG_DFL);
+ return flags;
+ }
+
+ canjump = 1;
+
+ /* edge8n %g0, %g0, %g0 */
+ __asm__ __volatile__(".word\t0x81b00020");
+
+ canjump = 0;
+ flags |= MM_ACCEL_SPARC_VIS2;
+
+ signal(SIGILL, SIG_DFL);
+ return flags;
+}
+#endif /* ARCH_SPARC */
+
uint32_t xine_mm_accel (void)
{
static int initialized = 0;
- static uint32_t accel;
+ static uint32_t accel = 0;
if (!initialized) {
-#if defined (ARCH_X86) || (defined (ARCH_PPC) && defined (ENABLE_ALTIVEC))
- accel = arch_accel ();
-#elif defined (HAVE_MLIB)
+#ifdef HAVE_MLIB
#ifdef MLIB_LAZYLOAD
void *hndl;
- if ((hndl = dlopen("libmlib.so.2", RTLD_LAZY | RTLD_GLOBAL | RTLD_NODELETE)) == NULL) {
- accel = 0;
- }
- else {
+ if ((hndl = dlopen("libmlib.so.2", RTLD_LAZY | RTLD_GLOBAL | RTLD_NODELETE)) != NULL) {
dlclose(hndl);
- accel = MM_ACCEL_MLIB;
+ accel |= MM_ACCEL_MLIB;
}
#else
- accel = MM_ACCEL_MLIB;
+ accel |= MM_ACCEL_MLIB;
#endif
-#else
- accel = 0;
+#endif
+
+#if defined(ARCH_X86) || (defined(ARCH_PPC) && defined(ENABLE_ALTIVEC)) || (defined(ARCH_SPARC) && defined(ENABLE_VIS))
+ accel |= arch_accel();
#endif
#if defined(ARCH_X86) || defined(ARCH_X86_64)
diff --git a/src/xine-utils/xineutils.h b/src/xine-utils/xineutils.h
index c64e4f12a..083d409be 100644
--- a/src/xine-utils/xineutils.h
+++ b/src/xine-utils/xineutils.h
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: xineutils.h,v 1.85 2004/04/25 17:43:58 manfredtremmel Exp $
+ * $Id: xineutils.h,v 1.86 2004/04/28 00:38:09 komadori Exp $
*
*/
#ifndef XINEUTILS_H
@@ -99,6 +99,11 @@ extern "C" {
#define MM_ACCEL_PPC_ALTIVEC 0x04000000
#define MM_ACCEL_PPC_CACHE32 0x02000000
+/* SPARC accelerations */
+
+#define MM_ACCEL_SPARC_VIS 0x01000000
+#define MM_ACCEL_SPARC_VIS2 0x00800000
+
/* x86 compat defines */
#define MM_MMX MM_ACCEL_X86_MMX
#define MM_3DNOW MM_ACCEL_X86_3DNOW