On Tue, Aug 26, 2008 at 01:56:45PM +0200, Matthias Kilian wrote:
> On Mon, Aug 25, 2008 at 07:49:54PM -0400, Brad wrote:
> > > This seems to reduce ffplay cpu usage by 25% on a G4 (even more
> > > when converting video files with ffmpeg). I didn't notice any
> > > improvement on arm, however.
> 
> Correction: there seems to be a very small improvement on arm
> (converting 30 seconds video took 1:39.60 with ffmpeg-20080620p1
> and 1:37.58 with ffmpeg-20080620p2), 
> 
> > Show me the output of the "make configure" step.

Ok, here is a newer diff that disables the AltiVec support
for the time being. This can be looked into later but this
at least makes it possible to buid in the support for further
debugging.


Index: Makefile
===================================================================
RCS file: /cvs/ports/graphics/ffmpeg/Makefile,v
retrieving revision 1.38
diff -u -p -r1.38 Makefile
--- Makefile    25 Jul 2008 20:25:59 -0000      1.38
+++ Makefile    27 Aug 2008 00:43:54 -0000
@@ -4,7 +4,7 @@ COMMENT=        audio/video converter and strea
 
 V=                     20080620
 DISTNAME=              ffmpeg-svn-${V}
-PKGNAME=               ffmpeg-${V}p1
+PKGNAME=               ffmpeg-${V}p2
 SHARED_LIBS=           avutil          6.0 \
                        avcodec         13.0 \
                        avformat        12.0 \
@@ -79,7 +79,12 @@ CONFIGURE_ARGS+=     ${CONFIGURE_SHARED} \
                        --enable-x11grab \
                        --extra-libs="-L${LOCALBASE}/lib -L${X11BASE}/lib" \
                        --extra-cflags="-I${LOCALBASE}/include 
-I${X11BASE}/include" \
-                       --disable-decoder=cavs
+                       --disable-decoder=cavs \
+                       --disable-altivec \
+                       --disable-armv6 \
+                       --disable-armvfp \
+                       --disable-iwmmxt \
+                       --disable-neon
 
 CONFIGURE_ENV+=                LIBavutil_EXTRALIBS="${LIBavutil_EXTRALIBS}" \
                        LIBavcodec_EXTRALIBS="${LIBavcodec_EXTRALIBS}" \
Index: patches/patch-configure
===================================================================
RCS file: /cvs/ports/graphics/ffmpeg/patches/patch-configure,v
retrieving revision 1.19
diff -u -p -r1.19 patch-configure
--- patches/patch-configure     9 Jul 2008 01:57:44 -0000       1.19
+++ patches/patch-configure     27 Aug 2008 00:42:27 -0000
@@ -1,7 +1,18 @@
 $OpenBSD: patch-configure,v 1.19 2008/07/09 01:57:44 jakemsr Exp $
---- configure.orig     Fri Jun 20 19:40:11 2008
-+++ configure  Sat Jul  5 03:08:34 2008
-@@ -953,9 +953,9 @@ enable stripping
+--- configure.orig     Fri Jun 20 22:40:11 2008
++++ configure  Thu Aug 14 23:43:26 2008
+@@ -934,6 +934,10 @@ cpu="generic"
+ # OS
+ target_os=$(tolower $(uname -s))
+ 
++if test $target_os = openbsd; then
++  arch=`arch -s`
++fi
++
+ # libraries
+ enable bzlib
+ enable zlib
+@@ -953,9 +957,9 @@ enable stripping
  vhook="default"
  
  # build settings
@@ -13,7 +24,7 @@ $OpenBSD: patch-configure,v 1.19 2008/07
  FFSERVERLDFLAGS=-Wl,-E
  LIBPREF="lib"
  LIBSUF=".a"
-@@ -965,7 +965,7 @@ SLIBPREF="lib"
+@@ -965,7 +969,7 @@ SLIBPREF="lib"
  SLIBSUF=".so"
  SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
  SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
