"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "libavutil/ppc/cpu.c" between
libav-11.7.tar.gz and libav-11.8.tar.gz

About: libav provides cross-platform tools ("avconv") and libraries to convert, manipulate and stream a wide range of multimedia (audio and video) formats and protocols.

cpu.c  (libav-11.7):cpu.c  (libav-11.8)
skipping to change at line 21 skipping to change at line 21
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with Libav; if not, write to the Free Software * License along with Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#ifdef __APPLE__ #ifdef __APPLE__
#include <sys/sysctl.h> #include <sys/sysctl.h>
#elif defined(__linux__)
#include <asm/cputable.h>
#include <linux/auxvec.h>
#include <fcntl.h>
#include <unistd.h>
#elif defined(__OpenBSD__) #elif defined(__OpenBSD__)
#include <sys/param.h> #include <sys/param.h>
#include <sys/sysctl.h> #include <sys/sysctl.h>
#include <machine/cpu.h> #include <machine/cpu.h>
#elif defined(__AMIGAOS4__) #elif defined(__AMIGAOS4__)
#include <exec/exec.h> #include <exec/exec.h>
#include <interfaces/exec.h> #include <interfaces/exec.h>
#include <proto/exec.h> #include <proto/exec.h>
#endif /* __APPLE__ */ #endif /* __APPLE__ */
skipping to change at line 65 skipping to change at line 70
#endif #endif
int has_vu = 0; int has_vu = 0;
size_t len = sizeof(has_vu); size_t len = sizeof(has_vu);
int err; int err;
err = sysctl(sels, 2, &has_vu, &len, NULL, 0); err = sysctl(sels, 2, &has_vu, &len, NULL, 0);
if (err == 0) if (err == 0)
return has_vu ? AV_CPU_FLAG_ALTIVEC : 0; return has_vu ? AV_CPU_FLAG_ALTIVEC : 0;
return 0; return 0;
#elif defined(__linux__)
// The linux kernel could have the altivec support disabled
// even if the cpu has it.
int i, ret = 0;
int fd = open("/proc/self/auxv", O_RDONLY);
unsigned long buf[64] = { 0 };
ssize_t count;
if (fd < 0)
return 0;
while ((count = read(fd, buf, sizeof(buf))) > 0) {
for (i = 0; i < count / sizeof(*buf); i += 2) {
if (buf[i] == AT_NULL)
goto out;
if (buf[i] == AT_HWCAP) {
if (buf[i + 1] & PPC_FEATURE_HAS_ALTIVEC)
ret = AV_CPU_FLAG_ALTIVEC;
goto out;
}
}
}
out:
close(fd);
return ret;
#elif CONFIG_RUNTIME_CPUDETECT #elif CONFIG_RUNTIME_CPUDETECT
int proc_ver; int proc_ver;
// Support of mfspr PVR emulation added in Linux 2.6.17. // Support of mfspr PVR emulation added in Linux 2.6.17.
__asm__ volatile("mfspr %0, 287" : "=r" (proc_ver)); __asm__ volatile("mfspr %0, 287" : "=r" (proc_ver));
proc_ver >>= 16; proc_ver >>= 16;
if (proc_ver & 0x8000 || if (proc_ver & 0x8000 ||
proc_ver == 0x000c || proc_ver == 0x000c ||
proc_ver == 0x0039 || proc_ver == 0x003c || proc_ver == 0x0039 || proc_ver == 0x003c ||
proc_ver == 0x0044 || proc_ver == 0x0045 || proc_ver == 0x0044 || proc_ver == 0x0045 ||
proc_ver == 0x0070) proc_ver == 0x0070)
 End of changes. 2 change blocks. 
0 lines changed or deleted 31 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS