diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-11-05 21:59:37 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-11-06 09:01:17 +0000 |
commit | 7f901495cdef0ae3b4a328bb98a6bc0ff03ea362 (patch) | |
tree | db81f3d284408dc4a399011597b9343ec8c9f2ee /src/sna/kgem.c | |
parent | 736b496b458d666416ea94f157c05ce78f98a600 (diff) |
sna: Trim the overestimate of required aperture space for fence alignment
We can optimistically only require that we waste the largest fence
region in a batch, as all other fences will then be naturally aligned as
well. So long as the kernel succeeds in defragmenting the aperture...
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/kgem.c')
-rw-r--r-- | src/sna/kgem.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c index fda92c13..0f9b4433 100644 --- a/src/sna/kgem.c +++ b/src/sna/kgem.c @@ -2749,6 +2749,7 @@ void kgem_reset(struct kgem *kgem) kgem->nreloc__self = 0; kgem->aperture = 0; kgem->aperture_fenced = 0; + kgem->aperture_max_fence = 0; kgem->nbatch = 0; kgem->surface = kgem->batch_size; kgem->mode = KGEM_NONE; @@ -4724,8 +4725,8 @@ static bool aperture_check(struct kgem *kgem, unsigned num_pages) /* Leave some space in case of alignment issues */ aperture.aper_available_size -= 1024 * 1024; aperture.aper_available_size -= kgem->aperture_mappable * PAGE_SIZE / 2; - if (kgem->gen < 040) - aperture.aper_available_size -= kgem->aperture_fenced * PAGE_SIZE; + if (kgem->gen < 033) + aperture.aper_available_size -= kgem->aperture_max_fence * PAGE_SIZE; if (!kgem->has_llc) aperture.aper_available_size -= 2 * kgem->nexec * PAGE_SIZE; @@ -4841,10 +4842,12 @@ bool kgem_check_bo_fenced(struct kgem *kgem, struct kgem_bo *bo) } } - size = kgem->aperture_fenced; - size += kgem_bo_fenced_size(kgem, bo); + size = kgem_bo_fenced_size(kgem, bo); + if (size > kgem->aperture_max_fence) + kgem->aperture_max_fence = size; + size += kgem->aperture_fenced; if (kgem->gen < 033) - size *= 2; + size += kgem->aperture_max_fence; if (kgem->aperture_total == kgem->aperture_mappable) size += kgem->aperture; if (size > kgem->aperture_mappable) { @@ -4885,10 +4888,12 @@ bool kgem_check_bo_fenced(struct kgem *kgem, struct kgem_bo *bo) } } - size = kgem->aperture_fenced; - size += kgem_bo_fenced_size(kgem, bo); + size = kgem_bo_fenced_size(kgem, bo); + if (size > kgem->aperture_max_fence) + kgem->aperture_max_fence = size; + size += kgem->aperture_fenced; if (kgem->gen < 033) - size *= 2; + size += kgem->aperture_max_fence; if (kgem->aperture_total == kgem->aperture_mappable) size += kgem->aperture; if (size > kgem->aperture_mappable) { @@ -4949,7 +4954,10 @@ bool kgem_check_many_bo_fenced(struct kgem *kgem, ...) num_pages += num_pages(bo); num_exec++; if (kgem->gen < 040 && bo->tiling) { - fenced_size += kgem_bo_fenced_size(kgem, bo); + uint32_t size = kgem_bo_fenced_size(kgem, bo); + if (size > kgem->aperture_max_fence) + kgem->aperture_max_fence = size; + fenced_size += size; num_fence++; } @@ -4978,7 +4986,7 @@ bool kgem_check_many_bo_fenced(struct kgem *kgem, ...) size = kgem->aperture_fenced; size += fenced_size; if (kgem->gen < 033) - size *= 2; + size += kgem->aperture_max_fence; if (kgem->aperture_total == kgem->aperture_mappable) size += kgem->aperture; if (size > kgem->aperture_mappable) { |