Commit b297bde1 authored by Chris Wilson's avatar Chris Wilson

drm/i915/gt: Optimise aliasing-ppgtt allocations

Since the aliasing-ppgtt remains the default for gen6/gen7, it is worth
optimising the ppgtt allocation for it. In this case, we do not need to
flush the GGTT page directories entries as they are fixed during setup.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Matthew Auld <matthew.auld@intel.com>
Reviewed-by: default avatarMatthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200709190111.5492-1-chris@chris-wilson.co.uk
parent f615cb6a
...@@ -183,13 +183,11 @@ static int gen6_alloc_va_range(struct i915_address_space *vm, ...@@ -183,13 +183,11 @@ static int gen6_alloc_va_range(struct i915_address_space *vm,
struct gen6_ppgtt *ppgtt = to_gen6_ppgtt(i915_vm_to_ppgtt(vm)); struct gen6_ppgtt *ppgtt = to_gen6_ppgtt(i915_vm_to_ppgtt(vm));
struct i915_page_directory * const pd = ppgtt->base.pd; struct i915_page_directory * const pd = ppgtt->base.pd;
struct i915_page_table *pt, *alloc = NULL; struct i915_page_table *pt, *alloc = NULL;
intel_wakeref_t wakeref; bool flush = false;
u64 from = start; u64 from = start;
unsigned int pde; unsigned int pde;
int ret = 0; int ret = 0;
wakeref = intel_runtime_pm_get(&vm->i915->runtime_pm);
spin_lock(&pd->lock); spin_lock(&pd->lock);
gen6_for_each_pde(pt, pd, start, length, pde) { gen6_for_each_pde(pt, pd, start, length, pde) {
const unsigned int count = gen6_pte_count(start, length); const unsigned int count = gen6_pte_count(start, length);
...@@ -214,14 +212,20 @@ static int gen6_alloc_va_range(struct i915_address_space *vm, ...@@ -214,14 +212,20 @@ static int gen6_alloc_va_range(struct i915_address_space *vm,
alloc = pt; alloc = pt;
pt = pd->entry[pde]; pt = pd->entry[pde];
} }
flush = true;
} }
atomic_add(count, &pt->used); atomic_add(count, &pt->used);
} }
spin_unlock(&pd->lock); spin_unlock(&pd->lock);
if (i915_vma_is_bound(ppgtt->vma, I915_VMA_GLOBAL_BIND)) if (flush && i915_vma_is_bound(ppgtt->vma, I915_VMA_GLOBAL_BIND)) {
gen6_flush_pd(ppgtt, from, start); intel_wakeref_t wakeref;
with_intel_runtime_pm(&vm->i915->runtime_pm, wakeref)
gen6_flush_pd(ppgtt, from, start);
}
goto out; goto out;
...@@ -230,7 +234,6 @@ static int gen6_alloc_va_range(struct i915_address_space *vm, ...@@ -230,7 +234,6 @@ static int gen6_alloc_va_range(struct i915_address_space *vm,
out: out:
if (alloc) if (alloc)
free_px(vm, alloc); free_px(vm, alloc);
intel_runtime_pm_put(&vm->i915->runtime_pm, wakeref);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment