etnaviv: drm: Normalize nano seconds

Make sure the nano second part is less than one second. This matches
what clock_settime expects and allows for more concise kernel
interfaces.

Signed-off-by: Guido Günther <guido.gunther@puri.sm>
Reviewed-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3534>
This commit is contained in:
Guido Günther
2020-01-23 09:20:00 +01:00
committed by Marge Bot
parent 022327f753
commit 56f955e485
+4
View File
@@ -208,6 +208,10 @@ static inline void get_abs_timeout(struct drm_etnaviv_timespec *tv, uint64_t ns)
clock_gettime(CLOCK_MONOTONIC, &t);
tv->tv_sec = t.tv_sec + ns / NSEC_PER_SEC;
tv->tv_nsec = t.tv_nsec + ns % NSEC_PER_SEC;
if (tv->tv_nsec >= NSEC_PER_SEC) {
tv->tv_nsec -= NSEC_PER_SEC;
tv->tv_sec++;
}
}
#if HAVE_VALGRIND