22 #include <sys/sysctl.h> 23 #elif defined(__linux__) 24 #include <asm/cputable.h> 25 #include <linux/auxvec.h> 30 #elif defined(__OpenBSD__) 31 #include <sys/param.h> 32 #include <sys/sysctl.h> 33 #include <machine/cpu.h> 34 #elif defined(__AMIGAOS4__) 35 #include <exec/exec.h> 36 #include <interfaces/exec.h> 37 #include <proto/exec.h> 53 extern struct ExecIFace *IExec;
55 IExec->GetCPUInfoTags(GCIT_VectorUnit, &result, TAG_DONE);
56 if (result == VECTORTYPE_ALTIVEC)
59 #elif defined(__APPLE__) || defined(__OpenBSD__) 61 int sels[2] = {CTL_MACHDEP, CPU_ALTIVEC};
63 int sels[2] = {CTL_HW, HW_VECTORUNIT};
66 size_t len =
sizeof(has_vu);
69 err = sysctl(sels, 2, &has_vu, &len,
NULL, 0);
74 #elif defined(__linux__) 78 int fd = open(
"/proc/self/auxv", O_RDONLY);
79 unsigned long buf[64] = { 0 };
85 while ((count = read(fd, buf,
sizeof(buf))) > 0) {
86 for (i = 0; i < count /
sizeof(*buf); i += 2) {
87 if (buf[i] == AT_NULL)
89 if (buf[i] == AT_HWCAP) {
90 if (buf[i + 1] & PPC_FEATURE_HAS_ALTIVEC)
92 #ifdef PPC_FEATURE_HAS_VSX 93 if (buf[i + 1] & PPC_FEATURE_HAS_VSX)
98 }
else if (buf[i] == AT_HWCAP2) {
99 #ifdef PPC_FEATURE2_ARCH_2_07 100 if (buf[i + 1] & PPC_FEATURE2_ARCH_2_07)
110 #elif CONFIG_RUNTIME_CPUDETECT && defined(__linux__) 111 #define PVR_G4_7400 0x000C 112 #define PVR_G5_970 0x0039 113 #define PVR_G5_970FX 0x003C 114 #define PVR_G5_970MP 0x0044 115 #define PVR_G5_970GX 0x0045 116 #define PVR_POWER6 0x003E 117 #define PVR_POWER7 0x003F 118 #define PVR_POWER8 0x004B 119 #define PVR_CELL_PPU 0x0070 123 __asm__ volatile(
"mfspr %0, 287" :
"=r" (proc_ver));
125 if (proc_ver & 0x8000 ||
126 proc_ver == PVR_G4_7400 ||
127 proc_ver == PVR_G5_970 ||
128 proc_ver == PVR_G5_970FX ||
129 proc_ver == PVR_G5_970MP ||
130 proc_ver == PVR_G5_970GX ||
131 proc_ver == PVR_POWER6 ||
132 proc_ver == PVR_POWER7 ||
133 proc_ver == PVR_POWER8 ||
134 proc_ver == PVR_CELL_PPU)
136 if (proc_ver == PVR_POWER7 ||
137 proc_ver == PVR_POWER8)
139 if (proc_ver == PVR_POWER8)
#define AV_CPU_FLAG_ALTIVEC
standard
#define av_assert0(cond)
assert() equivalent, that is always enabled.
size_t ff_get_cpu_max_align_ppc(void)
int ff_get_cpu_flags_ppc(void)
This function MAY rely on signal() or fork() in order to make sure AltiVec is present.
simple assert() macros that are a bit more flexible than ISO C assert().
#define AV_CPU_FLAG_VSX
ISA 2.06.
int av_get_cpu_flags(void)
Return the flags which specify extensions supported by the CPU.
#define flags(name, subs,...)
#define AV_CPU_FLAG_POWER8
ISA 2.07.
__asm__(".macro parse_r var r\n\t""\\var = -1\n\t"_IFC_REG(0) _IFC_REG(1) _IFC_REG(2) _IFC_REG(3) _IFC_REG(4) _IFC_REG(5) _IFC_REG(6) _IFC_REG(7) _IFC_REG(8) _IFC_REG(9) _IFC_REG(10) _IFC_REG(11) _IFC_REG(12) _IFC_REG(13) _IFC_REG(14) _IFC_REG(15) _IFC_REG(16) _IFC_REG(17) _IFC_REG(18) _IFC_REG(19) _IFC_REG(20) _IFC_REG(21) _IFC_REG(22) _IFC_REG(23) _IFC_REG(24) _IFC_REG(25) _IFC_REG(26) _IFC_REG(27) _IFC_REG(28) _IFC_REG(29) _IFC_REG(30) _IFC_REG(31)".iflt \\var\n\t"".error \"Unable to parse register name \\r\"\n\t"".endif\n\t"".endm")
and forward the result(frame or status change) to the corresponding input.If nothing is possible