diff options
author | Jason Ekstrand <jason@jlekstrand.net> | 2020-05-04 17:08:00 -0500 |
---|---|---|
committer | Jordan Justen <jordan.l.justen@intel.com> | 2021-01-13 13:10:28 -0800 |
commit | 4077ca1cc805cf6bd37a7b1c3afc99e7a11e45e8 (patch) | |
tree | 85ed1f803f43e89c645e0f00998cc8f45b12d79b | |
parent | a6f8d5914206abf5f3e04d6acaae2bbb45315e03 (diff) | |
download | mesa-4077ca1cc805cf6bd37a7b1c3afc99e7a11e45e8.tar.gz |
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>
-rw-r--r-- | src/intel/vulkan/anv_batch_chain.c | 8 | ||||
-rw-r--r-- | src/intel/vulkan/anv_cmd_buffer.c | 8 | ||||
-rw-r--r-- | src/intel/vulkan/anv_device.c | 14 | ||||
-rw-r--r-- | src/intel/vulkan/anv_private.h | 10 |
4 files changed, 37 insertions, 3 deletions
diff --git a/src/intel/vulkan/anv_batch_chain.c b/src/intel/vulkan/anv_batch_chain.c index d6d8554d6c8..867aad91ca9 100644 --- a/src/intel/vulkan/anv_batch_chain.c +++ b/src/intel/vulkan/anv_batch_chain.c @@ -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, diff --git a/src/intel/vulkan/anv_cmd_buffer.c b/src/intel/vulkan/anv_cmd_buffer.c index 017283fb44a..6d605fbce6a 100644 --- a/src/intel/vulkan/anv_cmd_buffer.c +++ b/src/intel/vulkan/anv_cmd_buffer.c @@ -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; } diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index dfd8581a18f..bcc33923b2a 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -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); diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index 0b78f7a298f..a9950eb5ae9 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -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; |