summaryrefslogtreecommitdiff
path: root/src/sna
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-10-21 14:32:14 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-10-21 14:32:14 +0100
commitc0d6a75f02eb97e5c80a4345ae5c68e9a81d49b6 (patch)
tree6aac71519dd67730804ebd846b189643c2218b3a /src/sna
parent7bc829c39a203c17053eb728412f698a429ad9fe (diff)
sna: Use the FLUSH_TIMER as the only wakeup timer source
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna')
-rw-r--r--src/sna/sna_accel.c46
1 files changed, 13 insertions, 33 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 9a792e50..6f2da849 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -13888,28 +13888,6 @@ static bool sna_accel_do_expire(struct sna *sna)
return false;
}
-static int32_t sna_timeout(struct sna *sna)
-{
- int32_t now = TIME, next = 0;
- int i;
-
- DBG(("%s: now=%d, active=%08x\n",
- __FUNCTION__, (int)now, sna->timer_active));
- for (i = 0; i < NUM_TIMERS; i++) {
- if (sna->timer_active & (1 << i)) {
- int32_t delta = sna->timer_expire[i] - now;
- DBG(("%s: timer[%d] expires in %d [%d]\n",
- __FUNCTION__, i, delta, sna->timer_expire[i]));
- if (next == 0 || delta < next)
- next = delta;
- }
- }
-
- DBG(("%s: active=%08x, next=+%d\n",
- __FUNCTION__, sna->timer_active, next));
- return next;
-}
-
static void sna_accel_post_damage(struct sna *sna)
{
#if HAS_PIXMAP_SHARING
@@ -14399,22 +14377,24 @@ void sna_accel_block_handler(struct sna *sna, struct timeval **tv)
sna->watch_flush = 0;
}
- if (sna->timer_active) {
+ if (sna->timer_active & 1) {
int32_t timeout;
DBG(("%s: evaluating timers, active=%x\n",
__FUNCTION__, sna->timer_active));
- timeout = sna_timeout(sna);
- if (timeout) {
- if (*tv == NULL) {
- *tv = &sna->timer_tv;
- goto set_tv;
- }
- if ((*tv)->tv_sec * 1000 + (*tv)->tv_usec / 1000 > timeout) {
+
+ timeout = sna->timer_expire[0] - TIME;
+ DBG(("%s: flush timer expires in %d [%d]\n",
+ __FUNCTION__, timeout, sna->timer_expire[0]));
+
+ if (*tv == NULL) {
+ *tv = &sna->timer_tv;
+ goto set_tv;
+ }
+ if ((*tv)->tv_sec * 1000 + (*tv)->tv_usec / 1000 > timeout) {
set_tv:
- (*tv)->tv_sec = timeout / 1000;
- (*tv)->tv_usec = timeout % 1000 * 1000;
- }
+ (*tv)->tv_sec = timeout / 1000;
+ (*tv)->tv_usec = timeout % 1000 * 1000;
}
}
}