浏览代码

Android: remove old cpu-feature code, and fix build (add HAVE_GETAUXV… (#14460)

Sylvain Becker 1 月之前
父节点
当前提交
4cc9153df2
共有 1 个文件被更改,包括 2 次插入14 次删除
  1. 2 14
      src/cpuinfo/SDL_cpuinfo.c

+ 2 - 14
src/cpuinfo/SDL_cpuinfo.c

@@ -76,7 +76,7 @@
 #include <sys/param.h>
 #include <sys/param.h>
 #endif
 #endif
 
 
-#if defined(HAVE_GETAUXVAL) || defined(HAVE_ELF_AUX_INFO)
+#if defined(HAVE_GETAUXVAL) || defined(HAVE_ELF_AUX_INFO) || defined(SDL_PLATFORM_ANDROID)
 #include <sys/auxv.h>
 #include <sys/auxv.h>
 #endif
 #endif
 
 
@@ -488,22 +488,10 @@ static int CPU_haveNEON(void)
         return 0;
         return 0;
     }
     }
     return (hasneon & HWCAP_NEON) == HWCAP_NEON;
     return (hasneon & HWCAP_NEON) == HWCAP_NEON;
-#elif (defined(SDL_PLATFORM_LINUX) || defined(SDL_PLATFORM_ANDROID)) && defined(HAVE_GETAUXVAL)
+#elif (defined(SDL_PLATFORM_LINUX) && defined(HAVE_GETAUXVAL)) || defined(SDL_PLATFORM_ANDROID)
     return (getauxval(AT_HWCAP) & HWCAP_NEON) == HWCAP_NEON;
     return (getauxval(AT_HWCAP) & HWCAP_NEON) == HWCAP_NEON;
 #elif defined(SDL_PLATFORM_LINUX)
 #elif defined(SDL_PLATFORM_LINUX)
     return readProcAuxvForNeon();
     return readProcAuxvForNeon();
-#elif defined(SDL_PLATFORM_ANDROID)
-    // Use NDK cpufeatures to read either /proc/self/auxv or /proc/cpuinfo
-    {
-        AndroidCpuFamily cpu_family = android_getCpuFamily();
-        if (cpu_family == ANDROID_CPU_FAMILY_ARM) {
-            uint64_t cpu_features = android_getCpuFeatures();
-            if (cpu_features & ANDROID_CPU_ARM_FEATURE_NEON) {
-                return 1;
-            }
-        }
-        return 0;
-    }
 #elif defined(SDL_PLATFORM_RISCOS)
 #elif defined(SDL_PLATFORM_RISCOS)
     // Use the VFPSupport_Features SWI to access the MVFR registers
     // Use the VFPSupport_Features SWI to access the MVFR registers
     {
     {