sna: Only consider the request list when deciding whether the GPU is busy

Micro-optimisation to overhead extra checks and to make sure an
unflushed bo doesn't prevent us from submitting more work before
sleeping.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2012-06-29 12:22:55 +01:00
parent 4061f05dd6
commit 15a0761cad
2 changed files with 14 additions and 1 deletions

View File

@ -253,6 +253,16 @@ void kgem_bo_set_binding(struct kgem_bo *bo, uint32_t format, uint16_t offset);
void kgem_bo_retire(struct kgem *kgem, struct kgem_bo *bo);
bool kgem_retire(struct kgem *kgem);
static inline bool kgem_is_idle(struct kgem *kgem)
{
if (list_is_empty(&kgem->requests))
return true;
if (!kgem_retire(kgem))
return false;
return list_is_empty(&kgem->requests);
}
struct kgem_bo *kgem_get_last_request(struct kgem *kgem);
void _kgem_submit(struct kgem *kgem);

View File

@ -12807,7 +12807,10 @@ void sna_accel_close(struct sna *sna)
void sna_accel_block_handler(struct sna *sna, struct timeval **tv)
{
sna_accel_wakeup_handler(sna, NULL);
if (sna->kgem.nbatch && kgem_is_idle(&sna->kgem)) {
DBG(("%s: GPU idle, flushing\n", __FUNCTION__));
_kgem_submit(&sna->kgem);
}
if (sna_accel_do_flush(sna))
sna_accel_flush(sna);