@@ -22,7 +33,33 @@ $OpenBSD: patch-configure,v 1.19 2008/07
  LIB_INSTALL_EXTRA_CMD='$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
  
  # gcc stupidly only outputs the basename of targets with -MM
-@@ -1213,9 +1213,9 @@ case $target_os in
+@@ -1130,7 +1134,7 @@ EOF
+         arch="powerpc"
+         enable fast_64bit
+     ;;
+-    mips|mipsel|IP*)
++    mips|mipsel|mips64|IP*)
+         arch="mips"
+     ;;
+     sun4u|sparc64)
+@@ -1140,13 +1144,13 @@ EOF
+     sparc)
+         arch="sparc"
+     ;;
+-    sh4)
++    sh4|sh)
+         arch="sh4"
+     ;;
+-    parisc)
++    parisc|hppa)
+         arch="parisc"
+     ;;
+-    parisc64)
++    parisc64|hppa64)
+         arch="parisc"
+         enable fast_64bit
+     ;;
+@@ -1213,9 +1217,9 @@ case $target_os in
          disable need_memalign
          LIBOBJFLAGS='$(PIC)'
          SHFLAGS='-shared'
@@ -35,7 +72,7 @@ $OpenBSD: patch-configure,v 1.19 2008/07
          oss_demuxer_extralibs="-lossaudio"
          oss_muxer_extralibs="-lossaudio"
          ;;
-@@ -1501,7 +1501,7 @@ fi
+@@ -1501,7 +1505,7 @@ fi
  check_cc <<EOF || die "Symbol mangling check failed."
  int ff_extern;
  EOF
@@ -44,7 +81,34 @@ $OpenBSD: patch-configure,v 1.19 2008/07
  extern_prefix=${sym%%ff_extern*}
  
  check_asm inline_asm '""'
-@@ -1582,10 +1582,14 @@ enabled vis && add_cflags "-mcpu=ultrasparc -mtune=ult
+@@ -1531,16 +1535,16 @@ fi
+ 
+ # check for assembler specific support
+ 
+-if test $arch = "powerpc"; then
+-check_cc <<EOF && enable dcbzl
+-int main(void) {
+-    register long zero = 0;
+-    char data[1024];
+-    asm volatile("dcbzl %0, %1" : : "b" (data), "r" (zero));
+-return 0;
+-}
+-EOF
+-fi
++#if test $arch = "powerpc"; then
++#check_cc <<EOF && enable dcbzl
++#int main(void) {
++#    register long zero = 0;
++#    char data[1024];
++#    asm volatile("dcbzl %0, %1" : : "b" (data), "r" (zero));
++#return 0;
++#}
++#EOF
++#fi
+ 
+ # check for SIMD availability
+ 
+@@ -1582,10 +1586,14 @@ enabled vis && add_cflags "-mcpu=ultrasparc -mtune=ult
  
  # ---
  # big/little-endian test
@@ -62,7 +126,7 @@ $OpenBSD: patch-configure,v 1.19 2008/07
  
  # ---
  # check availability of some header files
-@@ -1607,7 +1611,7 @@ check_func2 windows.h GetProcessTimes
+@@ -1607,7 +1615,7 @@ check_func2 windows.h GetProcessTimes
  check_header byteswap.h
  check_header conio.h
  check_header dlfcn.h
@@ -71,7 +135,7 @@ $OpenBSD: patch-configure,v 1.19 2008/07
  check_header sys/mman.h
  check_header sys/resource.h
  check_header termios.h
-@@ -1717,10 +1721,10 @@ if test "$target_os" = cygwin -o "$target_os" = mingw3
+@@ -1717,10 +1725,10 @@ if test "$target_os" = cygwin -o "$target_os" = mingw3
      echo
  fi
  
@@ -86,7 +150,7 @@ $OpenBSD: patch-configure,v 1.19 2008/07
  
  check_foo_config imlib2 imlib2 Imlib2.h imlib_load_font
  check_foo_config freetype2 freetype ft2build.h FT_Init_FreeType
-@@ -1756,7 +1760,7 @@ fi
+@@ -1756,7 +1764,7 @@ fi
  
  texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
  
@@ -95,7 +159,7 @@ $OpenBSD: patch-configure,v 1.19 2008/07
  
  ##########################################
  # Network check
-@@ -1831,7 +1835,7 @@ enabled extra_warnings && check_cflags -Winline
+@@ -1831,7 +1839,7 @@ enabled extra_warnings && check_cflags -Winline
  # add some linker flags
  check_ldflags -Wl,--warn-common
  check_ldflags $LDLATEFLAGS
@@ -104,7 +168,7 @@ $OpenBSD: patch-configure,v 1.19 2008/07
  
  if enabled small; then
      check_cflags -Os            # not all compilers support -Os
-@@ -2204,8 +2208,7 @@ Version: $version
+@@ -2204,8 +2212,7 @@ Version: $version
  Requires: $(disabled shared && echo $requires)
  Requires.private: $(enabled shared && echo $requires)
  Conflicts:
@@ -114,7 +178,7 @@ $OpenBSD: patch-configure,v 1.19 2008/07
  Cflags: -I\${includedir}
  EOF
  cat <<EOF > $name/$name-uninstalled.pc
-@@ -2224,17 +2227,17 @@ Cflags: -I\${includedir}
+@@ -2224,17 +2231,17 @@ Cflags: -I\${includedir}
  EOF
  }
  
Index: patches/patch-libavcodec_ppc_check_altivec_c
===================================================================
RCS file: patches/patch-libavcodec_ppc_check_altivec_c
diff -N patches/patch-libavcodec_ppc_check_altivec_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-libavcodec_ppc_check_altivec_c        27 Aug 2008 00:42:27 
-0000
@@ -0,0 +1,43 @@
+$OpenBSD$
+--- libavcodec/ppc/check_altivec.c.orig        Sun May 25 01:00:48 2008
++++ libavcodec/ppc/check_altivec.c     Thu Aug 14 23:00:30 2008
+@@ -24,6 +24,10 @@
+ 
+ #ifdef __APPLE__
+ #include <sys/sysctl.h>
++#elif __OpenBSD__
++#include <sys/param.h>
++#include <sys/sysctl.h>
++#include <machine/cpu.h>
+ #elif __AMIGAOS4__
+ #include <exec/exec.h>
+ #include <interfaces/exec.h>
+@@ -44,15 +48,22 @@ int has_altivec(void)
+     IExec->GetCPUInfoTags(GCIT_VectorUnit, &result, TAG_DONE);
+     if (result == VECTORTYPE_ALTIVEC) return 1;
+     return 0;
+-#elif __APPLE__
+-    int sels[2] = {CTL_HW, HW_VECTORUNIT};
+-    int has_vu = 0;
++#elif defined(__APPLE__) || defined(__OpenBSD__)
++    int sels[2];
++    int has_vu = 0, err;
+     size_t len = sizeof(has_vu);
+-    int err;
+ 
+-    err = sysctl(sels, 2, &has_vu, &len, NULL, 0);
++#ifdef __OpenBSD__
++    sels[0] = CTL_MACHDEP;
++    sels[1] = CPU_ALTIVEC;
++#else
++    sels[0] = CTL_HW;
++    sels[1] = HW_VECTORUNIT;
++#endif
+ 
+-    if (err == 0) return has_vu != 0;
++    err = sysctl(sels, 2, &has_vu, &len, NULL, 0);
++    if (err == 0)
++        return has_vu != 0;
+     return 0;
+ #elif defined(RUNTIME_CPUDETECT)
+     int proc_ver;

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

Reply via email to