20 #include <sys/sysctl.h> 21 #elif defined(__linux__) 22 #include <asm/cputable.h> 23 #include <linux/auxvec.h> 26 #elif defined(__OpenBSD__) 27 #include <sys/param.h> 28 #include <sys/sysctl.h> 29 #include <machine/cpu.h> 30 #elif defined(__AMIGAOS4__) 31 #include <exec/exec.h> 32 #include <interfaces/exec.h> 33 #include <proto/exec.h> 49 extern struct ExecIFace *IExec;
51 IExec->GetCPUInfoTags(GCIT_VectorUnit, &result, TAG_DONE);
52 if (result == VECTORTYPE_ALTIVEC)
55 #elif defined(__APPLE__) || defined(__OpenBSD__) 57 int sels[2] = {CTL_MACHDEP, CPU_ALTIVEC};
59 int sels[2] = {CTL_HW, HW_VECTORUNIT};
62 size_t len =
sizeof(has_vu);
65 err = sysctl(sels, 2, &has_vu, &len,
NULL, 0);
70 #elif defined(__linux__) 74 int fd = open(
"/proc/self/auxv", O_RDONLY);
75 unsigned long buf[64] = { 0 };
81 while ((count = read(fd, buf,
sizeof(buf))) > 0) {
82 for (i = 0; i < count /
sizeof(*buf); i += 2) {
83 if (buf[i] == AT_NULL)
85 if (buf[i] == AT_HWCAP) {
86 if (buf[i + 1] & PPC_FEATURE_HAS_ALTIVEC)
88 #ifdef PPC_FEATURE_HAS_VSX 89 if (buf[i + 1] & PPC_FEATURE_HAS_VSX)
92 #ifdef PPC_FEATURE_ARCH_2_07 93 if (buf[i + 1] & PPC_FEATURE_HAS_POWER8)
104 #elif CONFIG_RUNTIME_CPUDETECT 105 #define PVR_G4_7400 0x000C 106 #define PVR_G5_970 0x0039 107 #define PVR_G5_970FX 0x003C 108 #define PVR_G5_970MP 0x0044 109 #define PVR_G5_970GX 0x0045 110 #define PVR_POWER6 0x003E 111 #define PVR_POWER7 0x003F 112 #define PVR_POWER8 0x004B 113 #define PVR_CELL_PPU 0x0070 117 __asm__
volatile(
"mfspr %0, 287" :
"=r" (proc_ver));
119 if (proc_ver & 0x8000 ||
120 proc_ver == PVR_G4_7400 ||
121 proc_ver == PVR_G5_970 ||
122 proc_ver == PVR_G5_970FX ||
123 proc_ver == PVR_G5_970MP ||
124 proc_ver == PVR_G5_970GX ||
125 proc_ver == PVR_POWER6 ||
126 proc_ver == PVR_POWER7 ||
127 proc_ver == PVR_POWER8 ||
128 proc_ver == PVR_CELL_PPU)
130 if (proc_ver == PVR_POWER7 ||
131 proc_ver == PVR_POWER8)
133 if (proc_ver == PVR_POWER8)
#define AV_CPU_FLAG_ALTIVEC
standard
int ff_get_cpu_flags_ppc(void)
This function MAY rely on signal() or fork() in order to make sure AltiVec is present.
#define AV_CPU_FLAG_VSX
ISA 2.06.
#define AV_CPU_FLAG_POWER8
ISA 2.07.