diff options
author | Jason Ekstrand <[email protected]> | 2019-02-26 18:05:34 -0600 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2019-04-19 19:56:42 +0000 |
commit | 83b943cc2f2408087795ee2bd984477a1749a530 (patch) | |
tree | 3738c9ebfa9d4a5107675ddd8b5f7714ae4a1609 /src/intel/vulkan/anv_batch_chain.c | |
parent | a9241edfa3ed1ccf9b5635d1313d88e532d46cd5 (diff) |
anv: Make all VkDeviceMemory BOs resident permanently
We spend a lot of time in the driver adding things to hash sets to track
residency. The reality is that a properly built Vulkan app uses large
memory objects and sub-allocates from them. In a typical frame, most of
if not all of those allocations are going to be resident for the entire
frame so we're really not saving ourselves much by tracking fine-grained
residency. Just throwing everything in the validation list does make it
a little bit more expensive inside the kernel to walk the list and
ensure that all our VA is in order. However, without relocations, the
overhead of that is pretty small.
If we ever do run into a memory pressure situation where the fine-
grained residency could even potentially help, we would likely be
swapping one page out to make room for another within the draw call and
performance is totally lost at that point. We're better off swapping
out other apps and just letting ours run a whole frame.
Reviewed-by: Lionel Landwerlin <[email protected]>
Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
Diffstat (limited to 'src/intel/vulkan/anv_batch_chain.c')
-rw-r--r-- | src/intel/vulkan/anv_batch_chain.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/intel/vulkan/anv_batch_chain.c b/src/intel/vulkan/anv_batch_chain.c index cf40d8b7123..098b1a39514 100644 --- a/src/intel/vulkan/anv_batch_chain.c +++ b/src/intel/vulkan/anv_batch_chain.c @@ -1393,18 +1393,13 @@ setup_execbuf_for_cmd_buffer(struct anv_execbuf *execbuf, anv_execbuf_add_bo_set(execbuf, cmd_buffer->surface_relocs.deps, 0, &cmd_buffer->device->alloc); - /* Add the BOs for all the pinned buffers */ - if (cmd_buffer->device->pinned_buffers->entries) { - struct set *pinned_bos = _mesa_pointer_set_create(NULL); - if (pinned_bos == NULL) - return vk_error(VK_ERROR_OUT_OF_DEVICE_MEMORY); - set_foreach(cmd_buffer->device->pinned_buffers, entry) { - const struct anv_buffer *buffer = entry->key; - _mesa_set_add(pinned_bos, buffer->address.bo); - } - anv_execbuf_add_bo_set(execbuf, pinned_bos, 0, - &cmd_buffer->device->alloc); - _mesa_set_destroy(pinned_bos, NULL); + /* Add the BOs for all memory objects */ + list_for_each_entry(struct anv_device_memory, mem, + &cmd_buffer->device->memory_objects, link) { + result = anv_execbuf_add_bo(execbuf, mem->bo, NULL, 0, + &cmd_buffer->device->alloc); + if (result != VK_SUCCESS) + return result; } struct anv_block_pool *pool; |