summaryrefslogtreecommitdiff
path: root/lib/igt_aux.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2016-05-02 14:42:54 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2016-05-02 14:58:00 +0100
commit47825918733b3761f640ec9e1b8743da0932de9f (patch)
tree9f94a09a253490d24f1592ac2a6d3b74fd7591e4 /lib/igt_aux.c
parent92a95888410d0d0c4be2bdc74f30367e07207cfd (diff)
lib: Tweak calibration of initial settimer delay
If we assume that the first settimer and clock_gettime() itself have appreciable overhead, try to exclude those from the calibration delay. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'lib/igt_aux.c')
-rw-r--r--lib/igt_aux.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index fe183650..68c9fba1 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -182,6 +182,9 @@ static bool igt_sigiter_start(struct igt_sigiter *iter, bool enable)
sev.sigev_signo = SIGRTMIN;
igt_assert(timer_create(CLOCK_MONOTONIC, &sev, &__igt_sigiter.timer) == 0);
+ memset(&its, 0, sizeof(its));
+ igt_assert(timer_settime(__igt_sigiter.timer, 0, &its, NULL) == 0);
+
memset(&act, 0, sizeof(act));
act.sa_sigaction = sigiter;
act.sa_flags = SA_SIGINFO;
@@ -192,7 +195,6 @@ static bool igt_sigiter_start(struct igt_sigiter *iter, bool enable)
* and avoid the timer firing before we enter the drmIoctl.
*/
igt_assert(clock_gettime(CLOCK_MONOTONIC, &start) == 0);
- memset(&its, 0, sizeof(its));
igt_assert(timer_settime(__igt_sigiter.timer, 0, &its, NULL) == 0);
igt_assert(clock_gettime(CLOCK_MONOTONIC, &end) == 0);
@@ -202,6 +204,11 @@ static bool igt_sigiter_start(struct igt_sigiter *iter, bool enable)
__igt_sigiter.offset.tv_nsec += NSEC_PER_SEC;
__igt_sigiter.offset.tv_sec -= 1;
}
+ if (__igt_sigiter.offset.tv_sec < 0) {
+ __igt_sigiter.offset.tv_nsec = 0;
+ __igt_sigiter.offset.tv_sec = 0;
+ }
+ igt_assert(__igt_sigiter.offset.tv_sec == 0);
igt_debug("Initial delay for interruption: %ld.%09lds\n",
__igt_sigiter.offset.tv_sec,