summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-10-17 19:47:03 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2011-10-17 21:25:16 +0100
commit1d82fe3e528578d11d2a258b586b67c807eb7cb4 (patch)
treeb545229aedb989613abaf38caf98e6b9d98bedc2
parent7758e333409409393c4c974adb2831a7b5b18fe4 (diff)
sna: Only retire the flush handler if nothing was submitted within the period
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/kgem.c3
-rw-r--r--src/sna/kgem.h1
-rw-r--r--src/sna/sna_accel.c8
3 files changed, 9 insertions, 3 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index d27ba78b..a95ce3d1 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -186,6 +186,8 @@ static int gem_read(int fd, uint32_t handle, const void *dst, int length)
Bool kgem_bo_write(struct kgem *kgem, struct kgem_bo *bo,
const void *data, int length)
{
+ assert(!gem_busy(kgem->fd, bo->handle));
+
if (gem_write(kgem->fd, bo->handle, 0, length, data))
return FALSE;
@@ -1022,6 +1024,7 @@ void _kgem_submit(struct kgem *kgem)
kgem_cleanup(kgem);
kgem_reset(kgem);
+ kgem->busy = 1;
}
void kgem_throttle(struct kgem *kgem)
diff --git a/src/sna/kgem.h b/src/sna/kgem.h
index 988281ca..a43a7129 100644
--- a/src/sna/kgem.h
+++ b/src/sna/kgem.h
@@ -105,6 +105,7 @@ struct kgem {
uint32_t flush:1;
uint32_t need_expire:1;
uint32_t need_purge:1;
+ uint32_t busy:1;
uint32_t has_vmap :1;
uint32_t has_relaxed_fencing :1;
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index b58cfc80..4f5c1525 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -4064,13 +4064,15 @@ static bool sna_accel_flush(struct sna *sna)
bool nothing_to_do =
priv->cpu_damage == NULL && priv->gpu_bo->rq == NULL;
- DBG(("%s (time=%ld), nothing_to_do=%d\n",
- __FUNCTION__, (long)GetTimeInMillis(), nothing_to_do));
+ DBG(("%s (time=%ld), nothing_to_do=%d, busy? %d\n",
+ __FUNCTION__, (long)GetTimeInMillis(),
+ nothing_to_do, sna->kgem.busy));
- if (nothing_to_do)
+ if (nothing_to_do && !sna->kgem.busy)
_sna_accel_disarm_timer(sna, FLUSH_TIMER);
else
sna_pixmap_move_to_gpu(priv->pixmap);
+ sna->kgem.busy = 0;
kgem_bo_flush(&sna->kgem, priv->gpu_bo);
return !nothing_to_do;
}