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 E62714666E for ; Tue, 30 May 2023 12:31:21 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1FBD468C22A; Tue, 30 May 2023 15:30:55 +0300 (EEST) Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3C8C368C1B8 for ; Tue, 30 May 2023 15:30:47 +0300 (EEST) Received: by mail-lf1-f53.google.com with SMTP id 2adb3069b0e04-4f4d6aee530so4623487e87.2 for ; Tue, 30 May 2023 05:30:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=martin-st.20221208.gappssmtp.com; s=20221208; t=1685449846; x=1688041846; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=O2+IbrXx/1Ou37DYeQWMEhuDCu+cgYvekvMOMqKtGoM=; b=ml2ohhJY21jv8WOhSxMs2exb0xuWlC1yZQaVHltx17EDGuqXVp3Db+m8m/NzulwMu1 yFZX9Lb1oLkK/274/ohs6TghyOtl6A7+DS1BoLHqttw0crinR8/0hpiKQu3n9DBm1kBL etIViYzUAldydkxpc47y1PcNwZSrJCiEqJ0VYnbPmZvwiGqb45g6ZOdTioSEv7qs3NGa b8YhC8WEZrs1F7jX6V9wnwxxhs2lu3Vqik1af27UY4r7Q4wb7xOCMCkKsDPOCDd5i8jI 8s17irQ1CJj2WImTJvKhwXo4axYm3d+QgZJd5J7p1ZnbRMccIWINLKXHw2ojTl4UFhjX CgLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685449846; x=1688041846; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=O2+IbrXx/1Ou37DYeQWMEhuDCu+cgYvekvMOMqKtGoM=; b=Xkz0YmmXIJwnLhZ903ZuqD4kNbe7jCNIL/Y02fd3q+t/vL2LRlt7tv8pW45oXOyBvU TURhjq3FccsQKnxlR1WWX19IAmPcbhPGhBR7795ON1F4W7UfxA69uumBVDD0C0Os8tUn mf5dnm6AVNuP2TFwjf/xFtOchFSCwuNAlwPb5IK3PcOvBNIw8jOnK94YOctemducBlLm tjsHvlhaYKU2W/Dq5k0aEkM93VvwybuLnnzYlVhxobcrk1zS1Ir2nKkMJ3Y37JL+cicO s6zdk2VjQz3qotaj9B8k5IAiW8ejWzf0/oKag1rvHCtoUs05HFv02PSE4RDlcyr/8dbK P5lw== X-Gm-Message-State: AC+VfDxV9BUN9ZpjniXosMH5Uoff8mkqM1UEfR5/Wsk0BXZ3rktoaecV GVbwfINA1dLRo/7BlJ0L9d20tve51GPTN/ExGP/lew== X-Google-Smtp-Source: ACHHUZ5dybOhi8N+CIy48bouHwE+rzMHGIy+itwVrsRnB9vNcEpgLBv7gh8xhQhO6KtFJolwnoGhQg== X-Received: by 2002:a2e:9f01:0:b0:2a7:98b2:923b with SMTP id u1-20020a2e9f01000000b002a798b2923bmr668675ljk.0.1685449846547; Tue, 30 May 2023 05:30:46 -0700 (PDT) Received: from localhost (dsl-tkubng21-58c01c-243.dhcp.inet.fi. [88.192.28.243]) by smtp.gmail.com with ESMTPSA id y26-20020a2e321a000000b002a77e01c3a1sm2836760ljy.22.2023.05.30.05.30.46 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 30 May 2023 05:30:46 -0700 (PDT) From: =?UTF-8?q?Martin=20Storsj=C3=B6?= To: ffmpeg-devel@ffmpeg.org Date: Tue, 30 May 2023 15:30:42 +0300 Message-Id: <20230530123043.52940-4-martin@martin.st> X-Mailer: git-send-email 2.37.1 (Apple Git-137.1) In-Reply-To: <20230530123043.52940-1-martin@martin.st> References: <20230530123043.52940-1-martin@martin.st> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 4/5] aarch64: Add Apple 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: For now, there's not much value in this since Clang don't support enabling the dotprod or i8mm features with either .arch_extension or .arch (it has to be enabled by the base arch flags passed to the compiler). But it may be supported in the future. --- configure | 2 ++ libavutil/aarch64/cpu.c | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/configure b/configure index b39de74de5..001287c169 100755 --- a/configure +++ b/configure @@ -2348,6 +2348,7 @@ SYSTEM_FUNCS=" strerror_r sysconf sysctl + sysctlbyname usleep UTGetOSTypeFromString VirtualAlloc @@ -6394,6 +6395,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 4563959ffd..ffb00f6dd2 100644 --- a/libavutil/aarch64/cpu.c +++ b/libavutil/aarch64/cpu.c @@ -72,6 +72,28 @@ static int detect_flags(void) return flags; } +#elif defined(__APPLE__) && HAVE_SYSCTLBYNAME +#include + +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".