diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-07-07 16:12:49 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2012-07-08 21:34:21 +0100 |
commit | 81cd9aa80091b9bb08b50062f117d678a3bc7a91 (patch) | |
tree | 38607201e68591bf0e485700fc5149537298f5d0 | |
parent | 6cb0c631e4eafc09f1677c73906de9108d735de4 (diff) |
sna: Tweak start/stop of the deferred flush
As we now emit work whenever we wakeup and find the GPU idle, we rarely
actually have pending work in the deferred flush queue, so try to avoid
installing a timer if we are not accumulating work.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna_accel.c | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index 60595f51..681b2831 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -12254,15 +12254,14 @@ static bool has_shadow(struct sna *sna) return !sna->mode.shadow_flip; } -static bool need_flush(struct sna *sna, struct sna_pixmap *scanout) +static bool start_flush(struct sna *sna, struct sna_pixmap *scanout) { - DBG(("%s: scanout=%d shadow?=%d, (cpu?=%d || gpu?=%d), busy=%d)\n", + DBG(("%s: scanout=%d shadow?=%d, (cpu?=%d || gpu?=%d))\n", __FUNCTION__, scanout && scanout->gpu_bo ? scanout->gpu_bo->handle : 0, has_shadow(sna), scanout && scanout->cpu_damage != NULL, - scanout && scanout->gpu_bo && scanout->gpu_bo->exec != NULL, - scanout && scanout->gpu_bo && __kgem_flush(&sna->kgem, scanout->gpu_bo))); + scanout && scanout->gpu_bo && scanout->gpu_bo->exec != NULL)); if (has_shadow(sna)) return true; @@ -12270,10 +12269,25 @@ static bool need_flush(struct sna *sna, struct sna_pixmap *scanout) if (!scanout) return false; - if (scanout->cpu_damage || scanout->gpu_bo->exec) + return scanout->cpu_damage || scanout->gpu_bo->exec; +} + +static bool stop_flush(struct sna *sna, struct sna_pixmap *scanout) +{ + DBG(("%s: scanout=%d shadow?=%d, (cpu?=%d || gpu?=%d))\n", + __FUNCTION__, + scanout && scanout->gpu_bo ? scanout->gpu_bo->handle : 0, + has_shadow(sna), + scanout && scanout->cpu_damage != NULL, + scanout && scanout->gpu_bo && scanout->gpu_bo->rq != NULL)); + + if (has_shadow(sna)) return true; - return __kgem_flush(&sna->kgem, scanout->gpu_bo); + if (!scanout) + return false; + + return scanout->cpu_damage || scanout->gpu_bo->needs_flush; } static bool sna_accel_do_flush(struct sna *sna) @@ -12301,8 +12315,9 @@ static bool sna_accel_do_flush(struct sna *sna) return true; } } else { - if (!need_flush(sna, priv)) { + if (!start_flush(sna, priv)) { DBG(("%s -- no pending write to scanout\n", __FUNCTION__)); + kgem_bo_flush(&sna->kgem, priv->gpu_bo); } else { sna->timer_active |= 1 << FLUSH_TIMER; sna->timer_expire[FLUSH_TIMER] = @@ -12417,7 +12432,7 @@ static void sna_accel_flush(struct sna *sna) sna->kgem.nbatch, sna->kgem.busy)); - busy = need_flush(sna, priv); + busy = stop_flush(sna, priv); if (!sna->kgem.busy && !busy) sna_accel_disarm_timer(sna, FLUSH_TIMER); sna->kgem.busy = busy; |