Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
baa94563
Commit
baa94563
authored
Apr 03, 2015
by
Luca Barbato
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ppc: linux: Check altivec using the auxv
Should prevent trying to use altivec when it is disabled by the kernel.
parent
7014b659
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
0 deletions
+31
-0
cpu.c
libavutil/ppc/cpu.c
+31
-0
No files found.
libavutil/ppc/cpu.c
View file @
baa94563
...
...
@@ -18,6 +18,11 @@
#ifdef __APPLE__
#include <sys/sysctl.h>
#elif defined(__linux__)
#include <asm/cputable.h>
#include <linux/auxvec.h>
#include <fcntl.h>
#include <unistd.h>
#elif defined(__OpenBSD__)
#include <sys/param.h>
#include <sys/sysctl.h>
...
...
@@ -62,6 +67,32 @@ int ff_get_cpu_flags_ppc(void)
if
(
err
==
0
)
return
has_vu
?
AV_CPU_FLAG_ALTIVEC
:
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
int
proc_ver
;
// Support of mfspr PVR emulation added in Linux 2.6.17.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment