PR #24156 opened by brad
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24156
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24156.patch

The getauxval() and auxv methods cover the last 23+ years of Linux.


>From 238dab77da31512ca369fdd2e4ff6c0a4f230cae Mon Sep 17 00:00:00 2001
From: Brad Smith <[email protected]>
Date: Thu, 28 May 2026 01:33:30 -0400
Subject: [PATCH] libavutil/arm: Remove /proc/cpuinfo ARM CPU detection code
 for Linux

The getauxval() and auxv methods cover the last 23+ years of Linux.
---
 libavutil/arm/cpu.c | 35 +----------------------------------
 1 file changed, 1 insertion(+), 34 deletions(-)

diff --git a/libavutil/arm/cpu.c b/libavutil/arm/cpu.c
index 2f6d558380..7c70de0824 100644
--- a/libavutil/arm/cpu.c
+++ b/libavutil/arm/cpu.c
@@ -100,38 +100,6 @@ static int get_hwcap(uint32_t *hwcap)
     fclose(f);
     return err;
 }
-
-static int get_cpuinfo(uint32_t *hwcap)
-{
-    FILE *f = fopen("/proc/cpuinfo", "r");
-    char buf[200];
-
-    if (!f)
-        return -1;
-
-    *hwcap = 0;
-    while (fgets(buf, sizeof(buf), f)) {
-        if (av_strstart(buf, "Features", NULL)) {
-            if (strstr(buf, " edsp "))
-                *hwcap |= HWCAP_ARM_EDSP;
-            if (strstr(buf, " tls "))
-                *hwcap |= HWCAP_ARM_TLS;
-            if (strstr(buf, " thumbee "))
-                *hwcap |= HWCAP_ARM_THUMBEE;
-            if (strstr(buf, " vfp "))
-                *hwcap |= HWCAP_ARM_VFP;
-            if (strstr(buf, " vfpv3 "))
-                *hwcap |= HWCAP_ARM_VFPv3;
-            if (strstr(buf, " neon ") || strstr(buf, " asimd "))
-                *hwcap |= HWCAP_ARM_NEON;
-            if (strstr(buf, " fp ")) // Listed on 64 bit ARMv8 kernels
-                *hwcap |= HWCAP_ARM_VFP | HWCAP_ARM_VFPv3;
-            break;
-        }
-    }
-    fclose(f);
-    return 0;
-}
 #endif
 
 int ff_get_cpu_flags_arm(void)
@@ -142,9 +110,8 @@ int ff_get_cpu_flags_arm(void)
     if (get_auxval(&hwcap) < 0)
 #if defined __linux__ || defined __ANDROID__
         if (get_hwcap(&hwcap) < 0)
-            if (get_cpuinfo(&hwcap) < 0)
 #endif
-                return flags;
+            return flags;
 
 #define check_cap(cap, flag) do {               \
         if (hwcap & HWCAP_ARM_ ## cap)          \
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to