avutil/ppc/cpu: Fix power8 linux detection
authorLauri Kasanen <cand@gmx.com>
Tue, 8 Jan 2019 08:59:22 +0000 (10:59 +0200)
committerLauri Kasanen <cand@gmx.com>
Tue, 5 Feb 2019 07:29:57 +0000 (09:29 +0200)
The existing code was in no released kernel that I can see. The corrected code
was added in 3.9.

libavutil/ppc/cpu.c

index 7bb7cd8..b022149 100644 (file)
@@ -93,13 +93,13 @@ int ff_get_cpu_flags_ppc(void)
                 if (buf[i + 1] & PPC_FEATURE_HAS_VSX)
                     ret |= AV_CPU_FLAG_VSX;
 #endif
-#ifdef PPC_FEATURE_ARCH_2_07
-                if (buf[i + 1] & PPC_FEATURE_HAS_POWER8)
-                    ret |= AV_CPU_FLAG_POWER8;
-#endif
                 if (ret & AV_CPU_FLAG_VSX)
                     av_assert0(ret & AV_CPU_FLAG_ALTIVEC);
-                goto out;
+            } else if (buf[i] == AT_HWCAP2) {
+#ifdef PPC_FEATURE2_ARCH_2_07
+                if (buf[i + 1] & PPC_FEATURE2_ARCH_2_07)
+                    ret |= AV_CPU_FLAG_POWER8;
+#endif
             }
         }
     }