summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-12-07 16:43:32 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-12-07 16:43:32 +0000
commit4b7bbb2a23b03bac63f864c33f47fab88dedbf67 (patch)
tree2099217881b851d19a131da7fba90742427537d1
parent65a8c23ca1bc8e2ebd087027a30358704d4bf11c (diff)
sna: Only flush before adding fresh surfaces to the batch
Previously, before every operation we would look to see if the GPU was idle and we were running under a DRI compositor. If the GPU was idle, we would flush the batch in the hope that we reduce the cost of the context switch and copy from the compositor (by completing the work earlier). However, we would complete the work far too earlier and as a result would need to flush the batch before every single operation resulting in extra overhead and reduced performance. For example, the gtkperf circles benchmark under gnome-shell/compiz would be 2x slower on Ivybridge. Reported-by: Michael Larabel <michael@phoronix.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/kgem.c18
-rw-r--r--src/sna/kgem.h2
2 files changed, 10 insertions, 10 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 2138f1a2..200c7555 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -3716,9 +3716,6 @@ bool kgem_check_bo(struct kgem *kgem, ...)
int num_exec = 0;
int num_pages = 0;
- if (kgem_flush(kgem))
- return false;
-
va_start(ap, kgem);
while ((bo = va_arg(ap, struct kgem_bo *))) {
if (bo->exec)
@@ -3740,6 +3737,9 @@ bool kgem_check_bo(struct kgem *kgem, ...)
if (!num_pages)
return true;
+ if (kgem_flush(kgem))
+ return false;
+
if (kgem->aperture > kgem->aperture_low && kgem_is_idle(kgem)) {
DBG(("%s: current aperture usage (%d) is greater than low water mark (%d)\n",
__FUNCTION__, kgem->aperture, kgem->aperture_low));
@@ -3765,9 +3765,6 @@ bool kgem_check_bo_fenced(struct kgem *kgem, struct kgem_bo *bo)
{
uint32_t size;
- if (kgem_flush(kgem))
- return false;
-
while (bo->proxy)
bo = bo->proxy;
if (bo->exec) {
@@ -3786,6 +3783,9 @@ bool kgem_check_bo_fenced(struct kgem *kgem, struct kgem_bo *bo)
return true;
}
+ if (kgem_flush(kgem))
+ return false;
+
if (kgem->nexec >= KGEM_EXEC_SIZE(kgem) - 1)
return false;
@@ -3820,9 +3820,6 @@ bool kgem_check_many_bo_fenced(struct kgem *kgem, ...)
int num_pages = 0;
int fenced_size = 0;
- if (kgem_flush(kgem))
- return false;
-
va_start(ap, kgem);
while ((bo = va_arg(ap, struct kgem_bo *))) {
while (bo->proxy)
@@ -3860,6 +3857,9 @@ bool kgem_check_many_bo_fenced(struct kgem *kgem, ...)
}
if (num_pages) {
+ if (kgem_flush(kgem))
+ return false;
+
if (kgem->aperture > kgem->aperture_low && kgem_is_idle(kgem))
return false;
diff --git a/src/sna/kgem.h b/src/sna/kgem.h
index 2d04b53c..8a3a4fa2 100644
--- a/src/sna/kgem.h
+++ b/src/sna/kgem.h
@@ -294,7 +294,7 @@ static inline void kgem_submit(struct kgem *kgem)
static inline bool kgem_flush(struct kgem *kgem)
{
- return kgem->flush && kgem_is_idle(kgem);
+ return kgem->flush && list_is_empty(&kgem->requests[kgem->ring]);
}
static inline void kgem_bo_submit(struct kgem *kgem, struct kgem_bo *bo)