}
VkResult
-anv_bo_pool_alloc(struct anv_bo_pool *pool, struct anv_bo *bo)
+anv_bo_pool_alloc(struct anv_bo_pool *pool, struct anv_bo *bo, uint32_t size)
{
VkResult result;
+ assert(pool->bo_size <= size);
+
void *next_free_void;
if (anv_ptr_free_list_pop(&pool->free_list, &next_free_void)) {
struct bo_pool_bo_link *next_free = next_free_void;
if (bbo == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
- result = anv_bo_pool_alloc(&cmd_buffer->device->batch_bo_pool, &bbo->bo);
+ result = anv_bo_pool_alloc(&cmd_buffer->device->batch_bo_pool, &bbo->bo,
+ ANV_CMD_BUFFER_BATCH_SIZE);
if (result != VK_SUCCESS)
goto fail_alloc;
if (bbo == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
- result = anv_bo_pool_alloc(&cmd_buffer->device->batch_bo_pool, &bbo->bo);
+ result = anv_bo_pool_alloc(&cmd_buffer->device->batch_bo_pool, &bbo->bo,
+ other_bbo->bo.size);
if (result != VK_SUCCESS)
goto fail_alloc;
/* Kernel driver requires 8 byte aligned batch length */
size = align_u32(batch->next - batch->start, 8);
assert(size < device->batch_bo_pool.bo_size);
- result = anv_bo_pool_alloc(&device->batch_bo_pool, &bo);
+ result = anv_bo_pool_alloc(&device->batch_bo_pool, &bo, 4096);
if (result != VK_SUCCESS)
return result;
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_FENCE_CREATE_INFO);
- result = anv_bo_pool_alloc(&device->batch_bo_pool, &fence_bo);
+ result = anv_bo_pool_alloc(&device->batch_bo_pool, &fence_bo, 4096);
if (result != VK_SUCCESS)
return result;
void anv_bo_pool_init(struct anv_bo_pool *pool,
struct anv_device *device, uint32_t block_size);
void anv_bo_pool_finish(struct anv_bo_pool *pool);
-VkResult anv_bo_pool_alloc(struct anv_bo_pool *pool, struct anv_bo *bo);
+VkResult anv_bo_pool_alloc(struct anv_bo_pool *pool, struct anv_bo *bo,
+ uint32_t size);
void anv_bo_pool_free(struct anv_bo_pool *pool, const struct anv_bo *bo);