radv: Don't try to find gaps for non-freeable descriptors.
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Tue, 18 Apr 2017 23:08:06 +0000 (01:08 +0200)
committerBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Wed, 19 Apr 2017 18:37:57 +0000 (20:37 +0200)
With this we don't have any operations on a pool with non-freeable
descriptors left that have O(#descriptors) complexity.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Bas Nieuwenhuizen <basni@google.com>
src/amd/vulkan/radv_descriptor_set.c

index 89945f177363aae033cfda1981e6a4fdf13d73a5..1bb37aad17b082827e993bafc4da939f716613bc 100644 (file)
@@ -300,7 +300,7 @@ radv_descriptor_set_create(struct radv_device *device,
                        set->va = device->ws->buffer_get_va(set->bo) + pool->current_offset;
                        pool->current_offset += layout_size;
                        list_addtail(&set->vram_list, &pool->vram_list);
-               } else {
+               } else if (!pool->host_memory_base) {
                        uint64_t offset = 0;
                        struct list_head *prev = &pool->vram_list;
                        struct radv_descriptor_set *cur;
@@ -324,7 +324,8 @@ radv_descriptor_set_create(struct radv_device *device,
                        set->mapped_ptr = (uint32_t*)(pool->mapped_ptr + offset);
                        set->va = device->ws->buffer_get_va(set->bo) + offset;
                        list_add(&set->vram_list, prev);
-               }
+               } else
+                       return vk_error(VK_ERROR_OUT_OF_POOL_MEMORY_KHR);
        }
 
        for (unsigned i = 0; i < layout->binding_count; ++i) {