anv: add a sampler state pool

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Rohan Garg <rohan.garg@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25897>
This commit is contained in:
Lionel Landwerlin 2023-10-20 13:13:50 +03:00 committed by Marge Bot
parent ddc6bd11df
commit 18a1234541
4 changed files with 15 additions and 24 deletions

View file

@ -3320,8 +3320,8 @@ VkResult anv_CreateDevice(
device->physical->va.indirect_descriptor_pool.size);
} else {
util_vma_heap_init(&device->vma_desc,
device->physical->va.direct_descriptor_pool.addr,
device->physical->va.direct_descriptor_pool.size);
device->physical->va.bindless_surface_state_pool.addr,
device->physical->va.bindless_surface_state_pool.size);
}
util_vma_heap_init(&device->vma_trtt,

View file

@ -1048,17 +1048,18 @@ struct anv_physical_device {
*/
struct anv_va_range scratch_surface_state_pool;
/**
* Bindless surface states (used with indirect descriptors)
* Bindless surface states (indirectly referred to by indirect
* descriptors or for direct descriptors)
*/
struct anv_va_range bindless_surface_state_pool;
/**
* Bindless surface & sampler states (used with direct descriptors)
*/
struct anv_va_range direct_descriptor_pool;
/**
* Dynamic state pool
*/
struct anv_va_range dynamic_state_pool;
/**
* Sampler state pool
*/
struct anv_va_range sampler_state_pool;
/**
* Indirect descriptor pool
*/

View file

@ -53,11 +53,11 @@ anv_device_print_vas(struct anv_physical_device *device)
PRINT_HEAP(general_state_pool);
PRINT_HEAP(low_heap);
PRINT_HEAP(dynamic_state_pool);
PRINT_HEAP(sampler_state_pool);
PRINT_HEAP(binding_table_pool);
PRINT_HEAP(internal_surface_state_pool);
PRINT_HEAP(scratch_surface_state_pool);
PRINT_HEAP(bindless_surface_state_pool);
PRINT_HEAP(direct_descriptor_pool);
PRINT_HEAP(indirect_descriptor_pool);
PRINT_HEAP(indirect_push_descriptor_pool);
PRINT_HEAP(instruction_state_pool);
@ -105,8 +105,8 @@ anv_physical_device_init_va_ranges(struct anv_physical_device *device)
/* PRMs & simulation disagrees on the actual size of this heap. Take the
* smallest (simulation) so that it works everywhere.
*/
address = va_add(&device->va.dynamic_state_pool, address, _4Gb - 4096);
address = align64(address, _1Gb);
address = va_add(&device->va.dynamic_state_pool, address, _1Gb);
address = va_add(&device->va.sampler_state_pool, address, 2 * _1Gb);
/* The following addresses have to be located in a 4Gb range so that the
* binding tables can address internal surface states & bindless surface
@ -120,21 +120,11 @@ anv_physical_device_init_va_ranges(struct anv_physical_device *device)
device->va.internal_surface_state_pool.addr,
8 * _1Mb);
/* Both of the following heaps have be in the same 4Gb range from the
/* The bindless surface state heap has be in the same 4Gb range from the
* binding table pool start so they can be addressed from binding table
* entries.
*/
if (device->indirect_descriptors) {
/* With indirect descriptors, we allocate bindless surface states from
* this pool.
*/
address = va_add(&device->va.bindless_surface_state_pool, address, 2 * _1Gb);
} else {
/* With direct descriptor, descriptors set buffers are allocated
* here.
*/
address = va_add(&device->va.direct_descriptor_pool, address, 2 * _1Gb);
}
address = va_add(&device->va.bindless_surface_state_pool, address, 2 * _1Gb);
if (device->indirect_descriptors) {
/* With indirect descriptors, descriptor buffers can go anywhere, they

View file

@ -294,11 +294,11 @@ init_common_queue_state(struct anv_queue *queue, struct anv_batch *batch)
sba.BindlessSurfaceStateSize =
(device->physical->va.binding_table_pool.size +
device->physical->va.internal_surface_state_pool.size +
device->physical->va.direct_descriptor_pool.size) - 1;
device->physical->va.bindless_surface_state_pool.size) - 1;
sba.BindlessSamplerStateBufferSize =
(device->physical->va.binding_table_pool.size +
device->physical->va.internal_surface_state_pool.size +
device->physical->va.direct_descriptor_pool.size) / 4096 - 1;
device->physical->va.bindless_surface_state_pool.size) / 4096 - 1;
sba.BindlessSurfaceStateMOCS = sba.BindlessSamplerStateMOCS = mocs;
sba.BindlessSurfaceStateBaseAddressModifyEnable =
sba.BindlessSamplerStateBaseAddressModifyEnable = true;