summaryrefslogtreecommitdiff
path: root/sys/dev/pci/drm/include
diff options
context:
space:
mode:
authorcheloha <cheloha@cvs.openbsd.org>2020-07-07 04:05:26 +0000
committercheloha <cheloha@cvs.openbsd.org>2020-07-07 04:05:26 +0000
commitf791f099684704cbfc4c303d96c592cf6a1be130 (patch)
tree7cd8bf2c1918e1c53372a7235bfd906cabd6ff7a /sys/dev/pci/drm/include
parent726f1f53346c71076876de6e7ff054850758c1d2 (diff)
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@
Diffstat (limited to 'sys/dev/pci/drm/include')
-rw-r--r--sys/dev/pci/drm/include/linux/ktime.h6
-rw-r--r--sys/dev/pci/drm/include/linux/timekeeping.h2
2 files changed, 4 insertions, 4 deletions
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;
}