# HG changeset patch
# User Diego 'Flameeyes' Pettenò <[EMAIL PROTECTED]>
# Date 1181389568 -7200
# Node ID 862235f3ca388412178eed8e853e66a4ed5ffde1
# Parent ad1ddbe4df1af7e7edb6b1678a90d22bd90efde8
Add a cpu_accel.h header to use for CPU acceleration detection.
diff -r 862235f3ca388412178eed8e853e66a4ed5ffde1 -r
ad1ddbe4df1af7e7edb6b1678a90d22bd90efde8 src/xine-utils/Makefile.am
--- a/src/xine-utils/Makefile.am Sat Jun 09 13:46:08 2007 +0200
+++ b/src/xine-utils/Makefile.am Sat Jun 09 13:31:14 2007 +0200
@@ -29,6 +29,7 @@ endif
endif
libxineutils_la_SOURCES = $(pppc_files) \
+ cpu_accel.h \
cpu_accel.c \
color.c \
copy.c \
diff -r 862235f3ca388412178eed8e853e66a4ed5ffde1 -r
ad1ddbe4df1af7e7edb6b1678a90d22bd90efde8 src/xine-utils/cpu_accel.c
--- a/src/xine-utils/cpu_accel.c Sat Jun 09 13:46:08 2007 +0200
+++ b/src/xine-utils/cpu_accel.c Sat Jun 09 13:31:14 2007 +0200
@@ -39,7 +39,7 @@
#define LOG
*/
-#include "xineutils.h"
+#include "cpu_accel.h"
#if defined(__i386__) || defined(__x86_64__)
diff -r 862235f3ca388412178eed8e853e66a4ed5ffde1 -r
ad1ddbe4df1af7e7edb6b1678a90d22bd90efde8 src/xine-utils/xineutils.h
--- a/src/xine-utils/xineutils.h Sat Jun 09 13:46:08 2007 +0200
+++ b/src/xine-utils/xineutils.h Sat Jun 09 13:31:14 2007 +0200
@@ -101,34 +101,6 @@ extern "C" {
* long constant values MUST be suffixed by LL and unsigned long long
* values by ULL, lest they be truncated by the compiler)
*/
-
-/* generic accelerations */
-#define MM_ACCEL_MLIB 0x00000001
-
-/* x86 accelerations */
-#define MM_ACCEL_X86_MMX 0x80000000
-#define MM_ACCEL_X86_3DNOW 0x40000000
-#define MM_ACCEL_X86_MMXEXT 0x20000000
-#define MM_ACCEL_X86_SSE 0x10000000
-#define MM_ACCEL_X86_SSE2 0x08000000
-
-/* powerpc accelerations and features */
-#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
-#define MM_MMXEXT MM_ACCEL_X86_MMXEXT
-#define MM_SSE MM_ACCEL_X86_SSE
-#define MM_SSE2 MM_ACCEL_X86_SSE2
-
-uint32_t xine_mm_accel (void) XINE_PROTECTED;
#if defined(ARCH_X86) || defined(ARCH_X86_64)
diff -r 862235f3ca388412178eed8e853e66a4ed5ffde1 -r
ad1ddbe4df1af7e7edb6b1678a90d22bd90efde8 src/xine-utils/cpu_accel.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/xine-utils/cpu_accel.h Sat Jun 09 13:31:14 2007 +0200
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2007 the xine project
+ *
+ * This file is part of xine, a free video player.
+ *
+ * xine is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * xine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+/**
+ * @file
+ * @brief CPU acceleration availability.
+ * @internal
+ *
+ * This header was designed to easily allow switching between run-time
+ * and build-time CPU features detection.
+ *
+ * By using build-time CPU detection the code will not have to
+ * actually call cpuid to check what the CPU supports, and can safely
+ * make direct use of advanced features.
+ *
+ * As this file relies on the presence of BUILDTIME_CPU_DETECTION
+ * define from configure.h (autoheader), this file should only be used
+ * within xine itself.
+ *
+ * External plugins wanting to check for CPU featuers should instead
+ * define their own code for that purpose.
+ */
+
+#ifndef __XINE_CPU_ACCEL_H__
+#define __XINE_CPU_ACCEL_H__
+
+/* generic accelerations */
+#define MM_ACCEL_MLIB 0x00000001
+
+/* x86/x86-64 accelerations */
+#define MM_ACCEL_X86_MMX 0x80000000
+#define MM_ACCEL_X86_3DNOW 0x40000000
+#define MM_ACCEL_X86_MMXEXT 0x20000000
+#define MM_ACCEL_X86_SSE 0x10000000
+#define MM_ACCEL_X86_SSE2 0x08000000
+
+/* PowerPC accelerations and features */
+#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
+
+uint32_t xine_mm_accel (void) XINE_PROTECTED;
+
+#ifdef BUILDTIME_CPU_DETECTION
+
+#if defined(__MMX__)
+# define CHECK_MMX 1
+#else
+# define CHECK_MMX 0
+#endif
+
+#ifdef __3dNOW__
+# define CHECK_3DNOW 1
+#else
+# define CHECK_3DNOW 0
+#endif
+
+#ifdef __SSE__
+# define CHECK_SSE 1
+#else
+# define CHECK_SSE 0
+#endif
+
+#ifdef __SSE2__
+# define CHECK_SSE 1
+#else
+# define CHECK_SSE 0
+#endif
+
+#else
+
+# define CHECK_MMX (xine_mm_accel() & MM_ACCEL_X86_MMX)
+# define CHECK_3DNOW (xine_mm_accel() && MM_ACCEL_X86_3DNOW)
+# define CHECK_SSE (xine_mm_accel() & MM_ACCEL_X86_SSE)
+# define CHECK_SSE2 (xine_mm_accel() && MM_ACCEL_X86_SSE2)
+
+#endif
+
+/* This is not bound to a compiler define. */
+# define CHECK_MMXEXT (xine_mm_accel() & MM_ACCEL_X86_MMXEXT)
+
+#endif
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Xine-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xine-cvslog