From eb3e04d960cd749adf696ba15c501a17cd1a184e Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 9 Dec 2011 23:36:56 +0000 Subject: [PATCH] sna: Fallback to ordinary monotonic clock if coarse is not supported Signed-off-by: Chris Wilson --- src/sna/sna_accel.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index b6a5626a..e4d6ffb6 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -8513,11 +8513,16 @@ static void sna_accel_create_timers(struct sna *sna) { int id; + /* XXX Can we replace this with OSTimer provided by dix? */ + #ifdef CLOCK_MONOTONIC_COARSE for (id = 0; id < NUM_FINE_TIMERS; id++) sna->timer[id] = timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK); - for (; id < NUM_TIMERS; id++) + for (; id < NUM_TIMERS; id++) { sna->timer[id] = timerfd_create(CLOCK_MONOTONIC_COARSE, TFD_NONBLOCK); + if (sna->timer[id] == -1) + sna->timer[id] = timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK); + } #else for (id = 0; id < NUM_TIMERS; id++) sna->timer[id] = timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK);