summaryrefslogtreecommitdiffstats
path: root/cpudetect.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-07-29 17:20:57 +0200
committerwm4 <wm4@nowhere>2012-07-30 01:37:28 +0200
commit74df1d8e05aa226c7e82a6d84f43c873ee234561 (patch)
treec75185bd2d82e06564c03c41577475f425e44edf /cpudetect.h
parenta4bab723b30fe6190fb137b67bba521e55276cf6 (diff)
downloadmpv-74df1d8e05aa226c7e82a6d84f43c873ee234561.tar.bz2
mpv-74df1d8e05aa226c7e82a6d84f43c873ee234561.tar.xz
Remove compile time/runtime CPU detection, and drop some platforms
mplayer had three ways of enabling CPU specific assembler routines: a) Enable them at compile time; crash if the CPU can't handle it. b) Enable them at compile time, but let the configure script detect your CPU. Your binary will only crash if you try to run it on a different system that has less features than yours. This was the default, I think. c) Runtime detection. The implementation of b) and c) suck. a) is not really feasible (it sucks for users). Remove all code related to this, and use libav's CPU detection instead. Now the configure script will always enable CPU specific features, and disable them at runtime if libav reports them not as available. One implication is that now the compiler is always expected to handle SSE (etc.) inline assembly at runtime, unless it's explicitly disabled. Only checks for x86 CPU specific features are kept, the rest is either unused or barely used. Get rid of all the dump -mpcu, -march etc. flags. Trust the compiler to select decent settings. Get rid of support for the following operating systems: - BSD/OS (some ancient BSD fork) - QNX (don't care) - BeOS (dead, Haiku support is still welcome) - AIX (don't care) - HP-UX (don't care) - OS/2 (dead, actual support has been removed a while ago) Remove the configure code for detecting the endianness. Instead, use the standard header <endian.h>, which can be used if _GNU_SOURCE or _BSD_SOURCE is defined. (Maybe these changes should have been in a separate commit.) Since this is a quite violent code removal orgy, and I'm testing only on x86 32 bit Linux, expect regressions.
Diffstat (limited to 'cpudetect.h')
-rw-r--r--cpudetect.h24
1 files changed, 10 insertions, 14 deletions
diff --git a/cpudetect.h b/cpudetect.h
index 5ff6c5a78b..51fd7bc50d 100644
--- a/cpudetect.h
+++ b/cpudetect.h
@@ -19,6 +19,7 @@
#ifndef MPLAYER_CPUDETECT_H
#define MPLAYER_CPUDETECT_H
+#include <stdbool.h>
#include "config.h"
#define CPUTYPE_I386 3
@@ -30,21 +31,16 @@
typedef struct cpucaps_s {
int cpuType;
- int cpuModel;
int cpuStepping;
- int hasMMX;
- int hasMMX2;
- int has3DNow;
- int has3DNowExt;
- int hasSSE;
- int hasSSE2;
- int hasSSE3;
- int hasSSSE3;
- int hasSSE4a;
- int isX86;
- unsigned cl_size; /* size of cache line */
- int hasAltiVec;
- int hasTSC;
+ bool isX86;
+ bool hasMMX;
+ bool hasMMX2;
+ bool has3DNow;
+ bool has3DNowExt;
+ bool hasSSE;
+ bool hasSSE2;
+ bool hasSSE3;
+ bool hasSSSE3;
} CpuCaps;
extern CpuCaps gCpuCaps;