etnaviv: drm: use COARSE clock for timeouts when possible
COARSE clocks add a worst-case jitter of 10ms to the timing, as they degrade the timing to Linux jiffy accuracy. However, they allow to skip a syscall on platforms where the accurate version of the clock can not be accelerated through the VDSO. Switch to using the COARSE version of the clock when the timeout is larger than 200ms, i.e. the accuracy of the timeout is degraded less than 5% by the added worst-case jitter. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27079>
This commit is contained in:
@@ -211,7 +211,7 @@ extern int etna_mesa_debug;
|
||||
static inline void get_abs_timeout(struct drm_etnaviv_timespec *tv, uint64_t ns)
|
||||
{
|
||||
struct timespec t;
|
||||
clock_gettime(CLOCK_MONOTONIC, &t);
|
||||
clock_gettime(ns > 200000000 ? CLOCK_MONOTONIC_COARSE : 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) {
|
||||
|
Reference in New Issue
Block a user