summaryrefslogtreecommitdiff
path: root/src/sna/sna_accel.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-10-21 14:36:48 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-10-21 14:36:48 +0100
commitfb729788872ccb429ddde8a9a4281b1933243096 (patch)
tree2c62f37c5efbb5de5dd2565aac9ba167698cb82e /src/sna/sna_accel.c
parentc0d6a75f02eb97e5c80a4345ae5c68e9a81d49b6 (diff)
sna: Only query the system time if we are processing timers
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna_accel.c')
-rw-r--r--src/sna/sna_accel.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 6f2da849..6bb8eae8 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -13832,6 +13832,8 @@ static bool sna_accel_do_flush(struct sna *sna)
if (priv)
kgem_bo_flush(&sna->kgem, priv->gpu_bo);
} else {
+ if (!sna->timer_active)
+ UpdateCurrentTimeIf();
sna->timer_active |= 1 << FLUSH_TIMER;
sna->timer_expire[FLUSH_TIMER] = TIME + interval / 2;
DBG(("%s (time=%ld), starting\n", __FUNCTION__, (long)TIME));
@@ -13858,6 +13860,8 @@ static bool sna_accel_do_throttle(struct sna *sna)
DBG(("%s -- no pending activity\n", __FUNCTION__));
} else {
DBG(("%s (time=%ld), starting\n", __FUNCTION__, (long)TIME));
+ if (!sna->timer_active)
+ UpdateCurrentTimeIf();
sna->timer_active |= 1 << THROTTLE_TIMER;
sna->timer_expire[THROTTLE_TIMER] = TIME + 20;
}
@@ -13878,6 +13882,8 @@ static bool sna_accel_do_expire(struct sna *sna)
}
} else {
if (sna->kgem.need_expire) {
+ if (!sna->timer_active)
+ UpdateCurrentTimeIf();
sna->timer_active |= 1 << EXPIRE_TIMER;
sna->timer_expire[EXPIRE_TIMER] =
TIME + MAX_INACTIVE_TIME * 1000;
@@ -14343,7 +14349,8 @@ void sna_accel_close(struct sna *sna)
void sna_accel_block_handler(struct sna *sna, struct timeval **tv)
{
- UpdateCurrentTimeIf();
+ if (sna->timer_active)
+ UpdateCurrentTimeIf();
if (sna->kgem.nbatch && kgem_is_idle(&sna->kgem)) {
DBG(("%s: GPU idle, flushing\n", __FUNCTION__));