[MPlayer-dev-eng] [PATCH] better detction for sparc cpu's and compile fix for libmpeg2

jb13 at gomerbud.com jb13 at gomerbud.com
Thu Aug 5 03:59:12 CEST 2004


This patch add's better cpu detction for sparc, and fixes libmpeg2 to not
asume that all sparc's have the VIS instructions. tested on netbsd/sparc
and solaris 2.6 sparc, this was not tested on an ultrasparc with VIS as i 
don't have one. and it doesn't handle the case of someone running a
32bit kernel on an ultrasparc with linux or *bsd as i don't know what uname
returns for them. i'll send a patch later for that and more sparc stuff
later.

note that the default target for gcc on ultrasparc is still a 32bit binary,
it mite help MPlayer to be compiled as a 64bit binary.
-------------- next part --------------
? sparc_compile.diff
Index: configure
===================================================================
RCS file: /cvsroot/mplayer/main/configure,v
retrieving revision 1.891
diff -u -r1.891 configure
--- configure	5 Aug 2004 00:14:16 -0000	1.891
+++ configure	5 Aug 2004 01:55:51 -0000
@@ -446,7 +446,8 @@
       x86_64|amd64) host_arch=x86_64 ;;
       macppc|ppc) host_arch=ppc ;;
       alpha) host_arch=alpha ;;
-      sparc*) host_arch=sparc ;;
+      sparc) host_arch=sparc ;;
+      sparc64) host_arch=sparc64 ;;
       parisc*|hppa*|9000*) host_arch=hppa ;;
       arm*) host_arch=arm ;;
       s390) host_arch=s390 ;;
@@ -882,7 +883,33 @@
     _def_arch='#define ARCH_SPARC 1'
     _target_arch='TARGET_ARCH_SPARC = yes'
     iproc='sparc'
-    proc='v8'
+    if sunos ; then
+	echocheck "CPU type"
+	karch=`uname -m`
+	case "`echo $karch`" in
+	    sun4) proc=v7 ;;
+	    sun4c) proc=v7 ;; 
+	    sun4d) proc=v8 ;;
+	    sun4m) proc=v8 ;;
+	    sun4u) proc=v9 _vis='yes' _def_vis='#define HAVE_VIS = yes' ;;
+	    *) ;;
+	esac
+	echores "$proc"
+    else
+	proc=v8
+    fi
+    _march=''
+    _mcpu="-mcpu=$proc"
+    _optimizing="$proc"
+    ;;
+
+  sparc64)
+    _def_arch='#define ARCH_SPARC 1'
+    _target_arch='TARGET_ARCH_SPARC = yes'
+    _vis='yes'
+    _def_vis='#define HAVE_VIS = yes'
+    iproc='sparc'
+    proc='v9'
     _march=''
     _mcpu="-mcpu=$proc"
     _optimizing="$proc"
@@ -6218,6 +6245,7 @@
 TARGET_3DNOWEX = $_3dnowex
 TARGET_SSE = $_sse
 TARGET_ALTIVEC = $_altivec
+TARGET_VIS = $_vis
 
 # --- GUI stuff ---
 GTKLIB = $_ld_static $_ld_gtk
@@ -6772,6 +6800,7 @@
 
 
 $_def_mlib  // Sun mediaLib, available only on solaris
+$_def_vis	// only define if you have VIS ( ultrasparc )
 
 /* libmpeg2 uses a different feature test macro for mediaLib */
 #ifdef HAVE_MLIB
Index: libmpeg2/Makefile
===================================================================
RCS file: /cvsroot/mplayer/main/libmpeg2/Makefile,v
retrieving revision 1.13
diff -u -r1.13 Makefile
--- libmpeg2/Makefile	2 Aug 2004 11:20:38 -0000	1.13
+++ libmpeg2/Makefile	5 Aug 2004 01:55:51 -0000
@@ -13,6 +13,10 @@
 SRCS += motion_comp_altivec.c idct_altivec.c
 endif
 
+ifeq ($(TARGET_VIS),yes)
+SRCS += motion_comp_vis.c
+endif
+
 .SUFFIXES: .c .o
 
 # .PHONY: all clean
Index: libmpeg2/cpu_accel.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpeg2/cpu_accel.c,v
retrieving revision 1.4
diff -u -r1.4 cpu_accel.c
--- libmpeg2/cpu_accel.c	2 Aug 2004 11:20:38 -0000	1.4
+++ libmpeg2/cpu_accel.c	5 Aug 2004 01:55:51 -0000
@@ -108,7 +108,7 @@
 }
 #endif /* ARCH_X86 */
 
-#if defined(ARCH_PPC) || defined(ARCH_SPARC)
+#if defined(ARCH_PPC) || (defined(ARCH_SPARC) && defined(HAVE_VIS))
 #include <signal.h>
 #include <setjmp.h>
 
Index: libmpeg2/motion_comp.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpeg2/motion_comp.c,v
retrieving revision 1.7
diff -u -r1.7 motion_comp.c
--- libmpeg2/motion_comp.c	2 Aug 2004 11:20:38 -0000	1.7
+++ libmpeg2/motion_comp.c	5 Aug 2004 01:55:51 -0000
@@ -55,10 +55,12 @@
     else
 #endif
 #ifdef ARCH_SPARC
+#ifdef HAVE_VIS
     if (accel & MPEG2_ACCEL_SPARC_VIS)
 	mpeg2_mc = mpeg2_mc_vis;
     else
 #endif
+#endif
 	mpeg2_mc = mpeg2_mc_c;
 }
 


More information about the MPlayer-dev-eng mailing list