summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-11-24 11:02:01 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2011-11-24 11:02:01 +0000
commit499ed74e979d99bbe1670ad54875fba6055fce5d (patch)
treee3e08ef5253db67400a7b41e517e9b6f79d5b98e
parent35239d207c38e1ae0cb843ed7a72621711cb001e (diff)
sna: Tweak cancellation of deferred flush
The goal is to keep running until the tick after every stops, irrespective of forced flushes. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/kgem.c5
-rw-r--r--src/sna/sna_accel.c22
2 files changed, 15 insertions, 12 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 478367c2..9fecb1f0 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -745,8 +745,7 @@ bool kgem_retire(struct kgem *kgem)
kgem->need_retire = !list_is_empty(&kgem->requests);
if (!kgem->need_retire && kgem->ring)
kgem->ring = kgem->mode;
- kgem->busy &= kgem->need_retire;
- DBG(("%s -- busy=%d\n", __FUNCTION__, kgem->busy));
+ DBG(("%s -- need_retire=%d\n", __FUNCTION__, kgem->need_retire));
return retired;
}
@@ -1096,7 +1095,7 @@ void _kgem_submit(struct kgem *kgem)
kgem_cleanup(kgem);
kgem_reset(kgem);
- kgem->flush_now = kgem->busy = 1;
+ kgem->flush_now = 1;
}
void kgem_throttle(struct kgem *kgem)
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 0f41003b..0d5c0bf4 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -8328,19 +8328,23 @@ static Bool sna_accel_do_flush(struct sna *sna)
struct itimerspec to;
struct sna_pixmap *priv;
- if (sna->kgem.flush_now) {
- sna_accel_drain_timer(sna, FLUSH_TIMER);
- return TRUE;
- }
-
- return_if_timer_active(FLUSH_TIMER);
-
priv = sna_accel_scanout(sna);
if (priv == NULL) {
DBG(("%s -- no scanout attached\n", __FUNCTION__));
return FALSE;
}
+ if (sna->kgem.flush_now) {
+ sna->kgem.flush_now = 0;
+ if (priv->gpu_bo->rq != NULL) {
+ DBG(("%s -- forcing flush\n", __FUNCTION__));
+ sna_accel_drain_timer(sna, FLUSH_TIMER);
+ return TRUE;
+ }
+ }
+
+ return_if_timer_active(FLUSH_TIMER);
+
if (priv->cpu_damage == NULL && priv->gpu_bo->rq == NULL) {
DBG(("%s -- no pending write to scanout\n", __FUNCTION__));
return FALSE;
@@ -8419,6 +8423,7 @@ static bool sna_accel_flush(struct sna *sna)
struct sna_pixmap *priv = sna_accel_scanout(sna);
bool nothing_to_do =
priv->cpu_damage == NULL && priv->gpu_bo->rq == NULL;
+ bool need_throttle = sna->kgem.busy;
DBG(("%s (time=%ld), nothing_to_do=%d, busy? %d\n",
__FUNCTION__, (long)GetTimeInMillis(),
@@ -8430,8 +8435,7 @@ static bool sna_accel_flush(struct sna *sna)
sna_pixmap_move_to_gpu(priv->pixmap);
sna->kgem.busy = !nothing_to_do;
kgem_bo_flush(&sna->kgem, priv->gpu_bo);
- sna->kgem.flush_now = 0;
- return !nothing_to_do;
+ return need_throttle;
}
static void sna_accel_expire(struct sna *sna)