Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC
Manage
Activity
Members
Labels
Plan
Issues
4k
Issue boards
Milestones
Code
Merge requests
450
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoLAN
VLC
Commits
d7b1f8e2
Commit
d7b1f8e2
authored
3 years ago
by
Rémi Denis-Courmont
Browse files
Options
Downloads
Patches
Plain Diff
linux: use getauxval() for RISC-V CPU detection
parent
e75a33e4
No related branches found
Branches containing commit
No related tags found
1 merge request
!1439
linux: use auxv for CPU detection
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/linux/cpu.c
+12
-64
12 additions, 64 deletions
src/linux/cpu.c
with
12 additions
and
64 deletions
src/linux/cpu.c
+
12
−
64
View file @
d7b1f8e2
...
...
@@ -82,71 +82,24 @@ unsigned vlc_CPU_raw(void)
return
flags
;
}
#else
#undef CPU_FLAGS
#if defined (__i386__) || defined (__x86_64__)
# define CPU_FLAGS "flags"
#elif defined (__riscv)
# include <vlc_strings.h>
# define CPU_FLAGS "isa"
# define HWCAP_RV(letter) (1LU << ((letter) - 'A'))
static
unsigned
vlc_CPU_
RV_isa_parse
(
const
char
*
isa
)
unsigned
vlc_CPU_
raw
(
void
)
{
unsigned
caps
=
0
;
int
c
;
if
(
vlc_ascii_tolower
((
unsigned
char
)
isa
[
0
])
!=
'r'
||
vlc_ascii_tolower
((
unsigned
char
)
isa
[
1
])
!=
'v'
)
return
0
;
isa
+=
2
;
if
(
strncmp
(
isa
,
"32"
,
2
)
==
0
||
strncmp
(
isa
,
"64"
,
2
)
==
0
)
isa
+=
2
;
else
if
(
strncmp
(
isa
,
"128"
,
3
)
==
0
)
isa
+=
3
;
else
return
0
;
while
((
c
=
vlc_ascii_tolower
((
unsigned
char
)
*
isa
))
!=
'\0'
)
{
size_t
extlen
=
1
;
switch
(
c
)
{
case
'_'
:
break
;
case
'z'
:
case
's'
:
case
'h'
:
case
'x'
:
extlen
=
1
+
strcspn
(
isa
+
1
,
"_"
);
break
;
default:
if
(((
unsigned
)(
c
-
'a'
))
>
'y'
)
return
0
;
while
(
isa
[
extlen
]
&&
((
unsigned
)(
isa
[
extlen
]
-
'0'
))
<
10
)
extlen
++
;
if
(
vlc_ascii_tolower
(
isa
[
extlen
])
==
'p'
)
{
extlen
++
;
while
(
isa
[
extlen
]
&&
((
unsigned
)(
isa
[
extlen
]
-
'0'
))
<
10
)
extlen
++
;
}
}
/* TODO: Zve extensions */
if
(
c
==
'v'
)
caps
|=
VLC_CPU_RV_V
;
const
unsigned
long
hwcap
=
getauxval
(
AT_HWCAP
);
unsigned
int
flags
=
0
;
isa
+=
extlen
;
}
if
(
hwcap
&
HWCAP_RV
(
'V'
))
flags
|=
VLC_CPU_RV_V
;
return
cap
s
;
return
flag
s
;
}
#else
#undef CPU_FLAGS
#if defined (__i386__) || defined (__x86_64__)
# define CPU_FLAGS "flags"
#endif
#ifdef CPU_FLAGS
...
...
@@ -173,10 +126,6 @@ unsigned vlc_CPU_raw(void)
if
(
*
p
!=
':'
)
continue
;
#if defined (__riscv)
p
+=
strspn
(
p
,
"
\t
"
);
core_caps
=
vlc_CPU_RV_isa_parse
(
p
);
#else
while
((
cap
=
strsep
(
&
p
,
" "
))
!=
NULL
)
{
#if defined (__i386__) || defined (__x86_64__)
...
...
@@ -208,7 +157,6 @@ unsigned vlc_CPU_raw(void)
core_caps
|=
VLC_CPU_FMA4
;
#endif
}
#endif
/* Take the intersection of capabilities of each processor */
all_caps
&=
core_caps
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment