From: "Martin Storsjö" <martin@martin.st>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH 4/4] aarch64: Add Apple runtime detection of dotprod and i8mm using sysctl
Date: Fri, 26 May 2023 11:03:15 +0300
Message-ID: <20230526080315.83424-4-martin@martin.st> (raw)
In-Reply-To: <20230526080315.83424-1-martin@martin.st>
---
configure | 2 ++
libavutil/aarch64/cpu.c | 22 ++++++++++++++++++++++
2 files changed, 24 insertions(+)
diff --git a/configure b/configure
index b5357b8d27..45bdc16c7d 100755
--- a/configure
+++ b/configure
@@ -2346,6 +2346,7 @@ SYSTEM_FUNCS="
strerror_r
sysconf
sysctl
+ sysctlbyname
usleep
UTGetOSTypeFromString
VirtualAlloc
@@ -6384,6 +6385,7 @@ check_func_headers mach/mach_time.h mach_absolute_time
check_func_headers stdlib.h getenv
check_func_headers sys/stat.h lstat
check_func_headers sys/auxv.h getauxval
+check_func_headers sys/sysctl.h sysctlbyname
check_func_headers windows.h GetModuleHandle
check_func_headers windows.h GetProcessAffinityMask
diff --git a/libavutil/aarch64/cpu.c b/libavutil/aarch64/cpu.c
index 34c838c2f5..f35e4356df 100644
--- a/libavutil/aarch64/cpu.c
+++ b/libavutil/aarch64/cpu.c
@@ -47,6 +47,28 @@ static int detect_flags(void)
return flags;
}
+#elif defined(__APPLE__) && HAVE_SYSCTLBYNAME
+#include <sys/sysctl.h>
+
+static int detect_flags(void)
+{
+ uint32_t value = 0;
+ size_t size;
+ int flags = 0;
+
+ size = sizeof(value);
+ if (!sysctlbyname("hw.optional.arm.FEAT_DotProd", &value, &size, NULL, 0)) {
+ if (value)
+ flags |= AV_CPU_FLAG_DOTPROD;
+ }
+ size = sizeof(value);
+ if (!sysctlbyname("hw.optional.arm.FEAT_I8MM", &value, &size, NULL, 0)) {
+ if (value)
+ flags |= AV_CPU_FLAG_I8MM;
+ }
+ return flags;
+}
+
#else
static int detect_flags(void)
--
2.37.1 (Apple Git-137.1)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2023-05-26 8:04 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-26 8:03 [FFmpeg-devel] [PATCH 1/4] configure: aarch64: Support assembling the dotprod and i8mm arch extensions Martin Storsjö
2023-05-26 8:03 ` [FFmpeg-devel] [PATCH 2/4] aarch64: Add cpu flags for the dotprod and i8mm extensions Martin Storsjö
2023-05-26 8:03 ` [FFmpeg-devel] [PATCH 3/4] aarch64: Add linux runtime cpu feature detection using getauxval(AT_HWCAP) Martin Storsjö
2023-05-27 9:04 ` Rémi Denis-Courmont
2023-05-27 20:35 ` Martin Storsjö
2023-05-28 5:58 ` Rémi Denis-Courmont
2023-05-26 8:03 ` Martin Storsjö [this message]
2023-05-27 8:44 ` [FFmpeg-devel] [PATCH 1/4] configure: aarch64: Support assembling the dotprod and i8mm arch extensions Rémi Denis-Courmont
2023-05-27 21:34 ` Martin Storsjö
2023-05-28 5:50 ` Rémi Denis-Courmont
2023-05-30 12:25 ` Martin Storsjö
2023-05-31 16:29 ` Rémi Denis-Courmont
2023-06-01 11:04 ` Martin Storsjö
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230526080315.83424-4-martin@martin.st \
--to=martin@martin.st \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git