diff mbox series

[FFmpeg-devel] arm/aarch64: Use mach_absolute_time as timer on apple platforms

Message ID 20210212103256.2317142-1-martin@martin.st
State Accepted
Commit ee040a7fc23b9dbd8db6c4291e43c653d61325fe
Headers show
Series [FFmpeg-devel] arm/aarch64: Use mach_absolute_time as timer on apple platforms | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Martin Storsjö Feb. 12, 2021, 10:32 a.m. UTC
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).
---
 libavutil/aarch64/timer.h | 8 +++++++-
 libavutil/arm/timer.h     | 8 +++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)

Comments

Martin Storsjö Feb. 17, 2021, 10:31 a.m. UTC | #1
On Fri, 12 Feb 2021, Martin Storsjö wrote:

> 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).
> ---
> 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 <stdint.h>
> #include "config.h"
>
> -#if HAVE_INLINE_ASM
> +#if defined(__APPLE__)
> +
> +#include <mach/mach_time.h>
> +
> +#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 <stdint.h>
> #include "config.h"
>
> -#if HAVE_INLINE_ASM && defined(__ARM_ARCH_7A__)
> +#if defined(__APPLE__)
> +
> +#include <mach/mach_time.h>
> +
> +#define AV_READ_TIME mach_absolute_time
> +
> +#elif HAVE_INLINE_ASM && defined(__ARM_ARCH_7A__)
>
> #define AV_READ_TIME read_time
>
> -- 
> 2.25.1

I'll push this soon if there's no comments.

// Martin
diff mbox series

Patch

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 <stdint.h>
 #include "config.h"
 
-#if HAVE_INLINE_ASM
+#if defined(__APPLE__)
+
+#include <mach/mach_time.h>
+
+#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 <stdint.h>
 #include "config.h"
 
-#if HAVE_INLINE_ASM && defined(__ARM_ARCH_7A__)
+#if defined(__APPLE__)
+
+#include <mach/mach_time.h>
+
+#define AV_READ_TIME mach_absolute_time
+
+#elif HAVE_INLINE_ASM && defined(__ARM_ARCH_7A__)
 
 #define AV_READ_TIME read_time