Skip to content

Commit b297bde

Browse files
committed
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: Chris Wilson <[email protected]> Cc: Matthew Auld <[email protected]> Reviewed-by: Matthew Auld <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent f615cb6 commit b297bde

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

drivers/gpu/drm/i915/gt/gen6_ppgtt.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -183,13 +183,11 @@ static int gen6_alloc_va_range(struct i915_address_space *vm,
183183
struct gen6_ppgtt *ppgtt = to_gen6_ppgtt(i915_vm_to_ppgtt(vm));
184184
struct i915_page_directory * const pd = ppgtt->base.pd;
185185
struct i915_page_table *pt, *alloc = NULL;
186-
intel_wakeref_t wakeref;
186+
bool flush = false;
187187
u64 from = start;
188188
unsigned int pde;
189189
int ret = 0;
190190

191-
wakeref = intel_runtime_pm_get(&vm->i915->runtime_pm);
192-
193191
spin_lock(&pd->lock);
194192
gen6_for_each_pde(pt, pd, start, length, pde) {
195193
const unsigned int count = gen6_pte_count(start, length);
@@ -214,14 +212,20 @@ static int gen6_alloc_va_range(struct i915_address_space *vm,
214212
alloc = pt;
215213
pt = pd->entry[pde];
216214
}
215+
216+
flush = true;
217217
}
218218

219219
atomic_add(count, &pt->used);
220220
}
221221
spin_unlock(&pd->lock);
222222

223-
if (i915_vma_is_bound(ppgtt->vma, I915_VMA_GLOBAL_BIND))
224-
gen6_flush_pd(ppgtt, from, start);
223+
if (flush && i915_vma_is_bound(ppgtt->vma, I915_VMA_GLOBAL_BIND)) {
224+
intel_wakeref_t wakeref;
225+
226+
with_intel_runtime_pm(&vm->i915->runtime_pm, wakeref)
227+
gen6_flush_pd(ppgtt, from, start);
228+
}
225229

226230
goto out;
227231

@@ -230,7 +234,6 @@ static int gen6_alloc_va_range(struct i915_address_space *vm,
230234
out:
231235
if (alloc)
232236
free_px(vm, alloc);
233-
intel_runtime_pm_put(&vm->i915->runtime_pm, wakeref);
234237
return ret;
235238
}
236239

0 commit comments

Comments
 (0)