drm/etnaviv: correct timeout calculation
authorRussell King <rmk+kernel@armlinux.org.uk>
Tue, 20 Feb 2018 09:22:22 +0000 (10:22 +0100)
committerLucas Stach <l.stach@pengutronix.de>
Fri, 18 May 2018 13:27:56 +0000 (15:27 +0200)
commitd066b246d482f69553e58d52f746377ce3966b66
tree1c3cabe92e19a44149541c9a2ff8736d8835370a
parent60cc43fc888428bb2f18f08997432d426a243338
drm/etnaviv: correct timeout calculation

The old way did clamp the jiffy conversion and thus caused the timeouts
to become negative after some time. Also it didn't work with userspace
which actually fills the upper 32bits of the 64bit timestamp value.

clock_gettime() is 32-bit on 32-bit architectures. Using 64-bit timespec
math, like we do in this commit, means that when a wrap occurs, the
specified timeout goes into the past and we can't request a timeout in
the future. As the Linux implementation of CLOCK_MONOTONIC is reasonable
and starts at 0, the first such timer wrap will occur after approx. 68
years of system uptime.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
drivers/gpu/drm/etnaviv/etnaviv_drv.h