sna: Defer opportunistic flush if all bo are current on the GPU
authorChris Wilson <chris@chris-wilson.co.uk>
Mon, 28 Oct 2013 11:16:29 +0000 (11:16 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Mon, 28 Oct 2013 13:16:12 +0000 (13:16 +0000)
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
src/sna/kgem.c

index 1e1da04..f4ad469 100644 (file)
@@ -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);
 }