From f7d1da8ca5e1695b0459f87e85c587b26193e633 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Mon, 28 Oct 2013 11:16:29 +0000 Subject: [PATCH] sna: Defer opportunistic flush if all bo are current on the GPU Signed-off-by: Chris Wilson --- src/sna/kgem.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/sna/kgem.c b/src/sna/kgem.c index 1e1da04..f4ad469 100644 --- a/src/sna/kgem.c +++ b/src/sna/kgem.c @@ -4674,6 +4674,7 @@ bool kgem_check_bo(struct kgem *kgem, ...) int num_exec = 0; int num_pages = 0; bool flush = false; + bool active = true; va_start(ap, kgem); while ((bo = va_arg(ap, struct kgem_bo *))) { @@ -4691,6 +4692,7 @@ bool kgem_check_bo(struct kgem *kgem, ...) num_exec++; flush |= bo->flush; + active &= bo->rq != NULL; } va_end(ap); @@ -4713,6 +4715,9 @@ bool kgem_check_bo(struct kgem *kgem, ...) return false; } + if (active) + return true; + return kgem_flush(kgem, flush); } @@ -4793,6 +4798,9 @@ bool kgem_check_bo_fenced(struct kgem *kgem, struct kgem_bo *bo) return false; } + if (bo->rq) + return true; + return kgem_flush(kgem, bo->flush); } @@ -4805,6 +4813,7 @@ bool kgem_check_many_bo_fenced(struct kgem *kgem, ...) int num_pages = 0; int fenced_size = 0; bool flush = false; + bool active = true; va_start(ap, kgem); while ((bo = va_arg(ap, struct kgem_bo *))) { @@ -4838,6 +4847,7 @@ bool kgem_check_many_bo_fenced(struct kgem *kgem, ...) } flush |= bo->flush; + active &= bo->rq != NULL; } va_end(ap); @@ -4876,6 +4886,9 @@ bool kgem_check_many_bo_fenced(struct kgem *kgem, ...) return false; } + if (active) + return true; + return kgem_flush(kgem, flush); } -- 2.7.4