diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-05-31 23:47:29 +0300 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-05-31 23:47:50 +0300 |
commit | 58a420487337d50f19f73eeed0f2b15d2d727be4 (patch) | |
tree | 4d284f00a40460c183949291c2bbfd460f286d5d /libavutil | |
parent | 902ce2a6c4364fd27ae3f1db78cd275caf79c006 (diff) | |
parent | 7d07ee5a9bd170a06d26fd967cf8de5d3b1ce331 (diff) |
Merge commit '7d07ee5a9bd170a06d26fd967cf8de5d3b1ce331'
* commit '7d07ee5a9bd170a06d26fd967cf8de5d3b1ce331':
ppc: cpu: Add support for VSX and POWER8 extensions
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil')
-rw-r--r-- | libavutil/cpu.h | 2 | ||||
-rw-r--r-- | libavutil/ppc/cpu.c | 20 | ||||
-rw-r--r-- | libavutil/ppc/cpu.h | 2 |
3 files changed, 21 insertions, 3 deletions
diff --git a/libavutil/cpu.h b/libavutil/cpu.h index 10b7136a04..471f7866f3 100644 --- a/libavutil/cpu.h +++ b/libavutil/cpu.h @@ -57,6 +57,8 @@ #define AV_CPU_FLAG_BMI2 0x40000 ///< Bit Manipulation Instruction Set 2 #define AV_CPU_FLAG_ALTIVEC 0x0001 ///< standard +#define AV_CPU_FLAG_VSX 0x0002 ///< ISA 2.06 +#define AV_CPU_FLAG_POWER8 0x0004 ///< ISA 2.07 #define AV_CPU_FLAG_ARMV5TE (1 << 0) #define AV_CPU_FLAG_ARMV6 (1 << 1) diff --git a/libavutil/ppc/cpu.c b/libavutil/ppc/cpu.c index 77229630d3..49646b0aa4 100644 --- a/libavutil/ppc/cpu.c +++ b/libavutil/ppc/cpu.c @@ -88,6 +88,14 @@ int ff_get_cpu_flags_ppc(void) if (buf[i] == AT_HWCAP) { if (buf[i + 1] & PPC_FEATURE_HAS_ALTIVEC) ret = AV_CPU_FLAG_ALTIVEC; +#ifdef PPC_FEATURE_HAS_VSX + if (buf[i + 1] & PPC_FEATURE_HAS_VSX) + ret |= AV_CPU_FLAG_VSX; +#endif +#ifdef PPC_FEATURE_ARCH_2_07 + if (buf[i + 1] & PPC_FEATURE_HAS_POWER8) + ret |= AV_CPU_FLAG_POWER8; +#endif goto out; } } @@ -106,7 +114,7 @@ out: #define PVR_POWER7 0x003F #define PVR_POWER8 0x004B #define PVR_CELL_PPU 0x0070 - + int ret = 0; int proc_ver; // Support of mfspr PVR emulation added in Linux 2.6.17. __asm__ volatile("mfspr %0, 287" : "=r" (proc_ver)); @@ -121,8 +129,14 @@ out: proc_ver == PVR_POWER7 || proc_ver == PVR_POWER8 || proc_ver == PVR_CELL_PPU) - return AV_CPU_FLAG_ALTIVEC; - return 0; + ret = AV_CPU_FLAG_ALTIVEC; + if (proc_ver == PVR_POWER7 || + proc_ver == PVR_POWER8) + ret |= AV_CPU_FLAG_VSX; + if (proc_ver == PVR_POWER8) + ret |= AV_CPU_FLAG_POWER8; + + return ret; #else // Since we were compiled for AltiVec, just assume we have it // until someone comes up with a proper way (not involving signal hacks). diff --git a/libavutil/ppc/cpu.h b/libavutil/ppc/cpu.h index 0a212f33cb..0744157c87 100644 --- a/libavutil/ppc/cpu.h +++ b/libavutil/ppc/cpu.h @@ -24,5 +24,7 @@ #include "libavutil/cpu_internal.h" #define PPC_ALTIVEC(flags) CPUEXT(flags, ALTIVEC) +#define PPC_VSX(flags) CPUEXT(flags, VSX) +#define PPC_POWER8(flags) CPUEXT(flags, POWER8) #endif /* AVUTIL_PPC_CPU_H */ |