summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-12-09 15:45:29 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2011-12-09 17:14:38 +0000
commitc51626ccb660c777da8d84bb425de0d590864448 (patch)
treebe2e77efeb536cefa5620200255b4f5b76df63ce
parentc22197f25bc0419d9f2abfcc978df5ef439feb47 (diff)
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 <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna.h1
-rw-r--r--src/sna/sna_accel.c7
2 files changed, 8 insertions, 0 deletions
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)