summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>2008-01-19 19:27:39 +0000
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>2008-01-19 19:27:39 +0000
commitb8659d94b76c9b90c0aff3c5c01bfd2be6324e93 (patch)
treed14c7e46bec92ed97818dbdfc90d501ea6983af3 /libavcodec
parenta33b2c7e396ad36b9f47dcf9cec4b20d6a852653 (diff)
Add mfspr-based AltiVec detection code.
Currently not enabled in FFmpeg, because it crashes if the OS does not emulate mfspr. Originally committed as revision 11569 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/ppc/check_altivec.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/libavcodec/ppc/check_altivec.c b/libavcodec/ppc/check_altivec.c
index b3778cab31..cf55b9a1d5 100644
--- a/libavcodec/ppc/check_altivec.c
+++ b/libavcodec/ppc/check_altivec.c
@@ -54,6 +54,18 @@ int has_altivec(void)
if (err == 0) return (has_vu != 0);
return 0;
+#elif defined(RUNTIME_CPUDETECT)
+ int proc_ver;
+ // support of mfspr PVR emulation added in Linux 2.6.17
+ asm volatile("mfspr %0, 287" : "=r" (proc_ver));
+ proc_ver >>= 16;
+ if (proc_ver & 0x8000 ||
+ proc_ver == 0x000c ||
+ proc_ver == 0x0039 || proc_ver == 0x003c ||
+ proc_ver == 0x0044 || proc_ver == 0x0045 ||
+ proc_ver == 0x0070)
+ return 1;
+ return 0;
#else
// since we were compiled for altivec, just assume we have it
// until someone comes up with a proper way (not involving signal hacks).