diff --git a/common/cpudetect.c b/common/cpudetect.c deleted file mode 100644 index d68370f231..0000000000 --- a/common/cpudetect.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * This file is part of MPlayer. - * - * MPlayer 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. - * - * MPlayer 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 MPlayer; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include -#include -#include - -#include -#include "compat/libav.h" - -#include "config.h" -#include "common/cpudetect.h" - -CpuCaps gCpuCaps; - -void GetCpuCaps(CpuCaps *c) -{ - memset(c, 0, sizeof(*c)); - int flags = av_get_cpu_flags(); -#if ARCH_X86 - c->hasMMX = flags & AV_CPU_FLAG_MMX; - c->hasMMX2 = flags & AV_CPU_FLAG_MMX2; - c->hasSSE = flags & AV_CPU_FLAG_SSE; - c->hasSSE2 = (flags & AV_CPU_FLAG_SSE2) && !(flags & AV_CPU_FLAG_SSE2SLOW); - c->hasSSE3 = (flags & AV_CPU_FLAG_SSE3) && !(flags & AV_CPU_FLAG_SSE3SLOW); - c->hasSSSE3 = flags & AV_CPU_FLAG_SSSE3; -#endif -} diff --git a/common/cpudetect.h b/common/cpudetect.h deleted file mode 100644 index d3d9206c65..0000000000 --- a/common/cpudetect.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * This file is part of MPlayer. - * - * MPlayer 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. - * - * MPlayer 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 MPlayer; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef MPLAYER_CPUDETECT_H -#define MPLAYER_CPUDETECT_H - -#include -#include "config.h" - -#include "compat/x86_cpu.h" - -typedef struct cpucaps_s { - bool hasMMX; - bool hasMMX2; - bool hasSSE; - bool hasSSE2; - bool hasSSE3; - bool hasSSSE3; -} CpuCaps; - -extern CpuCaps gCpuCaps; - -void GetCpuCaps(CpuCaps *caps); - -#endif /* MPLAYER_CPUDETECT_H */ diff --git a/compat/mangle.h b/compat/mangle.h deleted file mode 100644 index fbec0d0b92..0000000000 --- a/compat/mangle.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * CPP macros to deal with different symbol mangling across binary formats. - * - * Copyright (C) 2002 Felix Buenemann - * - * This file is part of MPlayer. - * - * MPlayer 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. - * - * MPlayer 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 MPlayer; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef MPLAYER_MANGLE_H -#define MPLAYER_MANGLE_H - -#include "config.h" - -#if (__GNUC__ * 100 + __GNUC_MINOR__ >= 300) -#define attribute_used __attribute__((used)) -#else -#define attribute_used -#endif - -#if defined(_WIN32) && !defined(_WIN64) || defined(__APPLE__) -#define EXTERN_PREFIX "_" -#else -#define EXTERN_PREFIX "" -#endif - -#if ARCH_X86_64 && defined(PIC) -#define MANGLE(a) EXTERN_PREFIX #a "(%%rip)" -#else -#define MANGLE(a) EXTERN_PREFIX #a -#endif - -#endif /* MPLAYER_MANGLE_H */ diff --git a/compat/x86_cpu.h b/compat/x86_cpu.h deleted file mode 100644 index 49a5b28a35..0000000000 --- a/compat/x86_cpu.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * copyright (c) 2006 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef MP_AVUTIL_X86_CPU_H -#define MP_AVUTIL_X86_CPU_H - -#include -#include "config.h" - -#if ARCH_X86_64 -# define REG_a "rax" -# define REG_b "rbx" -# define REG_c "rcx" -# define REG_d "rdx" -# define REG_D "rdi" -# define REG_S "rsi" -# define PTR_SIZE "8" -typedef int64_t x86_reg; - -# define REG_SP "rsp" -# define REG_BP "rbp" -# define REGBP rbp -# define REGa rax -# define REGb rbx -# define REGc rcx -# define REGd rdx -# define REGSP rsp - -#elif ARCH_X86_32 - -# define REG_a "eax" -# define REG_b "ebx" -# define REG_c "ecx" -# define REG_d "edx" -# define REG_D "edi" -# define REG_S "esi" -# define PTR_SIZE "4" -typedef int32_t x86_reg; - -# define REG_SP "esp" -# define REG_BP "ebp" -# define REGBP ebp -# define REGa eax -# define REGb ebx -# define REGc ecx -# define REGd edx -# define REGSP esp -#else -typedef int x86_reg; -#endif - -#define HAVE_7REGS (ARCH_X86_64 || (HAVE_EBX_AVAILABLE && HAVE_EBP_AVAILABLE)) -#define HAVE_6REGS (ARCH_X86_64 || (HAVE_EBX_AVAILABLE || HAVE_EBP_AVAILABLE)) - -#if ARCH_X86_64 && defined(PIC) -# define BROKEN_RELOCATIONS 1 -#endif - -#endif /* AVUTIL_X86_CPU_H */ diff --git a/old-configure b/old-configure index ab75ba16c3..c334c7a74c 100755 --- a/old-configure +++ b/old-configure @@ -129,14 +129,6 @@ EOF compile_check $TMPC $@ } -inline_asm_check() { - cat > $TMPC << EOF -int main(void) { __asm__ volatile ($1); return 0; } -EOF - shift - compile_check $TMPC $@ -} - # The following checks are special and should only be used with broken and # non-selfsufficient headers that do not include all of their dependencies. @@ -207,46 +199,6 @@ netbsd() { issystem "NetBSD"; } openbsd() { issystem "OpenBSD"; } win32() { cygwin || mingw32; } -# arch test boolean functions -x86_32() { - case "$host_arch" in - i[3-9]86|k5|k6|k6-2|k6-3|pentium*|athlon*|i586-i686) return 0 ;; - *) return 1 ;; - esac -} - -x86_64() { - case "$host_arch" in - x86_64|amd64) return 0 ;; - *) return 1 ;; - esac -} - -x86() { - x86_32 || x86_64 -} - -ppc() { - case "$host_arch" in - ppc|ppc64|powerpc|powerpc64) return 0;; - *) return 1;; - esac -} - -alpha() { - case "$host_arch" in - alpha*) return 0;; - *) return 1;; - esac -} - -arm() { - case "$host_arch" in - arm*) return 0;; - *) return 1;; - esac -} - # Use this before starting a check echocheck() { echo "============ Checking for $@ ============" >> "$TMPLOG" @@ -776,7 +728,7 @@ if test "$_cc" = auto ; then fi fi -# Determine our OS name and CPU architecture +# Determine our OS name if test -z "$_target" ; then # OS name system_name=$(uname -s 2>&1) @@ -800,41 +752,6 @@ if test -z "$_target" ; then ;; esac - - # host's CPU/instruction set - host_arch=$(uname -p 2>&1) - case "$host_arch" in - i386|sparc|ppc|alpha|arm|mips|vax) - ;; - powerpc) # Darwin returns 'powerpc' - host_arch=ppc - ;; - *) # uname -p on Linux returns 'unknown' for the processor type, - # OpenBSD returns 'Intel Pentium/MMX ("Genuine Intel" 586-class)' - - # Maybe uname -m (machine hardware name) returns something we - # recognize. - - case "$(uname -m 2>&1)" in - x86_64|amd64|i[3-9]86*|k5|k6|k6_2|k6_3|k6-2|k6-3|pentium*|athlon*|i586_i686|i586-i686|BePC) host_arch=i386 ;; - ia64) host_arch=ia64 ;; - macppc|ppc) host_arch=ppc ;; - ppc64) host_arch=ppc64 ;; - alpha) host_arch=alpha ;; - sparc) host_arch=sparc ;; - sparc64) host_arch=sparc64 ;; - parisc*|hppa*|9000*) host_arch=hppa ;; - arm*|zaurus|cats) host_arch=arm ;; - sh3|sh4|sh4a) host_arch=sh ;; - s390) host_arch=s390 ;; - s390x) host_arch=s390x ;; - *mips*) host_arch=mips ;; - vax) host_arch=vax ;; - xtensa*) host_arch=xtensa ;; - *) host_arch=UNKNOWN ;; - esac - ;; - esac else # if test -z "$_target" for i in 2 3; do system_name=$(echo $_target | cut -d '-' -f $i) @@ -851,11 +768,6 @@ else # if test -z "$_target" esac break done - # We need to convert underscores so that values like k6-2 and pentium-mmx can be passed - host_arch=$(echo $_target | cut -d '-' -f 1) - if test $(echo $host_arch) != "x86_64" ; then - host_arch=$(echo $host_arch | tr '_' '-') - fi fi extra_cflags="-I. -D_GNU_SOURCE $extra_cflags" @@ -1019,114 +931,11 @@ echocheck "perl" command_check perl -Mv5.8 -e';' || die "Perl is not functioning correctly or is ancient. Install the latest perl available." echo yes -if test -z "$_target" && x86 ; then - cat > $TMPC << EOF -int main(void) { - int test[(int)sizeof(char *)-7]; - return 0; -} -EOF - cc_check && host_arch=x86_64 || host_arch=i386 -fi - echo "Detected operating system: $system_name" -echo "Detected host architecture: $host_arch" # --- -# now that we know what compiler should be used for compilation, try to find -# out which assembler is used by the $_cc compiler -if test "$_as" = auto ; then - _as=$($_cc -print-prog-name=as) - test -z "$_as" && _as=as -fi - -def_fast_64bit='#define HAVE_FAST_64BIT 0' -def_arch_x86='#define ARCH_X86 0' -def_arch_x86_32='#define ARCH_X86_32 0' -def_arch_x86_64='#define ARCH_X86_64 0' - -case "$host_arch" in - i[3-9]86|x86|x86pc|k5|k6|k6-2|k6-3|pentium*|athlon*|i586-i686) - arch='x86' - subarch='x86_32' - def_arch_x86='#define ARCH_X86 1' - def_arch_x86_32='#define ARCH_X86_32 1' - ;; - - ia64) - arch='ia64' - def_fast_64bit='#define HAVE_FAST_64BIT 1' - ;; - - x86_64|amd64) - arch='x86' - subarch='x86_64' - def_arch_x86='#define ARCH_X86 1' - def_arch_x86_64='#define ARCH_X86_64 1' - def_fast_64bit='#define HAVE_FAST_64BIT 1' - ;; - - sparc|sparc64) - arch='sparc' - ;; - - arm*) - arch='arm' - ;; - - avr32) - arch='avr32' - ;; - - sh|sh4) - arch='sh4' - ;; - - ppc|ppc64|powerpc|powerpc64) - arch='ppc' - ;; - - alpha*) - arch='alpha' - ;; - - mips*) - arch='mips' - ;; - - hppa) - arch='pa_risc' - ;; - - s390) - arch='s390' - ;; - - s390x) - arch='s390x' - ;; - - vax) - arch='vax' - ;; - - xtensa) - arch='xtensa' - ;; - - generic) - arch='generic' - ;; - - *) - echo "The architecture of your CPU ($host_arch) is not supported by this configure script" - echo "It seems nobody has ported mpv to your OS or CPU type yet." - die "unsupported architecture $host_arch" - ;; -esac # case "$host_arch" in - -echocheck "assembler support of -pipe option" +echocheck "compiler support of -pipe option" # -I. helps to detect compilers that just misunderstand -pipe like Sun C cflag_check -pipe -I. && _pipe="-pipe" && echores "yes" || echores "no" @@ -1180,44 +989,6 @@ if test -n "$CPPFLAGS" ; then fi -echocheck "PIC" -pic=no -cat > $TMPC << EOF -int main(void) { -#if !(defined(__PIC__) || defined(__pic__) || defined(PIC)) -#error PIC not enabled -#endif - return 0; -} -EOF -cc_check && pic=yes && extra_cflags="$extra_cflags -DPIC" -echores $pic - - -if x86 ; then - -echocheck "ebx availability" -ebx_available=no -def_ebx_available='#define HAVE_EBX_AVAILABLE 0' -cat > $TMPC << EOF -int main(void) { - int x; - __asm__ volatile( - "xor %0, %0" - :"=b"(x) - // just adding ebx to clobber list seems unreliable with some - // compilers, e.g. Haiku's gcc 2.95 - ); - // and the above check does not work for OSX 64 bit... - __asm__ volatile("":::"%ebx"); - return 0; -} -EOF -cc_check && ebx_available=yes && def_ebx_available='#define HAVE_EBX_AVAILABLE 1' -echores $ebx_available - -fi #if x86 - ###################### # MAIN TESTS GO HERE # ###################### @@ -3061,7 +2832,6 @@ fi extra_ldflags="$extra_ldflags $_ld_pthread" libs_mplayer="$libs_mplayer $_ld_dl" -(netbsd || openbsd) && x86_32 && libs_mplayer="$libs_mplayer -li386" echocheck "joystick" @@ -3297,20 +3067,6 @@ $def_priority /* configurable options */ $def_stream_cache - -/* CPU stuff */ -$def_ebx_available - -$def_arch_x86 -$def_arch_x86_32 -$def_arch_x86_64 - -#define HAVE_MMX ARCH_X86 -#define HAVE_MMX2 ARCH_X86 -#define HAVE_SSE ARCH_X86 -#define HAVE_SSE2 ARCH_X86 -#define HAVE_SSSE3 ARCH_X86 - /* Blu-ray/DVD/VCD/CD */ #define DEFAULT_CDROM_DEVICE "$default_cdrom_device" #define DEFAULT_DVD_DEVICE "$default_dvd_device" @@ -3426,11 +3182,6 @@ $def_pthreads $def_atomic $def_sync -#define HAVE_INLINE_ASM 1 - -/* Use these registers in x86 inline asm. No proper detection yet. */ -#define HAVE_EBP_AVAILABLE 1 - #endif /* MPLAYER_CONFIG_H */ EOF diff --git a/old-makefile b/old-makefile index ed2eefe00f..8267b81322 100644 --- a/old-makefile +++ b/old-makefile @@ -179,7 +179,6 @@ SOURCES = audio/audio.c \ common/av_log.c \ common/av_opts.c \ common/codecs.c \ - common/cpudetect.c \ common/common.c \ common/msg.c \ common/playlist.c \ diff --git a/player/main.c b/player/main.c index baf12c7f3a..506f6fccd9 100644 --- a/player/main.c +++ b/player/main.c @@ -35,7 +35,6 @@ #include "common/av_log.h" #include "common/codecs.h" -#include "common/cpudetect.h" #include "common/encode.h" #include "options/m_config.h" #include "options/m_option.h" @@ -307,7 +306,6 @@ static int cfg_include(void *ctx, char *filename, int flags) struct MPContext *mp_create(void) { mp_time_init(); - GetCpuCaps(&gCpuCaps); struct MPContext *mpctx = talloc(NULL, MPContext); *mpctx = (struct MPContext){ diff --git a/video/filter/vf_divtc.c b/video/filter/vf_divtc.c index 869d7462d1..8e21df1f82 100644 --- a/video/filter/vf_divtc.c +++ b/video/filter/vf_divtc.c @@ -21,6 +21,7 @@ #include #include #include +#include #include "config.h" #include "common/msg.h" @@ -97,13 +98,15 @@ static unsigned int checksum_plane(unsigned char *p, unsigned char *z, } */ +#define FAST_64BIT (UINTPTR_MAX >= UINT64_MAX) + static unsigned int checksum_plane(unsigned char *p, unsigned char *z, int w, int h, int s, int zs, int arg) { unsigned int shift; uint32_t sum, t; unsigned char *e, *e2; -#if HAVE_FAST_64BIT +#if FAST_64BIT typedef uint64_t wsum_t; #else typedef uint32_t wsum_t; @@ -118,7 +121,7 @@ static unsigned int checksum_plane(unsigned char *p, unsigned char *z, for(wsum=0, e2=e-sizeof(wsum_t)+1; p>32^wsum)); #else t=be2me_32(wsum); diff --git a/waftools/detections/cpu.py b/waftools/detections/cpu.py deleted file mode 100644 index 3a8615f259..0000000000 --- a/waftools/detections/cpu.py +++ /dev/null @@ -1,28 +0,0 @@ -def x86(ctx): - ctx.define('ARCH_X86', 1) - ctx.define('ARCH_X86_32', 1) - -def x86_64(ctx): - ctx.define('ARCH_X86', 1) - ctx.define('ARCH_X86_64', 1) - ctx.define('HAVE_FAST_64BIT', 1) - -def ia64(ctx): - ctx.define('HAVE_FAST_64BIT', 1) - -def default(ctx): - pass - -def configure(ctx): - ctx.define('ARCH_X86', 0) - ctx.define('ARCH_X86_32', 0) - ctx.define('ARCH_X86_64', 0) - ctx.define('HAVE_FAST_64BIT', 0) - - ctx.define('HAVE_MMX', 'HAVE_ASM && ARCH_X86', quote=False) - ctx.define('HAVE_MMX2', 'HAVE_ASM && ARCH_X86', quote=False) - ctx.define('HAVE_SSE', 'HAVE_ASM && ARCH_X86', quote=False) - ctx.define('HAVE_SSE2', 'HAVE_ASM && ARCH_X86', quote=False) - ctx.define('HAVE_SSSE3', 'HAVE_ASM && ARCH_X86', quote=False) - - globals().get(ctx.env.DEST_CPU, default)(ctx) diff --git a/waftools/fragments/ebx.c b/waftools/fragments/ebx.c deleted file mode 100644 index b487939c56..0000000000 --- a/waftools/fragments/ebx.c +++ /dev/null @@ -1,12 +0,0 @@ -int main(void) { - int x; - __asm__ volatile( - "xor %0, %0" - :"=b"(x) - // just adding ebx to clobber list seems unreliable with some - // compilers, e.g. Haiku's gcc 2.95 - ); - // and the above check does not work for OSX 64 bit... - __asm__ volatile("":::"%ebx"); - return 0; -} diff --git a/wscript b/wscript index fc761030ab..4528cd3481 100644 --- a/wscript +++ b/wscript @@ -69,8 +69,9 @@ build_options = [ 'deps_any': [ 'os-win32', 'os-cygwin'], 'func': check_ctx_vars('WINDRES') }, { + # does nothing - left for backward and forward compatibility 'name': '--asm', - 'desc': 'inline assembly', + 'desc': 'inline assembly (currently without effect)', 'default': 'enable', 'func': check_true, } @@ -85,10 +86,6 @@ main_dependencies = [ 'name': 'noexecstack', 'desc': 'linker support for --nxcompat --no-seh --dynamicbase', 'func': check_cc(linkflags=['-Wl,--nxcompat', '-Wl,--no-seh', '-Wl,--dynamicbase']) - }, { - 'name': 'ebx-available', - 'desc': 'ebx availability', - 'func': check_cc(fragment=load_fragment('ebx.c')) } , { 'name': 'libm', 'desc': '-lm', @@ -798,7 +795,6 @@ def configure(ctx): ctx.load('waf_customizations') ctx.load('dependencies') ctx.load('detections.compiler') - ctx.load('detections.cpu') ctx.load('detections.devices') if ctx.env.DEST_OS in ('freebsd', 'openbsd'): diff --git a/wscript_build.py b/wscript_build.py index 0b02f518f9..62328c4bef 100644 --- a/wscript_build.py +++ b/wscript_build.py @@ -158,7 +158,6 @@ def build(ctx): ( "common/av_log.c" ), ( "common/av_opts.c" ), ( "common/codecs.c" ), - ( "common/cpudetect.c" ), ( "common/encode_lavc.c", "encoding" ), ( "common/common.c" ), ( "common/tags.c" ),