From c51626ccb660c777da8d84bb425de0d590864448 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 9 Dec 2011 15:45:29 +0000 Subject: sna: Use the coarse monotonic clock to coalesce wakeup events For the long interval events (such as expiring the caches), we do not need precise timing and so can use a coarse timer to allow the system to coalesce and reduce wakeup events. Signed-off-by: Chris Wilson --- src/sna/sna.h | 1 + src/sna/sna_accel.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/src/sna/sna.h b/src/sna/sna.h index bd6c8a19..3c5d56b3 100644 --- a/src/sna/sna.h +++ b/src/sna/sna.h @@ -216,6 +216,7 @@ enum { INACTIVE_TIMER, NUM_TIMERS }; +#define NUM_FINE_TIMERS 1 struct sna { ScrnInfoPtr scrn; diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index cffac538..c55ad7df 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -8513,8 +8513,15 @@ static void sna_accel_create_timers(struct sna *sna) { int id; +#ifdef CLOCK_MONOTONICE_COARSE + for (id = 0; id < NUM_FINE_TIMERS; id++) + sna->timer[id] = timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK); + for (; id < NUM_TIMERS; id++) + sna->timer[id] = timerfd_create(CLOCK_MONOTONIC_COARSE, TFD_NONBLOCK); +#else for (id = 0; id < NUM_TIMERS; id++) sna->timer[id] = timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK); +#endif } #else static void sna_accel_create_timers(struct sna *sna) -- cgit v1.2.3