]> code.delx.au - pulseaudio/blobdiff - src/pulsecore/cpu-arm.c
core: Initialize ARM NEON remapping code if available
[pulseaudio] / src / pulsecore / cpu-arm.c
index 05668f188c118fc9be022883ccd0e20c50128746..ad09c871b44c0193c07389b0a15b066ef36a6416 100644 (file)
@@ -80,10 +80,9 @@ static char *get_cpuinfo(void) {
 #endif /* defined (__arm__) && defined (__linux__) */
 
 void pa_cpu_get_arm_flags(pa_cpu_arm_flag_t *flags) {
-#if defined (__arm__)
-#if defined (__linux__)
+#if defined (__arm__) && defined (__linux__)
     char *cpuinfo, *line;
-    int arch;
+    int arch, part;
 
     /* We need to read the CPU flags from /proc/cpuinfo because there is no user
      * space support to get the CPU features. This only works on linux AFAIK. */
@@ -104,6 +103,7 @@ void pa_cpu_get_arm_flags(pa_cpu_arm_flag_t *flags) {
 
         pa_xfree(line);
     }
+
     /* get the CPU features */
     if ((line = get_cpuinfo_line(cpuinfo, "Features"))) {
         const char *state = NULL;
@@ -122,38 +122,50 @@ void pa_cpu_get_arm_flags(pa_cpu_arm_flag_t *flags) {
             pa_xfree(current);
         }
     }
+
+    /* get the CPU part number */
+    if ((line = get_cpuinfo_line(cpuinfo, "CPU part"))) {
+        part = strtoul(line, NULL, 0);
+        if (part == 0xc08)
+            *flags |= PA_CPU_ARM_CORTEX_A8;
+        pa_xfree(line);
+    }
     pa_xfree(cpuinfo);
 
-    pa_log_info("CPU flags: %s%s%s%s%s%s",
+    pa_log_info("CPU flags: %s%s%s%s%s%s%s",
           (*flags & PA_CPU_ARM_V6) ? "V6 " : "",
           (*flags & PA_CPU_ARM_V7) ? "V7 " : "",
           (*flags & PA_CPU_ARM_VFP) ? "VFP " : "",
           (*flags & PA_CPU_ARM_EDSP) ? "EDSP " : "",
           (*flags & PA_CPU_ARM_NEON) ? "NEON " : "",
-          (*flags & PA_CPU_ARM_VFPV3) ? "VFPV3 " : "");
-#endif
+          (*flags & PA_CPU_ARM_VFPV3) ? "VFPV3 " : "",
+          (*flags & PA_CPU_ARM_CORTEX_A8) ? "Cortex-A8 " : "");
 #endif
 }
 
-pa_bool_t pa_cpu_init_arm(pa_cpu_arm_flag_t *flags) {
+bool pa_cpu_init_arm(pa_cpu_arm_flag_t *flags) {
 #if defined (__arm__)
 #if defined (__linux__)
     pa_cpu_get_arm_flags(flags);
 
     if (*flags & PA_CPU_ARM_V6)
         pa_volume_func_init_arm(*flags);
+
 #ifdef HAVE_NEON
-    if (*flags & PA_CPU_ARM_NEON)
+    if (*flags & PA_CPU_ARM_NEON) {
         pa_convert_func_init_neon(*flags);
+        pa_mix_func_init_neon(*flags);
+        pa_remap_func_init_neon(*flags);
+    }
 #endif
 
-    return TRUE;
+    return true;
 
 #else /* defined (__linux__) */
     pa_log("Reading ARM CPU features not yet supported on this OS");
 #endif /* defined (__linux__) */
 
 #else /* defined (__arm__) */
-    return FALSE;
+    return false;
 #endif /* defined (__arm__) */
 }