From 448c5a95e201685e3db38859d774d48722d48d1a Mon Sep 17 00:00:00 2001 From: cheloha Date: Tue, 7 Jul 2020 04:05:25 +0000 Subject: drm: use hi-res time to implement ktime_get(), ktime_get_real() There seems to have been some confusion about the granularity of certain time interfaces in the Linux kernel when our DRM compatibility layer was written. To be clear: the Linux ktime_get() and ktime_get_real() interfaces are *high resolution* clocks. We should to implement them with high resolution interfaces from our own kernel. Thus, use microuptime(9) to implement ktime_get() and microtime(9) to implement ktime_get_real(). While here, ktime_get_raw_ns() should use ktime_get_raw(), not ktime_get(). Discussed with kettenis@ and jsg@. ok jsg@ --- sys/dev/pci/drm/include/linux/ktime.h | 6 +++--- sys/dev/pci/drm/include/linux/timekeeping.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'sys') diff --git a/sys/dev/pci/drm/include/linux/ktime.h b/sys/dev/pci/drm/include/linux/ktime.h index 8edf0205069..4e744bd9e66 100644 --- a/sys/dev/pci/drm/include/linux/ktime.h +++ b/sys/dev/pci/drm/include/linux/ktime.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ktime.h,v 1.3 2020/06/29 08:42:00 jsg Exp $ */ +/* $OpenBSD: ktime.h,v 1.4 2020/07/07 04:05:25 cheloha Exp $ */ /* * Copyright (c) 2013, 2014, 2015 Mark Kettenis * @@ -29,7 +29,7 @@ ktime_get(void) { struct timeval tv; - getmicrouptime(&tv); + microuptime(&tv); return tv; } @@ -63,7 +63,7 @@ ktime_to_ns(struct timeval tv) static inline int64_t ktime_get_raw_ns(void) { - return ktime_to_ns(ktime_get()); + return ktime_to_ns(ktime_get_raw()); } static inline struct timespec64 diff --git a/sys/dev/pci/drm/include/linux/timekeeping.h b/sys/dev/pci/drm/include/linux/timekeeping.h index ea19385fad6..a2a6828e966 100644 --- a/sys/dev/pci/drm/include/linux/timekeeping.h +++ b/sys/dev/pci/drm/include/linux/timekeeping.h @@ -16,7 +16,7 @@ static inline struct timeval ktime_get_real(void) { struct timeval tv; - getmicrotime(&tv); + microtime(&tv); return tv; } -- cgit v1.2.3-59-g8ed1b