i965: Add virtual memory allocator infrastructure to brw_bufmgr

Graphics / Mesa 3D Graphics Library / Mesa - Kenneth Graunke [whitecape.org] - 5 June 2018 01:38 EDT

This introduces a new fast virtual memory allocator integrated with our BO cache bucketing. For larger objects, it falls back to the simple free-list allocator (util_vma).

This puts the allocators in place but doesn't enable softpin yet.

v2: (feedback from Chris Wilson)- Check (bo->kflags & EXEC_OBJECT_PINNED) instead of a global flag
- Avoid vma_free(0ull) on the err_free path.- Only enable if the kernel says we have full PPGTT support- Make bucketing allocators more resistant to failing to grow arrays (feedback from Scott Phillips)
- Don't use node after popping it from the list.- Avoid undefined behavior in canonicalization by reusing new helper- Comment updates (feedback from myself)- Avoid __vma_alloc vs. vma_alloc by making a zero_high_bits helper to return a non-canonical address with the high bits zeroed.- Don't shadow loop variable 'i' when destroying things (ugly; worked)
v3:
- Replace zero_high_bits with new common gen_48b_address helper.

01058a5522 i965: Add virtual memory allocator infrastructure to brw_bufmgr.
src/mesa/drivers/dri/i965/brw_bufmgr.c | 285 ++++++++++++++++++++++++++++++++-
src/mesa/drivers/dri/i965/brw_bufmgr.h | 2 +
2 files changed, 286 insertions(+), 1 deletion(-)

Upstream: cgit.freedesktop.org


  • Share