From ee040a7fc23b9dbd8db6c4291e43c653d61325fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Fri, 12 Feb 2021 12:27:03 +0200 Subject: [PATCH] arm/aarch64: Use mach_absolute_time as timer on apple platforms MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is much less precise than the cycle counter register, but the cycle counter register is not available on apple platforms (and on linux, it requires a kernel module for allowing user mode access). Signed-off-by: Martin Storsjö --- libavutil/aarch64/timer.h | 8 +++++++- libavutil/arm/timer.h | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/libavutil/aarch64/timer.h b/libavutil/aarch64/timer.h index b570039416..8b28fd354c 100644 --- a/libavutil/aarch64/timer.h +++ b/libavutil/aarch64/timer.h @@ -24,7 +24,13 @@ #include #include "config.h" -#if HAVE_INLINE_ASM +#if defined(__APPLE__) + +#include + +#define AV_READ_TIME mach_absolute_time + +#elif HAVE_INLINE_ASM #define AV_READ_TIME read_time diff --git a/libavutil/arm/timer.h b/libavutil/arm/timer.h index 5e8bc8edd0..caf23e2a5a 100644 --- a/libavutil/arm/timer.h +++ b/libavutil/arm/timer.h @@ -24,7 +24,13 @@ #include #include "config.h" -#if HAVE_INLINE_ASM && defined(__ARM_ARCH_7A__) +#if defined(__APPLE__) + +#include + +#define AV_READ_TIME mach_absolute_time + +#elif HAVE_INLINE_ASM && defined(__ARM_ARCH_7A__) #define AV_READ_TIME read_time