The commit
a80b83b7 exported ktime_get_monotonic_offset()
but note that this was already in place on the header
files declared as extern, it was just never exported.
To work around the double possible declaration issue
with older kernels fortunately the LINUX_BACKPORT()
macro comes to the rescue by encofring our version
to be declared and used in backport code. Note that
this was added due to commit
c61eef72 added as of
v3.8 for DRM drivers that need access to timestamps that
do no do not jump, unfortunately for older kernels we
can't port that since it requires access to a static
variable on the kernel, so just use the timestamps that
jump.
mcgrof@frijol ~/linux-stable (git::master)$ git describe --contains
a80b83b7
v3.5-rc6~10^2~15^2~30
mcgrof@frijol ~/linux-stable (git::master)$ git describe --contains
c61eef72
v3.8-rc1~42^2~170
commit
a80b83b7b8456e9b475346c2e01d7e210883208c
Author: John Stultz <john.stultz@linaro.org>
Date: Fri Feb 3 00:19:07 2012 -0800
Input: add infrastructure for selecting clockid for event time stamps
As noted by Arve and others, since wall time can jump backwards, it is
difficult to use for input because one cannot determine if one event
occurred before another or for how long a key was pressed.
However, the timestamp field is part of the kernel ABI, and cannot be
changed without possibly breaking existing users.
This patch adds a new IOCTL that allows a clockid to be set in the
evdev_client struct that will specify which time base to use for event
timestamps (ie: CLOCK_MONOTONIC instead of CLOCK_REALTIME).
For now we only support CLOCK_MONOTONIC and CLOCK_REALTIME, but
in the future we could support other clockids if appropriate.
The default remains CLOCK_REALTIME, so we don't change the ABI.
Signed-off-by: John Stultz <john.stultz@linaro.org>
Reviewed-by: Daniel Kurtz <djkurtz@google.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
commit
c61eef726a78ae77b6ce223d01ea2130f465fe5c
Author: Imre Deak <imre.deak@intel.com>
Date: Tue Oct 23 18:53:26 2012 +0000
drm: add support for monotonic vblank timestamps
Jumps in the vblank and page flip event timestamps cause trouble for
clients, so we should avoid them. The timestamp we get currently with
gettimeofday can jump, so use instead monotonic timestamps.
For backward compatibility use a module flag to revert back to using
gettimeofday timestamps. Add also a DRM_CAP_TIMESTAMP_MONOTONIC flag
that is simply a read only version of the module flag, so that clients
can query this without depending on sysfs.
Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
/*
- * Copyright 2012 Luis R. Rodriguez <mcgrof@do-not-panic.com>
+ * Copyright 2012-2013 Luis R. Rodriguez <mcgrof@do-not-panic.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
#include <linux/module.h>
#include <linux/highuid.h>
+#include <linux/ktime.h>
/*
* Commit 7a4e7408c5cadb240e068a662251754a562355e3
EXPORT_SYMBOL_GPL(overflowuid);
EXPORT_SYMBOL_GPL(overflowgid);
#endif
+
+/*
+ * We can't access the timekeeper static variable
+ * on older kernels so we're shit out of luck and
+ * have to rely on time that might jump. Upgrade
+ * if you want timestamps that don't jump, this
+ * important for DRM vblank and page flip event
+ * timestamps.
+ */
+ktime_t ktime_get_monotonic_offset(void)
+{
+ return ktime_get();
+}
+EXPORT_SYMBOL_GPL(ktime_get_monotonic_offset);
#define net_dbg_ratelimited(fmt, ...) \
net_ratelimited_function(pr_debug, fmt, ##__VA_ARGS__)
+#define ktime_get_monotonic_offset LINUX_BACKPORT(ktime_get_monotonic_offset)
+extern ktime_t ktime_get_monotonic_offset(void);
+
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) */
#endif /* LINUX_3_5_COMPAT_H */