diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-12-29 14:14:41 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2012-12-29 15:46:00 +0000 |
commit | 8c56c9b1da9e078bd5b7ff4ebc5d8b23f593d500 (patch) | |
tree | 8a86c3e4337442fb8a4ca9e962a4c5ab53fb9738 | |
parent | 2f53fb389c001f68134f514e30e25e91de41fb9d (diff) |
sna: Allow a flush to occur before batching a flush-bo
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/kgem.c | 19 | ||||
-rw-r--r-- | src/sna/kgem.h | 9 |
2 files changed, 17 insertions, 11 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c index 1e8d6564..21d5d1cb 100644 --- a/src/sna/kgem.c +++ b/src/sna/kgem.c @@ -3929,19 +3929,19 @@ bool kgem_check_bo(struct kgem *kgem, ...) struct kgem_bo *bo; int num_exec = 0; int num_pages = 0; + bool flush = false; va_start(ap, kgem); while ((bo = va_arg(ap, struct kgem_bo *))) { + while (bo->proxy) + bo = bo->proxy; if (bo->exec) continue; - while (bo->proxy) { - bo = bo->proxy; - if (bo->exec) - continue; - } num_pages += num_pages(bo); num_exec++; + + flush |= bo->flush; } va_end(ap); @@ -3951,7 +3951,7 @@ bool kgem_check_bo(struct kgem *kgem, ...) if (!num_pages) return true; - if (kgem_flush(kgem)) + if (kgem_flush(kgem, flush)) return false; if (kgem->aperture > kgem->aperture_low && @@ -4002,7 +4002,7 @@ bool kgem_check_bo_fenced(struct kgem *kgem, struct kgem_bo *bo) return true; } - if (kgem_flush(kgem)) + if (kgem_flush(kgem, bo->flush)) return false; if (kgem->nexec >= KGEM_EXEC_SIZE(kgem) - 1) @@ -4040,6 +4040,7 @@ bool kgem_check_many_bo_fenced(struct kgem *kgem, ...) int num_exec = 0; int num_pages = 0; int fenced_size = 0; + bool flush = false; va_start(ap, kgem); while ((bo = va_arg(ap, struct kgem_bo *))) { @@ -4063,6 +4064,8 @@ bool kgem_check_many_bo_fenced(struct kgem *kgem, ...) fenced_size += kgem_bo_fenced_size(kgem, bo); num_fence++; } + + flush |= bo->flush; } va_end(ap); @@ -4079,7 +4082,7 @@ bool kgem_check_many_bo_fenced(struct kgem *kgem, ...) } if (num_pages) { - if (kgem_flush(kgem)) + if (kgem_flush(kgem, flush)) return false; if (kgem->aperture > kgem->aperture_low && diff --git a/src/sna/kgem.h b/src/sna/kgem.h index cc4ef6ad..bf457930 100644 --- a/src/sna/kgem.h +++ b/src/sna/kgem.h @@ -302,9 +302,12 @@ static inline void kgem_submit(struct kgem *kgem) _kgem_submit(kgem); } -static inline bool kgem_flush(struct kgem *kgem) +static inline bool kgem_flush(struct kgem *kgem, bool flush) { - return kgem->flush && kgem_ring_is_idle(kgem, kgem->ring); + if (kgem->nexec == 0) + return false; + + return (kgem->flush ^ flush) && kgem_ring_is_idle(kgem, kgem->ring); } static inline void kgem_bo_submit(struct kgem *kgem, struct kgem_bo *bo) @@ -571,7 +574,7 @@ static inline bool __kgem_bo_is_busy(struct kgem *kgem, struct kgem_bo *bo) DBG(("%s: handle=%d, domain: %d exec? %d, rq? %d\n", __FUNCTION__, bo->handle, bo->domain, bo->exec != NULL, bo->rq != NULL)); assert(bo->refcnt); - if (kgem_flush(kgem)) + if (kgem_flush(kgem, bo->flush)) kgem_submit(kgem); if (bo->rq && !bo->exec) kgem_retire(kgem); |