summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-03-06 11:22:40 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2013-03-06 15:11:56 +0000
commit9a7577902ee3a1286ea2a74a79aaeff6c72a6f18 (patch)
treeb3b70bb4f55190db46d0e4171815ef9dce217045 /src
parent779fc0b20c382e572eb41d3cbf3d639e4eb77874 (diff)
sna: Lighten the wakeup handler slightly
As the wakeup handler is called more frequently, we want to avoid any of the more heavyweight processing. So trim the wakeup handler down to the check to see if the GPU is idle and so we should immediately flush what we have currently queued. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r--src/sna/sna_accel.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 25b69c93..750914d3 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -14356,6 +14356,9 @@ void sna_accel_close(struct sna *sna)
void sna_accel_block_handler(struct sna *sna, struct timeval **tv)
{
+ if (sna->kgem.need_retire)
+ kgem_retire(&sna->kgem);
+
if (sna->timer_active)
UpdateCurrentTimeIf();
@@ -14413,27 +14416,27 @@ set_tv:
}
sna->kgem.scanout_busy = false;
+
+ if (FAULT_INJECTION && (rand() % FAULT_INJECTION) == 0) {
+ ErrorF("%s hardware acceleration\n",
+ sna->kgem.wedged ? "Re-enabling" : "Disabling");
+ kgem_submit(&sna->kgem);
+ sna->kgem.wedged = !sna->kgem.wedged;
+ }
}
void sna_accel_wakeup_handler(struct sna *sna)
{
- DBG(("%s\n", __FUNCTION__));
+ DBG(("%s: nbatch=%d, need_retire=%d, need_purge=%d\n", __FUNCTION__,
+ sna->kgem.nbatch, sna->kgem.need_retire, sna->kgem.need_purge));
- if (sna->kgem.need_retire)
- kgem_retire(&sna->kgem);
- if (sna->kgem.nbatch && !sna->kgem.need_retire) {
+ if (!sna->kgem.nbatch)
+ return;
+
+ if (kgem_is_idle(&sna->kgem)) {
DBG(("%s: GPU idle, flushing\n", __FUNCTION__));
_kgem_submit(&sna->kgem);
}
- if (sna->kgem.need_purge)
- kgem_purge_cache(&sna->kgem);
-
- if (FAULT_INJECTION && (rand() % FAULT_INJECTION) == 0) {
- ErrorF("%s hardware acceleration\n",
- sna->kgem.wedged ? "Re-enabling" : "Disabling");
- kgem_submit(&sna->kgem);
- sna->kgem.wedged = !sna->kgem.wedged;
- }
}
void sna_accel_free(struct sna *sna)