anv: Add a general state pool
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8342>
This commit is contained in:

committed by
Jordan Justen

parent
a6f8d59142
commit
4077ca1cc8
@@ -1487,6 +1487,14 @@ setup_execbuf_for_cmd_buffer(struct anv_execbuf *execbuf,
|
||||
}
|
||||
|
||||
struct anv_block_pool *pool;
|
||||
pool = &cmd_buffer->device->general_state_pool.block_pool;
|
||||
anv_block_pool_foreach_bo(bo, pool) {
|
||||
result = anv_execbuf_add_bo(cmd_buffer->device, execbuf,
|
||||
bo, NULL, 0);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
}
|
||||
|
||||
pool = &cmd_buffer->device->dynamic_state_pool.block_pool;
|
||||
anv_block_pool_foreach_bo(bo, pool) {
|
||||
result = anv_execbuf_add_bo(cmd_buffer->device, execbuf,
|
||||
|
@@ -267,6 +267,8 @@ static VkResult anv_create_cmd_buffer(
|
||||
&device->surface_state_pool, 4096);
|
||||
anv_state_stream_init(&cmd_buffer->dynamic_state_stream,
|
||||
&device->dynamic_state_pool, 16384);
|
||||
anv_state_stream_init(&cmd_buffer->general_state_stream,
|
||||
&device->general_state_pool, 16384);
|
||||
|
||||
anv_cmd_state_init(cmd_buffer);
|
||||
|
||||
@@ -319,6 +321,7 @@ anv_cmd_buffer_destroy(struct anv_cmd_buffer *cmd_buffer)
|
||||
|
||||
anv_state_stream_finish(&cmd_buffer->surface_state_stream);
|
||||
anv_state_stream_finish(&cmd_buffer->dynamic_state_stream);
|
||||
anv_state_stream_finish(&cmd_buffer->general_state_stream);
|
||||
|
||||
anv_cmd_state_finish(cmd_buffer);
|
||||
|
||||
@@ -357,6 +360,11 @@ anv_cmd_buffer_reset(struct anv_cmd_buffer *cmd_buffer)
|
||||
anv_state_stream_finish(&cmd_buffer->dynamic_state_stream);
|
||||
anv_state_stream_init(&cmd_buffer->dynamic_state_stream,
|
||||
&cmd_buffer->device->dynamic_state_pool, 16384);
|
||||
|
||||
anv_state_stream_finish(&cmd_buffer->general_state_stream);
|
||||
anv_state_stream_init(&cmd_buffer->general_state_stream,
|
||||
&cmd_buffer->device->general_state_pool, 16384);
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
|
@@ -2918,10 +2918,19 @@ VkResult anv_CreateDevice(
|
||||
|
||||
anv_bo_pool_init(&device->batch_bo_pool, device);
|
||||
|
||||
/* Because scratch is also relative to General State Base Address, we leave
|
||||
* the base address 0 and start the pool memory at an offset. This way we
|
||||
* get the correct offsets in the anv_states that get allocated from it.
|
||||
*/
|
||||
result = anv_state_pool_init(&device->general_state_pool, device,
|
||||
0, GENERAL_STATE_POOL_MIN_ADDRESS, 16384);
|
||||
if (result != VK_SUCCESS)
|
||||
goto fail_batch_bo_pool;
|
||||
|
||||
result = anv_state_pool_init(&device->dynamic_state_pool, device,
|
||||
DYNAMIC_STATE_POOL_MIN_ADDRESS, 0, 16384);
|
||||
if (result != VK_SUCCESS)
|
||||
goto fail_batch_bo_pool;
|
||||
goto fail_general_state_pool;
|
||||
|
||||
if (device->info.gen >= 8) {
|
||||
/* The border color pointer is limited to 24 bits, so we need to make
|
||||
@@ -3075,6 +3084,8 @@ VkResult anv_CreateDevice(
|
||||
if (device->info.gen >= 8)
|
||||
anv_state_reserved_pool_finish(&device->custom_border_colors);
|
||||
anv_state_pool_finish(&device->dynamic_state_pool);
|
||||
fail_general_state_pool:
|
||||
anv_state_pool_finish(&device->general_state_pool);
|
||||
fail_batch_bo_pool:
|
||||
anv_bo_pool_finish(&device->batch_bo_pool);
|
||||
anv_bo_cache_finish(&device->bo_cache);
|
||||
@@ -3142,6 +3153,7 @@ void anv_DestroyDevice(
|
||||
anv_state_pool_finish(&device->surface_state_pool);
|
||||
anv_state_pool_finish(&device->instruction_state_pool);
|
||||
anv_state_pool_finish(&device->dynamic_state_pool);
|
||||
anv_state_pool_finish(&device->general_state_pool);
|
||||
|
||||
anv_bo_pool_finish(&device->batch_bo_pool);
|
||||
|
||||
|
@@ -121,8 +121,10 @@ struct gen_perf_query_result;
|
||||
* various reasons. This healthy margin prevents reads from wrapping around
|
||||
* 48-bit addresses.
|
||||
*/
|
||||
#define LOW_HEAP_MIN_ADDRESS 0x000000001000ULL /* 4 KiB */
|
||||
#define LOW_HEAP_MAX_ADDRESS 0x0000bfffffffULL
|
||||
#define GENERAL_STATE_POOL_MIN_ADDRESS 0x000000010000ULL /* 64 KiB */
|
||||
#define GENERAL_STATE_POOL_MAX_ADDRESS 0x00003fffffffULL
|
||||
#define LOW_HEAP_MIN_ADDRESS 0x000040000000ULL /* 1 GiB */
|
||||
#define LOW_HEAP_MAX_ADDRESS 0x00007fffffffULL
|
||||
#define DYNAMIC_STATE_POOL_MIN_ADDRESS 0x0000c0000000ULL /* 3 GiB */
|
||||
#define DYNAMIC_STATE_POOL_MAX_ADDRESS 0x0000ffffffffULL
|
||||
#define BINDING_TABLE_POOL_MIN_ADDRESS 0x000100000000ULL /* 4 GiB */
|
||||
@@ -135,6 +137,8 @@ struct gen_perf_query_result;
|
||||
#define CLIENT_VISIBLE_HEAP_MAX_ADDRESS 0x0002bfffffffULL
|
||||
#define HIGH_HEAP_MIN_ADDRESS 0x0002c0000000ULL /* 11 GiB */
|
||||
|
||||
#define GENERAL_STATE_POOL_SIZE \
|
||||
(GENERAL_STATE_POOL_MAX_ADDRESS - GENERAL_STATE_POOL_MIN_ADDRESS + 1)
|
||||
#define LOW_HEAP_SIZE \
|
||||
(LOW_HEAP_MAX_ADDRESS - LOW_HEAP_MIN_ADDRESS + 1)
|
||||
#define DYNAMIC_STATE_POOL_SIZE \
|
||||
@@ -1370,6 +1374,7 @@ struct anv_device {
|
||||
|
||||
struct anv_bo_cache bo_cache;
|
||||
|
||||
struct anv_state_pool general_state_pool;
|
||||
struct anv_state_pool dynamic_state_pool;
|
||||
struct anv_state_pool instruction_state_pool;
|
||||
struct anv_state_pool binding_table_pool;
|
||||
@@ -3049,6 +3054,7 @@ struct anv_cmd_buffer {
|
||||
/* Stream objects for storing temporary data */
|
||||
struct anv_state_stream surface_state_stream;
|
||||
struct anv_state_stream dynamic_state_stream;
|
||||
struct anv_state_stream general_state_stream;
|
||||
|
||||
VkCommandBufferUsageFlags usage_flags;
|
||||
VkCommandBufferLevel level;
|
||||
|
Reference in New Issue
Block a user