libavutil/ppc: Make use of getauxval() and elf_aux_info() on ppc Modern Linux has getauxval() and FreeBSD/OpenBSD ppc have elf_aux_info().
Signed-off-by: Brad Smith <b...@comstyle.com> --- libavutil/ppc/cpu.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/libavutil/ppc/cpu.c b/libavutil/ppc/cpu.c index 2b13cda662..6dc1961e7a 100644 --- a/libavutil/ppc/cpu.c +++ b/libavutil/ppc/cpu.c @@ -20,6 +20,8 @@ #ifdef __APPLE__ #include <sys/sysctl.h> +#elif HAVE_GETAUXVAL || HAVE_ELF_AUX_INFO +#include <sys/auxv.h> #elif defined(__linux__) #include <asm/cputable.h> #include <linux/auxvec.h> @@ -56,6 +58,20 @@ int ff_get_cpu_flags_ppc(void) if (result == VECTORTYPE_ALTIVEC) return AV_CPU_FLAG_ALTIVEC; return 0; +#elif HAVE_GETAUXVAL || HAVE_ELF_AUX_INFO + int flags = 0; + + unsigned long hwcap = ff_getauxval(AT_HWCAP); + unsigned long hwcap2 = ff_getauxval(AT_HWCAP2); + + if (hwcap & PPC_FEATURE_HAS_ALTIVEC) + flags |= AV_CPU_FLAG_ALTIVEC; + if (hwcap & PPC_FEATURE_HAS_VSX) + flags |= AV_CPU_FLAG_VSX; + if (hwcap2 & PPC_FEATURE2_ARCH_2_07) + flags |= AV_CPU_FLAG_POWER8; + + return flags; #elif defined(__APPLE__) || defined(__NetBSD__) || defined(__OpenBSD__) #if defined(__NetBSD__) || defined(__OpenBSD__) int sels[2] = {CTL_MACHDEP, CPU_ALTIVEC}; -- 2.46.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".