Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
X
x264
Manage
Activity
Members
Labels
Plan
Issues
26
Issue boards
Milestones
Wiki
Code
Merge requests
17
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoLAN
x264
Commits
570f6c70
Commit
570f6c70
authored
1 month ago
by
Martin Storsjö
Browse files
Options
Downloads
Patches
Plain Diff
aarch64: Add runtime detection of extensions on Windows and macOS
parent
0e48d072
No related branches found
Branches containing commit
No related tags found
1 merge request
!169
aarch64: Add support for the dotprod and i8mm extensions
Pipeline
#575835
passed with stages
Stage:
Stage:
Stage:
in 9 minutes and 30 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
common/cpu.c
+56
-1
56 additions, 1 deletion
common/cpu.c
with
56 additions
and
1 deletion
common/cpu.c
+
56
−
1
View file @
570f6c70
...
...
@@ -484,6 +484,60 @@ static uint32_t detect_flags( void )
return
flags
;
}
#elif defined(__APPLE__)
#include
<sys/sysctl.h>
static
int
have_feature
(
const
char
*
feature
)
{
int
supported
=
0
;
size_t
size
=
sizeof
(
supported
);
if
(
sysctlbyname
(
feature
,
&
supported
,
&
size
,
NULL
,
0
)
)
return
0
;
return
supported
;
}
static
uint32_t
detect_flags
(
void
)
{
uint32_t
flags
=
0
;
if
(
have_feature
(
"hw.optional.arm.FEAT_DotProd"
)
)
flags
|=
X264_CPU_DOTPROD
;
if
(
have_feature
(
"hw.optional.arm.FEAT_I8MM"
)
)
flags
|=
X264_CPU_I8MM
;
/* No SVE and SVE2 feature detection available on Apple platforms. */
return
flags
;
}
#elif defined(_WIN32)
#include
<windows.h>
static
uint32_t
detect_flags
(
void
)
{
uint32_t
flags
=
0
;
#ifdef PF_ARM_V82_DP_INSTRUCTIONS_AVAILABLE
if
(
IsProcessorFeaturePresent
(
PF_ARM_V82_DP_INSTRUCTIONS_AVAILABLE
)
)
flags
|=
X264_CPU_DOTPROD
;
#endif
#ifdef PF_ARM_SVE_INSTRUCTIONS_AVAILABLE
if
(
IsProcessorFeaturePresent
(
PF_ARM_SVE_INSTRUCTIONS_AVAILABLE
)
)
flags
|=
X264_CPU_SVE
;
#endif
#ifdef PF_ARM_SVE2_INSTRUCTIONS_AVAILABLE
if
(
IsProcessorFeaturePresent
(
PF_ARM_SVE2_INSTRUCTIONS_AVAILABLE
)
)
flags
|=
X264_CPU_SVE2
;
#endif
#ifdef PF_ARM_SVE_I8MM_INSTRUCTIONS_AVAILABLE
/* There's no PF_* flag that indicates whether plain I8MM is available
* or not. But if SVE_I8MM is available, that also implies that
* regular I8MM is available. */
if
(
IsProcessorFeaturePresent
(
PF_ARM_SVE_I8MM_INSTRUCTIONS_AVAILABLE
)
)
flags
|=
X264_CPU_I8MM
;
#endif
return
flags
;
}
#endif
uint32_t
x264_cpu_detect
(
void
)
...
...
@@ -509,7 +563,8 @@ uint32_t x264_cpu_detect( void )
#endif
// Where possible, try to do runtime detection as well.
#if defined(__linux__) || HAVE_ELF_AUX_INFO
#if defined(__linux__) || HAVE_ELF_AUX_INFO || \
defined(__APPLE__) || defined(_WIN32)
flags
|=
detect_flags
();
#endif
...
...
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