sna: Fallback to ordinary monotonic clock if coarse is not supported

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2011-12-09 23:36:56 +00:00
parent 1c202cc074
commit eb3e04d960
1 changed files with 6 additions and 1 deletions

View File

@ -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);