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>
This commit is contained in:
parent
65a8c23ca1
commit
4b7bbb2a23
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue