From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 923D546F7E for ; Sun, 23 Jun 2024 02:52:59 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 45E6C68D470; Sun, 23 Jun 2024 05:52:57 +0300 (EEST) Received: from mail.comstyle.com (speedy.comstyle.com [206.51.28.2]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 41BAB68D232 for ; Sun, 23 Jun 2024 05:52:50 +0300 (EEST) Received: from mail.comstyle.com (localhost [127.0.0.1]) by mail.comstyle.com (Postfix) with ESMTP id 4W6Fy84hJTz8PbP for ; Sat, 22 Jun 2024 22:52:48 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=comstyle.com; h=date :from:to:subject:message-id:mime-version:content-type; s= default; bh=HEhFGtfBz9ETC+0XyUksnDtGDoSW/UhMQg546aBetR0=; b=MIJ1 jqmhyIhsmAkISoigA4MuSrgHHEG1xopbvfkyP/N8bUC2rcyEZtzydFFK1RZ1leO0 InvQwd+7hs6YionxkuWqj3HpkhoSjeRgCMgcnCvMdP2x627re/pNynZGPuMMsjky 8Fq+lWvVhk9wxc0DpbLnDZrLUwyVDTlp18NCn4w= DomainKey-Signature: a=rsa-sha1; c=nofws; d=comstyle.com; h=date:from:to :subject:message-id:mime-version:content-type; q=dns; s=default; b= qofRA326lThFI+zu6k0/8ZFrAHg3sG9cP0F4fqPGTcbg4U1Zg4+YNTrXiH6R5sps EGp2ZUQnYrPO61yoe3Pj9qGW4d97XUFteYrnho4cZXhvtVcPs63ncO5vukb06FVQ ZoVClqvK26y0yp7XG1QgPA2U6B2P607xY4LSOBpRCPE= Received: from humpty.home.comstyle.com (unknown [IPv6:2001:470:b050:3:9ee5:c2f5:b033:d60f]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA512) (No client certificate requested) (Authenticated sender: brad) by mail.comstyle.com (Postfix) with ESMTPSA id 4W6Fy82cNMz8PbN for ; Sat, 22 Jun 2024 22:52:48 -0400 (EDT) Date: Sat, 22 Jun 2024 22:52:47 -0400 From: Brad Smith To: ffmpeg-devel@ffmpeg.org Message-ID: MIME-Version: 1.0 Content-Disposition: inline Subject: [FFmpeg-devel] [PATCH] aarch64: Add OpenBSD runtime detection of dotprod and i8mm using sysctl X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: [PATCH] aarch64: Add OpenBSD runtime detection of dotprod and i8mm using sysctl Signed-off-by: Brad Smith --- libavutil/aarch64/cpu.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/libavutil/aarch64/cpu.c b/libavutil/aarch64/cpu.c index 196bdaf6b0..40fcc8d1ff 100644 --- a/libavutil/aarch64/cpu.c +++ b/libavutil/aarch64/cpu.c @@ -65,6 +65,41 @@ static int detect_flags(void) return flags; } +#elif defined(__OpenBSD__) +#include +#include +#include +#include + +static int detect_flags(void) +{ + int flags = 0; + int mib[2]; + uint64_t isar0; + uint64_t isar1; + size_t len; + + mib[0] = CTL_MACHDEP; + mib[1] = CPU_ID_AA64ISAR0; + len = sizeof(isar0); + if (sysctl(mib, 2, &isar0, &len, NULL, 0) != -1) { + if (ID_AA64ISAR0_DP(isar0) >= ID_AA64ISAR0_DP_IMPL) + flags |= AV_CPU_FLAG_DOTPROD; + } + + mib[0] = CTL_MACHDEP; + mib[1] = CPU_ID_AA64ISAR1; + len = sizeof(isar1); + if (sysctl(mib, 2, &isar1, &len, NULL, 0) != -1) { +#ifdef ID_AA64ISAR1_I8MM_IMPL + if (ID_AA64ISAR1_I8MM(isar1) >= ID_AA64ISAR1_I8MM_IMPL) + flags |= AV_CPU_FLAG_I8MM; +#endif + } + + return flags; +} + #elif defined(_WIN32) #include -- 2.45.2 _______________________________________________ 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".