mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 08:50:13 +01:00
anv: alloc client visible addresses at the bottom of vma_hi
Kill vma_cva and just toggle heap->alloc_high instead. This way, client visible addresses will remain isolated in their own little corner, except we have one less vma to deal with. For TR-TT we'll need a special vma, and if we don't use the trick above we'll need yet another trtt_cva_vma, increasing complexity even more. Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26036>
This commit is contained in:
parent
e1b50074fe
commit
2883c6ddaa
3 changed files with 6 additions and 24 deletions
|
|
@ -3198,10 +3198,6 @@ VkResult anv_CreateDevice(
|
|||
device->physical->va.low_heap.addr,
|
||||
device->physical->va.low_heap.size);
|
||||
|
||||
util_vma_heap_init(&device->vma_cva,
|
||||
device->physical->va.client_visible_heap.addr,
|
||||
device->physical->va.client_visible_heap.size);
|
||||
|
||||
util_vma_heap_init(&device->vma_hi,
|
||||
device->physical->va.high_heap.addr,
|
||||
device->physical->va.high_heap.size);
|
||||
|
|
@ -3672,7 +3668,6 @@ VkResult anv_CreateDevice(
|
|||
fail_vmas:
|
||||
util_vma_heap_finish(&device->vma_desc);
|
||||
util_vma_heap_finish(&device->vma_hi);
|
||||
util_vma_heap_finish(&device->vma_cva);
|
||||
util_vma_heap_finish(&device->vma_lo);
|
||||
pthread_mutex_destroy(&device->vma_mutex);
|
||||
fail_queues:
|
||||
|
|
@ -3784,7 +3779,6 @@ void anv_DestroyDevice(
|
|||
|
||||
util_vma_heap_finish(&device->vma_desc);
|
||||
util_vma_heap_finish(&device->vma_hi);
|
||||
util_vma_heap_finish(&device->vma_cva);
|
||||
util_vma_heap_finish(&device->vma_lo);
|
||||
pthread_mutex_destroy(&device->vma_mutex);
|
||||
|
||||
|
|
@ -3841,9 +3835,6 @@ static struct util_vma_heap *
|
|||
anv_vma_heap_for_flags(struct anv_device *device,
|
||||
enum anv_bo_alloc_flags alloc_flags)
|
||||
{
|
||||
if (alloc_flags & ANV_BO_ALLOC_CLIENT_VISIBLE_ADDRESS)
|
||||
return &device->vma_cva;
|
||||
|
||||
if (alloc_flags & ANV_BO_ALLOC_32BIT_ADDRESS)
|
||||
return &device->vma_lo;
|
||||
|
||||
|
|
@ -3866,13 +3857,17 @@ anv_vma_alloc(struct anv_device *device,
|
|||
*out_vma_heap = anv_vma_heap_for_flags(device, alloc_flags);
|
||||
|
||||
if (alloc_flags & ANV_BO_ALLOC_CLIENT_VISIBLE_ADDRESS) {
|
||||
assert(*out_vma_heap == &device->vma_hi);
|
||||
|
||||
if (client_address) {
|
||||
if (util_vma_heap_alloc_addr(*out_vma_heap,
|
||||
client_address, size)) {
|
||||
addr = client_address;
|
||||
}
|
||||
} else {
|
||||
(*out_vma_heap)->alloc_high = false;
|
||||
addr = util_vma_heap_alloc(*out_vma_heap, size, align);
|
||||
(*out_vma_heap)->alloc_high = true;
|
||||
}
|
||||
/* We don't want to fall back to other heaps */
|
||||
goto done;
|
||||
|
|
@ -3895,7 +3890,6 @@ anv_vma_free(struct anv_device *device,
|
|||
uint64_t address, uint64_t size)
|
||||
{
|
||||
assert(vma_heap == &device->vma_lo ||
|
||||
vma_heap == &device->vma_cva ||
|
||||
vma_heap == &device->vma_hi ||
|
||||
vma_heap == &device->vma_desc);
|
||||
|
||||
|
|
|
|||
|
|
@ -1005,10 +1005,6 @@ struct anv_physical_device {
|
|||
* Instruction state pool
|
||||
*/
|
||||
struct anv_va_range instruction_state_pool;
|
||||
/**
|
||||
* Client visible VMA allocation heap
|
||||
*/
|
||||
struct anv_va_range client_visible_heap;
|
||||
/**
|
||||
* Client heap
|
||||
*/
|
||||
|
|
@ -1554,7 +1550,6 @@ struct anv_device {
|
|||
|
||||
pthread_mutex_t vma_mutex;
|
||||
struct util_vma_heap vma_lo;
|
||||
struct util_vma_heap vma_cva;
|
||||
struct util_vma_heap vma_hi;
|
||||
struct util_vma_heap vma_desc;
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,6 @@ anv_device_print_vas(struct anv_physical_device *device)
|
|||
PRINT_HEAP(indirect_descriptor_pool);
|
||||
PRINT_HEAP(indirect_push_descriptor_pool);
|
||||
PRINT_HEAP(instruction_state_pool);
|
||||
PRINT_HEAP(client_visible_heap);
|
||||
PRINT_HEAP(high_heap);
|
||||
}
|
||||
|
||||
|
|
@ -154,18 +153,12 @@ anv_physical_device_init_va_ranges(struct anv_physical_device *device)
|
|||
address = align64(address, _4Gb);
|
||||
address = va_add(&device->va.instruction_state_pool, address, 2 * _1Gb);
|
||||
|
||||
/* Whatever we have left we split in 2 for app allocations client-visible &
|
||||
* non-client-visible.
|
||||
*
|
||||
* Leave the last 4GiB out of the high vma range, so that no state
|
||||
/* Leave the last 4GiB out of the high vma range, so that no state
|
||||
* base address + size can overflow 48 bits. For more information see
|
||||
* the comment about Wa32bitGeneralStateOffset in anv_allocator.c
|
||||
*/
|
||||
uint64_t user_heaps_size = device->gtt_size - address - 4 * _1Gb;
|
||||
uint64_t heaps_size_Gb = user_heaps_size / _1Gb / 2 ;
|
||||
|
||||
address = va_add(&device->va.client_visible_heap, address, heaps_size_Gb * _1Gb);
|
||||
address = va_add(&device->va.high_heap, address, heaps_size_Gb * _1Gb);
|
||||
address = va_add(&device->va.high_heap, address, user_heaps_size);
|
||||
|
||||
if (INTEL_DEBUG(DEBUG_HEAPS))
|
||||
anv_device_print_vas(device);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue