From patchwork Fri Jul 26 10:58:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brad Smith X-Patchwork-Id: 50749 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:a830:0:b0:482:c625:d099 with SMTP id z16csp387711vqo; Fri, 26 Jul 2024 03:58:51 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWz/kXORMWrbjFQ/fnad7c06+NMAPX/5Nb0+e4iC8X53LrW4+VIvFHJHp+ORpBsr2naakEHfamFhEcb9fUZTPkqd3rc/2CLKBi1Xw== X-Google-Smtp-Source: AGHT+IFSuxu2ZKoOXNN1O/zSGrxjOv46w3alSNQ0wnsawgPK6ZDMb/ofwPCycZ7XWfgbBB1BgdJy X-Received: by 2002:ac2:568d:0:b0:52c:dfa7:53a0 with SMTP id 2adb3069b0e04-52fd6083fbfmr4008455e87.48.1721991531260; Fri, 26 Jul 2024 03:58:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721991531; cv=none; d=google.com; s=arc-20160816; b=z6PMlRU3vpeS8asoiXKFedZF8KyM4bmFdaKfTWXpgoGZuFwT7rzQrS7XEsNTF4j4HU h9EJb32stNoy5v+nw7EWKLipd3Cw9zUFPdF059+LZkdpHLtpXAmV9XB8lO2IZOh50hP8 PBndGa8l6n3Aj1xTRi9ginOvdQtHeQRFRoqpnk5fTS9Dog1KLFdByVHmBgmS5jEjymib u1mcYmRAybyKS2SZoJf1i7q1JIJpPo+KtcaAC3Z0uY7IOOHNeamQRum0juNfj48DDTb3 IUxtIjvRqAXNjMl4dML/PZM/3GOdxmpEj3sDaIKWdr3VXt6U8d2hWgQCYbtMCBrqhR20 qPHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:content-disposition:mime-version:message-id:to :from:date:domainkey-signature:dkim-signature:delivered-to; bh=IBDJkWnONT0pqZ49A8XthCTx9hdUU0r9yFOwr/imwtA=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=gByanQ5fKaQYjrng8gRSicZumi9k0iEVa+ciNR63FlqGuSQcoy2CPIHYnyMwRSGMEd j7yJAIQMJAujiOTRfleEsZBGr9qnvdNEQP/VGPnBTq7U+fZrPfFtRiabDQkirsJ67LtB XB0/JQkpxEnw0OctyrIwM/JsCputfXJOdH7/bp/SWqWaU4G3EifHZM8K9tCpKco4MeFE +cY0wEh35aX1hNfX1BHEcNGvfvbyWcwrOsT/PPV86JojcB4caI7EOh90W30gCsANutDr sbT9aTDGG6LSxWT3C0bVtmrDt7+PrlrGFTgZM1FUxLFsqBLIujnUCgGahwb8XWPP1sV3 WAfw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@comstyle.com header.s=default header.b=NWbaDg59; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 2adb3069b0e04-52fd5c065ccsi1018668e87.541.2024.07.26.03.58.50; Fri, 26 Jul 2024 03:58:51 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@comstyle.com header.s=default header.b=NWbaDg59; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6366468D678; Fri, 26 Jul 2024 13:58:46 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.comstyle.com (speedy.comstyle.com [206.51.28.2]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 927DD68BD13 for ; Fri, 26 Jul 2024 13:58:39 +0300 (EEST) Received: from mail.comstyle.com (localhost [127.0.0.1]) by mail.comstyle.com (Postfix) with ESMTP id 4WVl9T5bq4z8PbP for ; Fri, 26 Jul 2024 06:58:37 -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=asufkXAMIgFFjoTffW/qAAfGUGu4dcWLkIoKShMueNA=; b=NWba Dg59a7GkMEdZmPA+EJMSWIwJA8k5cnWis7PD6tiNThTC77+WOip/dXX5VLVQN5kd QWTpcwxKdY0H3C+FjInJI3zb0HAIOA/feBDWigLvCyPEWRyip03fBihNMRhvcLE6 Q+7YckNA76xMrs6NTg5vI16CKXsP8Dr1EknPjRE= 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= XfMtbd0QE1lqKxZPbuuSSNd+RCuaX7+UnGkwwItSwKCZrpqR91vFlstJkwGxkhrV LMA3y9cEIJZ4c+zpS25dyu/eOA1RjTXaUL9Tbqwa8xakdYtuCklx5a22a0MSpbmU YR8PJym2ca90yDZN0NFEw72wVnYle5TGF7qlqOT75i0= Received: from humpty.home.comstyle.com (unknown [IPv6:2001:470:b050:3:5bfb:5b26:2fc1:adf8]) (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 4WVl9T36Wmz8PbN for ; Fri, 26 Jul 2024 06:58:37 -0400 (EDT) Date: Fri, 26 Jul 2024 06:58:34 -0400 From: Brad Smith To: ffmpeg-devel@ffmpeg.org Message-ID: MIME-Version: 1.0 Content-Disposition: inline Subject: [FFmpeg-devel] aarch64: Implement support for elf_aux_info(3) on FreeBSD and OpenBSD 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: yl4DVWaYWCkv aarch64: Implement support for elf_aux_info(3) on FreeBSD and OpenBSD FreeBSD 12.0+, OpenBSD -current and what will be OpenBSD 7.6 support elf_aux_info(3). Signed-off-by: Brad Smith --- configure | 2 ++ libavutil/aarch64/cpu.c | 23 ++++++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/configure b/configure index f6f5c29fea..e80b549582 100755 --- a/configure +++ b/configure @@ -2366,6 +2366,7 @@ SYSTEM_FUNCS=" clock_gettime closesocket CommandLineToArgvW + elf_aux_info fcntl getaddrinfo getauxval @@ -6565,6 +6566,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/auxv.h elf_aux_info check_func_headers sys/sysctl.h sysctlbyname check_func_headers windows.h GetModuleHandle diff --git a/libavutil/aarch64/cpu.c b/libavutil/aarch64/cpu.c index cfa9306663..05272b4db4 100644 --- a/libavutil/aarch64/cpu.c +++ b/libavutil/aarch64/cpu.c @@ -42,6 +42,27 @@ static int detect_flags(void) return flags; } +#elif (defined(__FreeBSD__) || defined(__OpenBSD__)) && HAVE_ELF_AUX_INFO +#include +#include + +static int detect_flags(void) +{ + int flags = 0; + + unsigned long hwcap = 0; + elf_aux_info(AT_HWCAP, &hwcap, sizeof hwcap); + unsigned long hwcap2 = 0; + elf_aux_info(AT_HWCAP2, &hwcap2, sizeof hwcap2); + + if (hwcap & HWCAP_ASIMDDP) + flags |= AV_CPU_FLAG_DOTPROD; + if (hwcap2 & HWCAP2_I8MM) + flags |= AV_CPU_FLAG_I8MM; + + return flags; +} + #elif defined(__APPLE__) && HAVE_SYSCTLBYNAME #include @@ -65,7 +86,7 @@ static int detect_flags(void) return flags; } -#elif defined(__OpenBSD__) +#elif defined(__OpenBSD__) && !HAVE_ELF_AUX_INFO #include #include #include